:root {
  --ink: #17201b;
  --muted: #627069;
  --line: #dbe4de;
  --paper: #fbfcf7;
  --panel: #ffffff;
  --accent: #0c8f6d;
  --accent-dark: #08644f;
  --warm: #f7c44a;
  --rose: #df6b57;
  --shadow: 0 18px 50px rgba(23, 32, 27, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  padding-bottom: 96px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(16px, 4vw, 32px);
  background: rgba(251, 252, 247, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  font-size: 22px;
}

.top-actions,
.checkout-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button,
.lang-toggle {
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
}

main {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px;
}

.service-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.service-option {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  padding: 12px;
}

.service-option span {
  display: block;
  font-weight: 900;
}

.service-option small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.service-option.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(12, 143, 109, 0.12);
}

.notice {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid rgba(247, 196, 74, 0.5);
  border-radius: 8px;
  background: #fff8df;
  color: #5b4512;
  font-size: 14px;
}

.category-tabs {
  position: sticky;
  top: 73px;
  z-index: 10;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0;
  background: var(--paper);
}

.category-tabs button {
  flex: 0 0 auto;
  min-width: 92px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  padding: 10px 14px;
  font-weight: 800;
  color: var(--muted);
}

.category-tabs button.active {
  color: white;
  background: var(--ink);
  border-color: var(--ink);
}

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

.menu-item {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  position: relative;
  min-height: 138px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.menu-item img {
  width: 116px;
  height: 116px;
  object-fit: cover;
  border-radius: 8px;
  background: #e7efe9;
}

.menu-copy {
  min-width: 0;
  padding-right: 2px;
}

.menu-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.menu-title-row h3 {
  font-size: 16px;
  line-height: 1.22;
}

.menu-title-row strong {
  white-space: nowrap;
  color: var(--accent-dark);
}

.menu-copy p {
  margin-top: 6px;
  min-height: 38px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.choice-row button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f6f8f5;
  padding: 6px 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.choice-row button.active {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: #eaf7f2;
}

.add-button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  min-width: 64px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  padding: 8px 12px;
  font-weight: 900;
}

.cart-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(251, 252, 247, 0.9);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.cart-button {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 12px;
  width: min(980px, 100%);
  min-height: 56px;
  margin: 0 auto;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  padding: 10px 14px;
}

#cartCount {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--warm);
  color: var(--ink);
  font-weight: 900;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: none;
  background: rgba(23, 32, 27, 0.42);
}

.overlay.show {
  display: block;
}

.cart-sheet {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: min(430px, 100vw);
  padding: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  transform: translateX(105%);
  transition: transform 180ms ease;
}

.cart-sheet.open {
  transform: translateX(0);
}

.sheet-header,
.dialog-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.cart-items {
  flex: 1;
  overflow: auto;
  padding: 16px 0;
}

.empty-cart {
  color: var(--muted);
  padding: 28px 0;
  text-align: center;
}

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

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

.qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-control button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9f6;
  font-weight: 900;
}

.checkout-form {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  color: var(--ink);
  background: #fbfcfa;
  resize: vertical;
}

.totals {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.totals div {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}

.totals .grand {
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
}

.primary-action,
.secondary-action {
  flex: 1;
  min-height: 48px;
  border-radius: 8px;
  font-weight: 900;
}

.primary-action {
  border: 0;
  background: #22a867;
  color: white;
}

.secondary-action {
  border: 1px solid var(--line);
  background: #f7f9f6;
  color: var(--ink);
}

.hidden {
  display: none !important;
}

dialog {
  width: min(680px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(23, 32, 27, 0.42);
}

.qr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.qr-card {
  display: grid;
  gap: 8px;
  justify-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}

.qr-box {
  display: grid;
  place-items: center;
  width: 188px;
  height: 188px;
  border: 1px solid var(--line);
  background: white;
}

.qr-box img {
  width: 174px;
  height: 174px;
}

.qr-card span {
  color: var(--muted);
  font-size: 13px;
}

.history-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  max-height: 60vh;
  overflow: auto;
}

.history-notice {
  padding: 10px 12px;
  border: 1px solid rgba(247, 196, 74, 0.5);
  border-radius: 8px;
  background: #fff8df;
  color: #5b4512;
  font-size: 13px;
  font-weight: 800;
}

.history-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.history-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.history-top span {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-dark);
}

.history-total {
  margin-top: 8px;
  font-size: 18px;
  font-weight: 900;
}

@media (max-width: 760px) {
  .menu-list {
    grid-template-columns: 1fr;
  }

  .category-tabs {
    top: 70px;
  }
}

@media (max-width: 520px) {
  .topbar {
    padding: 14px 12px;
  }

  h1 {
    font-size: 19px;
  }

  main {
    padding: 12px;
  }

  .notice {
    align-items: flex-start;
    flex-direction: column;
  }

  .menu-item {
    grid-template-columns: 104px minmax(0, 1fr);
    min-height: 132px;
  }

  .menu-item img {
    width: 104px;
    height: 104px;
  }

  .menu-copy p {
    min-height: 34px;
    font-size: 12px;
  }

  .add-button {
    min-width: 56px;
    padding: 7px 10px;
  }

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

  .checkout-actions {
    flex-direction: column;
  }

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