:root {
  color-scheme: light;
  --ink: #141923;
  --muted: #657184;
  --line: #d9e0e4;
  --surface: #ffffff;
  --soft: #f0f4f2;
  --mint: #176b50;
  --mint-dark: #0d4738;
  --mint-soft: #e2f2eb;
  --red: #bd4b42;
  --blue: #285f89;
  --blue-soft: #e7f0f6;
  --gold: #a96813;
  --gold-soft: #fff1d8;
  --shadow: 0 16px 34px rgba(20, 25, 35, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  background: linear-gradient(180deg, #f8faf8 0%, #edf2f2 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang TC",
    "Microsoft JhengHei", "Noto Sans TC", Arial, sans-serif;
  font-weight: 360;
}

button,
a {
  font: inherit;
}

button {
  cursor: pointer;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  margin-bottom: 0;
  letter-spacing: 0;
  font-weight: 490;
}

strong {
  font-weight: 470;
}

button,
.top-actions a {
  font-weight: 460;
}

strong,
.sku-price strong,
.hero-metrics strong,
.metric-row strong,
.total-stack strong,
.qty,
.pill {
  font-variant-numeric: tabular-nums;
}

.shell {
  width: min(1320px, calc(100vw - 20px));
  margin: 0 auto;
  padding: 10px 0 18px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  border: 1px solid rgba(217, 224, 228, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  padding: 8px 9px;
  box-shadow: 0 8px 22px rgba(20, 25, 35, 0.06);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.brand-symbol {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.15;
}

.brand small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 410;
}

.top-actions,
.chip-row,
.segmented,
.module-strip,
.state-track,
.merchant-context {
  display: flex;
  gap: 6px;
}

.top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-actions a,
.chip-row button,
.segmented button,
.payment-stack button,
.module-strip button,
.state-track button,
.merchant-context button,
.phone-head button,
.qty button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 460;
}

.top-actions a {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
}

.top-actions a.active,
.chip-row button.active,
.segmented button.active,
.payment-stack button.active,
.module-strip button.active,
.state-track button.active,
.merchant-context button.active {
  border-color: transparent;
  background: var(--mint);
  color: #fff;
}

.page-hero,
.scan-gate,
.catalog-panel,
.checkout-panel,
.ops-shell,
.hero-metrics article,
.receipt-row,
.option-panel,
.total-stack,
.ops-card,
.task-row,
.sku-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.page-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.72fr);
  gap: 8px;
  margin-bottom: 8px;
  padding: 10px;
  box-shadow: var(--shadow);
}

.scan-gate {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.48fr) auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 10px;
  background:
    linear-gradient(135deg, rgba(20, 25, 35, 0.96), rgba(13, 71, 56, 0.94)),
    var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
}

.scan-copy h2 {
  font-size: 21px;
  line-height: 1.08;
}

.scan-copy p:not(.eyebrow) {
  max-width: 680px;
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  line-height: 1.38;
}

.scan-gate .eyebrow {
  color: #8dd7b8;
}

.scan-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin-top: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 0 9px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 410;
}

.qr-ticket {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.09);
  padding: 8px;
}

.qr-ticket span,
.qr-ticket small {
  display: block;
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  font-weight: 410;
}

.qr-ticket strong {
  display: block;
  margin: 3px 0;
  color: #fff;
  font-size: 14px;
}

.qr-code {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  width: 74px;
  height: 74px;
  border-radius: 8px;
  background: #fff;
  padding: 7px;
}

.qr-code span {
  border-radius: 2px;
  background: #111923;
}

.qr-code span:nth-child(2),
.qr-code span:nth-child(4),
.qr-code span:nth-child(8),
.qr-code span:nth-child(11),
.qr-code span:nth-child(15),
.qr-code span:nth-child(17),
.qr-code span:nth-child(22),
.qr-code span:nth-child(24) {
  background: #dce7e2;
}

.scan-action {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: var(--mint-dark);
  padding: 0 12px;
  font-weight: 460;
  white-space: nowrap;
}

.scan-pending .commerce-layout {
  display: none;
}

.scan-complete .scan-gate {
  background: linear-gradient(135deg, rgba(13, 71, 56, 0.96), rgba(40, 95, 137, 0.9));
}

.page-hero h1 {
  font-size: clamp(28px, 3.7vw, 46px);
  line-height: 1.02;
}

.page-hero p:not(.eyebrow) {
  max-width: 760px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.42;
}

.merchant-hero {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(231, 240, 246, 0.92));
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--mint);
  font-size: 11px;
  font-weight: 480;
  text-transform: uppercase;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.hero-metrics article {
  display: grid;
  align-content: center;
  min-height: 74px;
  padding: 8px;
  background: var(--soft);
}

.hero-metrics span,
.section-title > span,
.phone-head span,
.visual-card span,
.sku-meta span,
.receipt-row p,
.panel-label span,
.total-stack span,
.task-row p,
.ops-card p,
.badge,
.metric-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 410;
}

.hero-metrics strong {
  display: block;
  margin-top: 3px;
  font-size: 19px;
  font-weight: 460;
  line-height: 1.05;
}

.commerce-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.42fr);
  gap: 8px;
  align-items: start;
}

.merchant-layout {
  display: grid;
  grid-template-columns: 1fr;
}

.catalog-panel,
.checkout-panel,
.ops-shell {
  padding: 8px;
  box-shadow: var(--shadow);
}

.catalog-panel {
  background: linear-gradient(180deg, #fff 0%, #f3f8f5 100%);
}

.checkout-panel {
  background: linear-gradient(180deg, #fff 0%, #f8f6f1 100%);
}

.ops-shell {
  background: linear-gradient(180deg, #fff 0%, #f3f7fa 100%);
}

.section-title,
.phone-head,
.panel-label,
.total-stack div,
.receipt-row,
.task-row,
.sku-price {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-title {
  margin-bottom: 7px;
  padding: 1px 1px 7px;
  border-bottom: 1px solid var(--line);
}

.section-title h2 {
  font-size: 17px;
  line-height: 1.1;
}

.section-title > span,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 0 7px;
  color: var(--mint);
  white-space: nowrap;
}

.phone-head {
  margin-bottom: 7px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 7px 8px;
}

.phone-head span {
  display: block;
  color: rgba(255, 255, 255, 0.66);
}

.phone-head strong {
  display: block;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.phone-head button {
  width: 34px;
  padding: 0;
  color: var(--mint);
}

.visual-card {
  position: relative;
  overflow: hidden;
  margin-bottom: 7px;
  border-radius: 8px;
  background: var(--mint-soft);
}

.visual-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 4.6;
  object-fit: cover;
}

.visual-card div {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  border-radius: 8px;
  background: rgba(20, 25, 35, 0.82);
  color: #fff;
  padding: 7px 9px;
}

.visual-card span {
  display: block;
  color: rgba(255, 255, 255, 0.72);
}

.visual-card strong {
  display: block;
  margin-top: 3px;
  font-size: 14px;
}

.search-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px;
  margin-bottom: 7px;
}

.search-bar span {
  display: flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 380;
}

.search-bar button,
.pay-action,
.sku-price button {
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 460;
}

.search-bar button {
  min-width: 58px;
}

.chip-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 7px;
}

.chip-row button,
.segmented button,
.payment-stack button {
  min-width: 0;
  padding: 0 6px;
  font-size: 11px;
}

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

.sku-card {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  overflow: hidden;
}

.sku-card img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 88px;
  object-fit: cover;
}

.sku-body {
  display: grid;
  align-content: space-between;
  min-width: 0;
  gap: 3px;
  padding: 5px;
}

.sku-body h3 {
  display: -webkit-box;
  overflow: hidden;
  min-height: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 11px;
  font-weight: 460;
  line-height: 1.14;
}

.sku-meta {
  display: flex;
  justify-content: space-between;
  min-width: 0;
  gap: 4px;
}

.sku-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sku-price strong {
  color: var(--red);
  font-size: 13px;
  font-weight: 460;
  line-height: 1;
}

.sku-price button {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  font-size: 16px;
}

.sku-body .badge {
  justify-self: start;
  max-width: 100%;
  min-height: 22px;
  overflow: hidden;
  padding: 0 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receipt {
  display: grid;
  gap: 6px;
  min-height: 108px;
}

.receipt-row {
  padding: 7px;
}

.receipt-row h3,
.task-row h3 {
  margin-bottom: 2px;
  font-size: 12px;
}

.receipt-row p,
.task-row p {
  margin-bottom: 0;
}

.qty {
  display: grid;
  grid-template-columns: 28px 28px 28px;
  align-items: center;
  text-align: center;
  font-weight: 460;
}

.qty button {
  min-height: 26px;
  padding: 0;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 96px;
  border: 1px dashed #b8c5c8;
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  padding: 10px;
  text-align: center;
  font-size: 13px;
  line-height: 1.45;
}

.option-panel,
.total-stack {
  margin-top: 7px;
  padding: 8px;
}

.panel-label {
  margin-bottom: 6px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.total-stack {
  display: grid;
  gap: 6px;
}

.total-stack .grand {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  font-size: 17px;
  font-weight: 460;
}

.pay-action {
  width: 100%;
  min-height: 40px;
  margin-top: 8px;
  background: var(--mint);
  box-shadow: 0 12px 24px rgba(23, 107, 80, 0.2);
}

.merchant-context {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 7px;
}

.module-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 7px;
}

.module-strip button {
  min-width: 0;
  padding: 0 6px;
  font-size: 11px;
}

.state-track {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 7px;
}

.state-track button {
  min-width: 0;
  padding: 0 6px;
  font-size: 11px;
}

.ops-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 7px;
}

.ops-card {
  padding: 8px;
}

.ops-card h3 {
  font-size: 14px;
}

.ops-card p {
  margin: 4px 0 0;
  line-height: 1.38;
}

.task-list {
  display: grid;
  gap: 6px;
  margin-top: 7px;
}

.task-row {
  min-height: 50px;
  padding: 7px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 8px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 460;
  white-space: nowrap;
}

.pill.good {
  background: var(--mint-soft);
  color: var(--mint-dark);
}

.pill.warn {
  background: var(--gold-soft);
  color: var(--gold);
}

.pill.info {
  background: var(--blue-soft);
  color: var(--blue);
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 7px;
}

.metric-row article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 7px;
}

.metric-row strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
  font-weight: 460;
}

.progress {
  width: 118px;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ebee;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--mint);
}

@media (max-width: 1100px) {
  .page-hero,
  .scan-gate,
  .commerce-layout,
  .ops-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 14px, 1360px);
    padding-top: 7px;
  }

  .topbar,
  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-metrics,
  .metric-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .payment-stack,
  .qr-ticket {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .segmented {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .chip-row,
  .module-strip,
  .state-track {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .sku-card {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .sku-card img {
    min-height: 92px;
    aspect-ratio: auto;
  }

  .sku-body {
    padding: 4px;
  }

  .sku-body h3 {
    font-size: 10px;
  }

  .sku-meta,
  .badge {
    font-size: 9px;
  }

  .sku-price strong {
    font-size: 12px;
  }

  .sku-price button {
    width: 24px;
    height: 24px;
    font-size: 15px;
  }

  .scan-action {
    width: 100%;
  }
}
