:root {
  color-scheme: light;
  --background: #faf7f2;
  --surface: #ffffff;
  --surface-muted: #f3efe9;
  --text: #1a1410;
  --muted: #6b6157;
  --line: #e6dfd4;
  --line-strong: #d4cab9;
  --accent: #1a1410;
  --accent-soft: #2b2018;
  --error: #9f1d1d;
  --success: #166534;
  --warning: #92400e;

  --shadow-card: 0 1px 2px rgba(26, 20, 16, 0.04), 0 12px 32px -20px rgba(26, 20, 16, 0.18);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
}

body {
  background: var(--background);
  color: var(--text);
  font-family: ui-serif, "Iowan Old Style", "Apple Garamond", "Baskerville", Georgia, serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
}

button,
input {
  font: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.brand-name {
  font-size: 1.05rem;
}

.site-nav {
  display: flex;
  gap: 0.5rem;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.9rem;
}

.site-nav a {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
}

.site-nav a:hover,
.site-nav a:focus {
  background: var(--surface-muted);
  color: var(--text);
}

.site-main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.25rem 0 4rem;
}

.intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.intro-text {
  max-width: 640px;
}

.intro h1 {
  margin: 0 0 0.6rem;
  font-size: clamp(1.75rem, 2.4vw + 1rem, 2.65rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.intro p {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.table-banner {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.7rem 1.1rem;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.table-banner-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

.table-banner-table {
  font-size: 1.15rem;
  font-weight: 600;
}

.order-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 2rem;
  align-items: start;
}

.menu {
  display: grid;
  gap: 1.5rem;
}

.merchant {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.merchant-hero {
  position: relative;
  height: 200px;
  overflow: hidden;
}

.merchant-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.merchant-hero-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.1rem 1.25rem;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 30%,
    color-mix(in srgb, var(--brand) 75%, transparent) 100%
  );
  color: var(--brand-text, #fff);
}

.merchant-tag {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  margin-bottom: 0.5rem;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  backdrop-filter: blur(2px);
  width: max-content;
}

.merchant-hero-overlay h3 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.merchant-hero-overlay p {
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
  opacity: 0.92;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.item-list {
  display: grid;
  gap: 0;
  padding: 0.5rem 0.5rem 0.75rem;
}

.menu-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem 0.95rem;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  transition: background 120ms ease;
}

.menu-item:hover {
  background: var(--surface-muted);
}

.menu-item + .menu-item {
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.menu-item:hover + .menu-item,
.menu-item:has(input:focus) + .menu-item {
  border-top-color: transparent;
}

.menu-item-info strong,
.menu-item-info small {
  display: block;
}

.menu-item-info strong {
  font-size: 1.02rem;
  font-weight: 600;
}

.menu-item-info small {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.1rem;
}

.item-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.price {
  min-width: 3.75rem;
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.stepper {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  overflow: hidden;
}

.stepper-btn {
  width: 2.4rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 120ms ease;
}

.stepper-btn:hover,
.stepper-btn:focus-visible {
  background: var(--surface-muted);
}

.stepper-btn:active {
  background: var(--line);
}

.menu-item input[data-item-id] {
  width: 2.5rem;
  padding: 0.4rem 0;
  border: 0;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-radius: 0;
  text-align: center;
  font-variant-numeric: tabular-nums;
  background: transparent;
  -moz-appearance: textfield;
  pointer-events: none;
}

.menu-item input[data-item-id]::-webkit-outer-spin-button,
.menu-item input[data-item-id]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

@media (max-width: 520px) {
  .stepper-btn {
    width: 2.8rem;
    font-size: 1.35rem;
  }

  .menu-item input[data-item-id] {
    width: 2.75rem;
    font-size: 1.05rem;
  }
}

.sidebar {
  display: grid;
  gap: 1rem;
  position: sticky;
  top: 1rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
}

.checkout h2,
.demo-panel summary .demo-panel-title,
.feed h3 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.field {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.field span {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field input {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  font-family: inherit;
}

.field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

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

.summary ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.summary li,
.total {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-variant-numeric: tabular-nums;
}

.summary li {
  margin-bottom: 0.35rem;
  font-size: 0.96rem;
}

.empty-order {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.total {
  margin: 0.85rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  font-size: 1.05rem;
  font-weight: 600;
}

.primary-button {
  width: 100%;
  margin-top: 1rem;
  min-height: 3rem;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}

.primary-button:hover,
.primary-button:focus {
  background: var(--accent-soft);
}

.primary-button:active {
  transform: translateY(1px);
}

.primary-button:disabled {
  background: #b3aca2;
  cursor: wait;
}

.payment-result {
  margin-top: 1rem;
  font-size: 0.95rem;
}

.payment-result p {
  margin: 0.35rem 0;
}

.payment-result .error {
  color: var(--error);
}

.split-summary {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.split-summary h4 {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.split-summary dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.3rem 1rem;
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}

.split-summary dd {
  margin: 0;
}

.demo-panel {
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.demo-panel-header {
  margin-bottom: 1rem;
}

.demo-panel-title {
  margin: 0 0 0.2rem;
}

.demo-panel-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.table-selector {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.table-chip {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 0.2rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.table-chip:hover {
  border-color: var(--accent);
}

.table-chip.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.big-qr {
  margin-bottom: 1rem;
}

.big-qr-slot {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  display: grid;
  gap: 0.6rem;
}

.big-qr-slot[hidden] {
  display: none;
}

.big-qr-svg {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
}

.big-qr-svg svg {
  width: 100%;
  height: 100%;
  display: block;
}

.big-qr-caption {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.big-qr-caption strong {
  color: var(--text);
}

.secondary-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 1.25rem;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}

.secondary-link:hover {
  text-decoration: underline;
}

.feed {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.feed-note {
  margin: -0.25rem 0 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.feed-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
  max-height: 280px;
  overflow-y: auto;
}

.feed-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.feed-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 0.88rem;
  animation: feed-in 280ms ease-out;
}

@keyframes feed-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.feed-table {
  display: inline-grid;
  place-items: center;
  min-width: 2.2rem;
  height: 2.2rem;
  padding: 0 0.4rem;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
}

.feed-meta {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.feed-amount {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.feed-breakdown {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--surface-muted);
  color: var(--muted);
}

.status-paid,
.status-succeeded,
.status-completed {
  background: #dcfce7;
  color: var(--success);
}

.status-open,
.status-pending,
.status-requires_action,
.status-processing {
  background: #fef3c7;
  color: var(--warning);
}

.status-failed,
.status-canceled,
.status-cancelled {
  background: #fee2e2;
  color: var(--error);
}

.result-card {
  max-width: 540px;
  margin: 1rem auto;
}

.result-card h1 {
  margin: 0 0 1rem;
  font-size: 1.6rem;
}

.result-card code {
  background: var(--surface-muted);
  padding: 0.05rem 0.4rem;
  border-radius: 6px;
  font-size: 0.92em;
}

@media (max-width: 960px) {
  .order-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 720px) {
  .site-header {
    padding: 0.85rem 1rem;
  }

  .brand-name {
    display: none;
  }

  .merchant-hero {
    height: 160px;
  }

  .intro {
    margin-bottom: 1.25rem;
  }
}

@media (max-width: 520px) {
  .menu-item {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .item-controls {
    justify-content: space-between;
  }

  .price {
    text-align: left;
  }
}
