:root {
  color-scheme: light;
  --page: #f2f4f2;
  --surface: #ffffff;
  --surface-muted: #f8f9f7;
  --ink: #181b19;
  --ink-soft: #343a36;
  --muted: #69716c;
  --line: #dce1dc;
  --line-strong: #bcc6bf;
  --brand: #116c5c;
  --brand-strong: #0a574a;
  --brand-soft: #e7f3f0;
  --amber: #8a5a08;
  --amber-soft: #fff4d9;
  --red: #a62b24;
  --red-soft: #fff0ed;
  --blue: #285f8f;
  --blue-soft: #eaf2f9;
  --shadow: 0 18px 50px rgba(25, 38, 30, 0.14);
  --radius: 8px;
  --topbar-height: 64px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
select {
  cursor: pointer;
}

button:disabled,
select:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(17, 108, 92, 0.25);
  outline-offset: 2px;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 8px;
  left: 8px;
  transform: translateY(-150%);
  border-radius: 4px;
  padding: 8px 12px;
  background: var(--ink);
  color: #fff;
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  position: sticky;
  z-index: 40;
  top: 0;
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding: 8px max(18px, env(safe-area-inset-left));
  background: rgba(255, 255, 255, 0.96);
}

.brand-link,
.brand-lockup {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  width: 82px;
  height: 38px;
  object-fit: contain;
}

.brand-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.brand-name {
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.15;
}

.brand-context {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.topbar-actions,
.status-cluster,
.section-actions,
.cart-summary,
.dialog-actions,
.scanner-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.button,
.primary-button,
.secondary-button,
.quiet-button,
.danger-button,
.icon-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 15px;
  font-weight: 750;
  line-height: 1.2;
  text-decoration: none;
}

.primary-button {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.primary-button:hover:not(:disabled) {
  border-color: var(--brand-strong);
  background: var(--brand-strong);
}

.secondary-button {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.secondary-button:hover:not(:disabled),
.quiet-button:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  background: var(--surface-muted);
}

.quiet-button {
  border-color: transparent;
  background: transparent;
  color: var(--brand-strong);
}

.danger-button {
  border-color: #e9bbb5;
  background: var(--red-soft);
  color: var(--red);
}

.icon-button {
  width: 40px;
  min-width: 40px;
  padding: 0;
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 24px;
  font-weight: 500;
}

.primary-button.full,
.secondary-button.full {
  width: 100%;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.section-heading h1,
.section-heading h2 {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.2;
}

.section-heading p {
  margin-top: 5px;
  color: var(--muted);
}

.segmented-control {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(88px, 1fr);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
}

.segment-button {
  min-height: 40px;
  border: 0;
  border-right: 1px solid var(--line-strong);
  padding: 0 16px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

.segment-button:last-child {
  border-right: 0;
}

.segment-button[aria-pressed="true"] {
  background: var(--ink);
  color: #fff;
}

.state-badge,
.status-badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 3px 9px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.status-badge::before {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--line-strong);
  content: "";
}

.status-badge[data-state="online"] {
  border-color: #a9d5ca;
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.status-badge[data-state="online"]::before {
  background: var(--brand);
}

.status-badge[data-state="warning"] {
  border-color: #efd38d;
  background: var(--amber-soft);
  color: var(--amber);
}

.status-badge[data-state="warning"]::before {
  background: #c88714;
}

.status-badge[data-state="error"] {
  border-color: #e9bbb5;
  background: var(--red-soft);
  color: var(--red);
}

.status-badge[data-state="error"]::before {
  background: var(--red);
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  padding: 12px 14px;
  background: var(--blue-soft);
  color: #244b69;
}

.notice.warning {
  border-color: #efd38d;
  border-left-color: #c88714;
  background: var(--amber-soft);
  color: var(--amber);
}

.notice.error {
  border-color: #e9bbb5;
  border-left-color: var(--red);
  background: var(--red-soft);
  color: var(--red);
}

.notice strong {
  display: block;
  margin-bottom: 2px;
  color: inherit;
}

.field {
  display: grid;
  gap: 7px;
}

.field label,
.field-label {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 750;
}

.field input,
.field select,
.scanner-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 12px;
  outline: none;
  background: var(--surface);
  color: var(--ink);
}

.field input:focus,
.field select:focus,
.scanner-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(17, 108, 92, 0.13);
}

.field-help,
.muted-copy,
.meta-copy {
  color: var(--muted);
  font-size: 12px;
}

.form-message {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}

.form-message.error {
  color: var(--red);
}

.empty-state,
.loading-state,
.error-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 28px;
  text-align: center;
}

.empty-state strong,
.error-state strong {
  font-size: 16px;
}

.empty-state p,
.loading-state p,
.error-state p {
  max-width: 380px;
  color: var(--muted);
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

.product-grid > .empty-state,
.product-grid > .loading-state,
.product-grid > .error-state {
  grid-column: 1 / -1;
}

.product-card {
  display: grid;
  min-width: 0;
  min-height: 154px;
  grid-template-columns: 112px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.product-card.is-sold-out {
  background: var(--surface-muted);
}

.product-media {
  position: relative;
  width: 112px;
  min-height: 100%;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: #e6ebe7;
}

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 152px;
  place-items: center;
  background: #e4e9e5;
  color: #58615b;
  font-size: 24px;
  font-weight: 850;
}

.product-card-body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
  padding: 13px;
}

.product-title {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.3;
}

/* 酒头编号：与门店酒单板一致，放在酒名最前面。 */
.product-tap-no {
  display: inline-block;
  min-width: 20px;
  margin-right: 7px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--brand, #b17920);
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
  vertical-align: 2px;
}

.product-note {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-meta {
  display: flex;
  min-height: 20px;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  color: var(--muted);
  font-size: 12px;
}

.product-footer {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.price {
  color: var(--ink);
  font-size: 17px;
  font-weight: 850;
  white-space: nowrap;
}

.price-prefix {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.product-select {
  width: min(100%, 145px);
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 0 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
}

.add-button {
  min-width: 72px;
  min-height: 36px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  padding: 0 12px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.add-button:hover:not(:disabled) {
  background: var(--brand-strong);
}

.cart-panel,
.tool-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.cart-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.cart-head,
.tool-panel-head {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
}

.cart-head h2,
.tool-panel-head h2 {
  font-size: 17px;
  line-height: 1.2;
}

.cart-list {
  min-height: 0;
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 16px;
}

.cart-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

.cart-line:last-child {
  border-bottom: 0;
}

.cart-line-title {
  overflow-wrap: anywhere;
  font-weight: 780;
}

.cart-line-variant {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.cart-line-price {
  align-self: start;
  font-weight: 800;
  white-space: nowrap;
}

.quantity-stepper {
  display: inline-grid;
  width: 112px;
  height: 36px;
  grid-template-columns: 36px 40px 36px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
}

.quantity-stepper button,
.quantity-stepper output {
  display: grid;
  min-width: 0;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
}

.quantity-stepper button:first-child {
  border-right: 1px solid var(--line);
}

.quantity-stepper button:last-child {
  border-left: 1px solid var(--line);
}

.quantity-stepper button:hover:not(:disabled) {
  background: var(--surface-muted);
}

.cart-foot {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 15px 16px 16px;
}

.cart-summary {
  justify-content: space-between;
}

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

.cart-total {
  font-size: 21px;
  font-weight: 850;
}

.cart-note {
  border: 1px solid #efd38d;
  border-radius: 6px;
  padding: 10px 11px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12px;
}

.cart-empty {
  display: grid;
  min-height: 170px;
  place-items: center;
  align-content: center;
  gap: 5px;
  color: var(--muted);
  text-align: center;
}

.cart-empty strong {
  color: var(--ink-soft);
}

.cart-backdrop {
  display: none;
}

.mobile-cart-toggle {
  display: none;
}

dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: min(760px, calc(100dvh - 32px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(20, 25, 22, 0.48);
}

.dialog-head {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 12px 18px;
}

.dialog-head h2 {
  overflow-wrap: anywhere;
  font-size: 19px;
}

.dialog-body {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.dialog-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 14px 18px 18px;
}

.dialog-foot .primary-button {
  min-width: 150px;
}

.variant-options {
  display: grid;
  gap: 9px;
}

.variant-option {
  display: grid;
  min-height: 52px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.variant-option[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.variant-option-name {
  font-weight: 780;
}

.variant-option-price {
  font-weight: 850;
}

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

.toast {
  position: fixed;
  z-index: 120;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  max-width: min(420px, calc(100vw - 32px));
  transform: translate(-50%, 18px);
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--ink);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

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

/* Order */

.order-shell {
  display: grid;
  width: min(1240px, 100%);
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
  gap: 20px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.catalog-area {
  display: grid;
  min-width: 0;
  gap: 20px;
}

.order-context {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.store-control {
  display: grid;
  gap: 8px;
}

.menu-meta {
  min-height: 20px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.order-page .cart-panel {
  position: sticky;
  top: calc(var(--topbar-height) + 20px);
  height: calc(100dvh - var(--topbar-height) - 40px);
  min-height: 480px;
  max-height: 760px;
}

.cart-mobile-close {
  display: none;
}

/* Terminal */

.terminal-page {
  overflow: hidden;
}

.terminal-topbar {
  position: relative;
}

.terminal-shell {
  display: grid;
  height: calc(100vh - var(--topbar-height));
  height: calc(100dvh - var(--topbar-height));
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.78fr);
  gap: 14px;
  padding: 14px;
}

.terminal-menu-pane {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border-right: 1px solid var(--line);
  padding: 4px 14px 20px 4px;
}

.terminal-menu-pane .section-heading {
  position: sticky;
  z-index: 4;
  top: -4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0 14px;
  background: var(--page);
}

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

.terminal-menu-pane .product-card {
  min-height: 142px;
  grid-template-columns: 94px minmax(0, 1fr);
}

.terminal-menu-pane .product-media {
  width: 94px;
}

.terminal-menu-pane .product-placeholder {
  min-height: 140px;
  font-size: 20px;
}

.terminal-side {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.scanner-panel {
  overflow: hidden;
}

.scanner-body {
  display: grid;
  gap: 10px;
  padding: 14px 16px 16px;
}

.scanner-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.scanner-input {
  min-width: 0;
  font-size: 16px;
}

.scan-result {
  display: grid;
  min-height: 76px;
  align-content: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--surface-muted);
}

.scan-result[data-state="resolved"] {
  border-color: #a9d5ca;
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.scan-result[data-state="warning"] {
  border-color: #efd38d;
  background: var(--amber-soft);
  color: var(--amber);
}

.scan-result[data-state="error"] {
  border-color: #e9bbb5;
  background: var(--red-soft);
  color: var(--red);
}

.scan-result strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.scan-result span {
  overflow-wrap: anywhere;
  color: inherit;
  font-size: 12px;
}

.identity-context {
  display: grid;
  min-height: 58px;
  grid-template-columns: 38px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  border: 1px solid #a9d5ca;
  border-radius: 6px;
  padding: 9px 10px;
  background: var(--brand-soft);
}

.identity-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
}

.identity-copy {
  min-width: 0;
}

.identity-copy strong,
.identity-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-copy span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.identity-context .quiet-button {
  min-width: 52px;
  padding-inline: 8px;
}

.terminal-cart {
  min-height: 0;
  overflow: hidden;
}

.terminal-cart .cart-list {
  padding: 0 14px;
}

.terminal-cart .cart-foot {
  padding: 12px 14px 14px;
}

.payment-state {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.payment-state strong {
  display: block;
  color: var(--amber);
}

.payment-state span {
  color: var(--muted);
  font-size: 12px;
}

.payment-state .state-badge {
  border-color: #efd38d;
  background: var(--amber-soft);
  color: var(--amber);
}

.payment-state[data-state="ready"] .state-badge,
.payment-state[data-state="success"] .state-badge {
  border-color: #a9d5ca;
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.payment-state[data-state="ready"] strong,
.payment-state[data-state="success"] strong {
  color: var(--brand-strong);
}

.payment-state[data-state="error"] .state-badge {
  border-color: #e9bbb5;
  background: var(--red-soft);
  color: var(--red);
}

.payment-state[data-state="error"] strong {
  color: var(--red);
}

.anomaly-handoff {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e9bbb5;
  border-radius: var(--radius-md);
  background: var(--red-soft);
}

.anomaly-handoff[hidden] {
  display: none;
}

.anomaly-handoff-head,
.anomaly-handoff-head > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.anomaly-handoff-head {
  justify-content: space-between;
}

.anomaly-handoff-head > div {
  min-width: 0;
  align-items: baseline;
  flex-wrap: wrap;
}

.anomaly-handoff-head span,
.anomaly-handoff p {
  color: var(--muted);
}

.anomaly-handoff p {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
}

.anomaly-handoff-link {
  justify-self: start;
  text-decoration: none;
}

.anomaly-handoff-confirm {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-weight: 600;
  cursor: pointer;
}

.anomaly-handoff-confirm input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--brand-strong);
}

.device-dialog {
  width: min(560px, calc(100vw - 32px));
}

.device-key-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.device-key-row .quiet-button {
  min-width: 64px;
  border-color: var(--line-strong);
}

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

.summary-field {
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.summary-field span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.summary-field strong {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

@media (max-width: 1080px) {
  .order-shell {
    grid-template-columns: minmax(0, 1fr) 330px;
  }

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

  .terminal-shell {
    grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
  }

  .terminal-menu-pane .product-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 800px) {
  :root {
    --topbar-height: 58px;
  }

  .topbar {
    gap: 10px;
    padding: 7px 12px;
  }

  .brand-logo {
    width: 68px;
    height: 34px;
  }

  .brand-name {
    font-size: 14px;
  }

  .topbar-actions {
    gap: 6px;
  }

  .order-shell {
    display: block;
    padding: 18px 14px 96px;
  }

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

  .menu-meta {
    text-align: left;
  }

  .section-heading {
    align-items: flex-start;
  }

  .section-heading h1,
  .section-heading h2 {
    font-size: 20px;
  }

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

  .product-card {
    min-height: 138px;
    grid-template-columns: 94px minmax(0, 1fr);
  }

  .product-media {
    width: 94px;
  }

  .product-placeholder {
    min-height: 136px;
    font-size: 20px;
  }

  .order-page .cart-panel {
    position: fixed;
    z-index: 80;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: min(82dvh, 720px);
    min-height: 0;
    max-height: none;
    transform: translateY(104%);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    transition: transform 180ms ease;
  }

  .order-page.cart-open {
    overflow: hidden;
  }

  .order-page.cart-open .cart-panel {
    transform: translateY(0);
  }

  .cart-mobile-close {
    display: inline-flex;
  }

  .cart-backdrop {
    position: fixed;
    z-index: 70;
    inset: 0;
    display: block;
    border: 0;
    background: rgba(20, 25, 22, 0.48);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  .order-page.cart-open .cart-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-cart-toggle {
    position: fixed;
    z-index: 60;
    right: 14px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 14px;
    display: flex;
    min-height: 54px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--brand-strong);
    border-radius: 7px;
    padding: 0 18px;
    background: var(--brand-strong);
    color: #fff;
    box-shadow: 0 10px 30px rgba(10, 87, 74, 0.24);
    font-weight: 800;
  }

  .mobile-cart-toggle:disabled {
    border-color: var(--line-strong);
    background: var(--ink-soft);
    opacity: 1;
  }

  .order-page .toast {
    bottom: calc(max(12px, env(safe-area-inset-bottom)) + 66px);
  }

  .terminal-page {
    overflow: auto;
  }

  .terminal-topbar {
    position: sticky;
  }

  .terminal-topbar .brand-context,
  .terminal-topbar .status-badge span {
    display: none;
  }

  .terminal-shell {
    display: grid;
    height: auto;
    min-height: calc(100dvh - var(--topbar-height));
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .terminal-menu-pane {
    overflow: visible;
    border-right: 0;
    padding: 0;
  }

  .terminal-menu-pane .section-heading {
    position: static;
  }

  .terminal-menu-pane .product-grid {
    grid-template-columns: 1fr;
  }

  .terminal-side {
    display: grid;
    grid-template-rows: auto auto;
  }

  .terminal-cart {
    min-height: 440px;
  }

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

@media (max-width: 480px) {
  .brand-copy {
    display: none;
  }

  .segmented-control {
    display: grid;
    width: 100%;
  }

  .segment-button {
    padding: 0 10px;
  }

  .product-card,
  .terminal-menu-pane .product-card {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .product-media,
  .terminal-menu-pane .product-media {
    width: 82px;
  }

  .product-card-body {
    padding: 11px;
  }

  .product-footer {
    align-items: flex-end;
  }

  .dialog-foot {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .dialog-foot .button,
  .dialog-foot .primary-button,
  .dialog-foot .secondary-button,
  .dialog-foot .danger-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
