:root {
  --bg: #dfe4eb;
  --surface: #ffffff;
  --surface-2: #f4f6f8;
  --surface-3: #eef1f5;
  --text: #131722;
  --muted: #677184;
  --border: #d8dde5;
  --accent: #ff6b3d;
  --accent-2: #ff9e80;
  --success: #138f4f;
  --danger: #cf2f2f;
  --shadow: 0 12px 36px rgba(13, 22, 38, 0.12);
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  min-height: 100vh;
  background: radial-gradient(circle at top right, #ecf0f6 0%, #dbe1ea 44%, #cfd7e3 100%);
}

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

.app-shell {
  margin: var(--space-7);
  background: var(--surface);
  border-radius: 30px;
  border: 1px solid rgba(19, 23, 34, 0.08);
  display: grid;
  grid-template-columns: 72px 1fr 360px;
  min-height: calc(100vh - 2 * var(--space-7));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.nav-rail {
  border-right: 1px solid var(--border);
  padding: var(--space-6) var(--space-3);
  display: grid;
  grid-template-rows: auto repeat(4, auto) 1fr;
  justify-items: center;
  gap: var(--space-4);
  background: linear-gradient(180deg, #fff 0%, #f9fbfc 100%);
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--accent);
  border: 1px solid #ffd7c8;
  font-size: 20px;
  margin-bottom: var(--space-2);
}

.rail-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: #8690a3;
  font-size: 18px;
  cursor: pointer;
}

.rail-btn:hover,
.rail-btn:focus-visible {
  border-color: #ffd7c8;
  color: var(--accent);
  outline: none;
}

.rail-btn.is-active {
  border-color: #ffcfbb;
  background: #ffefe8;
  color: var(--accent);
}

.workspace {
  border-right: 1px solid var(--border);
  display: grid;
  grid-template-rows: 76px 1fr;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border);
  gap: var(--space-5);
}

.search-wrap {
  width: min(520px, 100%);
  position: relative;
}

.search-wrap input {
  width: 100%;
  height: 48px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  font-size: 16px;
  padding: 0 44px 0 var(--space-4);
}

.search-wrap input:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible,
.product-card:focus-visible {
  outline: 3px solid rgba(255, 107, 61, 0.3);
  outline-offset: 1px;
}

.search-icon {
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.session {
  text-align: right;
}

.session-title {
  margin: 0;
  font-weight: 800;
  font-size: 20px;
  font-family: "Fraunces", serif;
}

.session-meta {
  margin: var(--space-1) 0 0;
  color: var(--muted);
}

.content {
  padding: var(--space-5) var(--space-6) var(--space-6);
  background:
    linear-gradient(transparent 96%, rgba(19, 23, 34, 0.03) 96%, transparent 100%),
    linear-gradient(90deg, transparent 96%, rgba(19, 23, 34, 0.03) 96%, transparent 100%),
    var(--surface-2);
  background-size: 24px 24px;
  overflow-y: auto;
}

.context-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.context-chip {
  height: 40px;
  padding: 0 var(--space-4);
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  font-weight: 700;
}

.context-chip.muted {
  color: #406b50;
  background: #ecfff3;
  border-color: #bde1cc;
}

.outline-btn,
.primary-btn,
.text-btn,
.pay-btn {
  border-radius: var(--radius-sm);
  height: 44px;
  border: 1px solid transparent;
  padding: 0 var(--space-4);
  font-weight: 700;
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
}

.outline-btn {
  border-color: var(--border);
  background: #fff;
  color: var(--text);
}

.outline-btn:hover {
  border-color: #ffcfbb;
  color: var(--accent);
}

.primary-btn {
  background: linear-gradient(180deg, #ff7b52 0%, #ff6434 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(255, 107, 61, 0.3);
}

.primary-btn:hover {
  filter: brightness(0.95);
}

.primary-btn:disabled {
  background: #c8ced8;
  box-shadow: none;
  cursor: not-allowed;
}

.text-btn {
  background: transparent;
  color: var(--muted);
}

.text-btn:hover {
  background: #fff;
  color: var(--text);
}

.category-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.category-card {
  min-width: 130px;
  min-height: 92px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius-md);
  padding: var(--space-3);
  text-align: left;
  display: grid;
  gap: var(--space-2);
  font-weight: 700;
  cursor: pointer;
}

.category-card small {
  color: var(--muted);
  font-weight: 600;
}

.category-card.is-active {
  border-color: #ffbcaa;
  background: #fff3ee;
  color: #b53e1a;
}

.menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}

.menu-header h1 {
  margin: 0;
  font-size: 28px;
  font-family: "Fraunces", serif;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}

.product-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  display: grid;
  grid-template-rows: 148px 1fr;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(20, 25, 37, 0.12);
}

.product-media {
  background: linear-gradient(145deg, #f9fbff, #e6ecf4);
  font-size: 56px;
  display: grid;
  place-items: center;
}

.product-body {
  padding: var(--space-4);
}

.product-body h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  font-family: "Fraunces", serif;
}

.product-body p {
  margin: var(--space-2) 0 0;
  color: var(--muted);
  font-size: 14px;
}

.product-body .price {
  margin-top: var(--space-3);
  font-size: 20px;
  color: var(--text);
  font-weight: 800;
}

.app-shell[data-menu-state="locked"] .product-card {
  opacity: 0.45;
  pointer-events: none;
}

.cart-panel {
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  gap: var(--space-4);
  padding: var(--space-6);
}

.cart-header h2 {
  margin: 0;
  font-size: 28px;
  font-family: "Fraunces", serif;
}

.cart-header p {
  margin: var(--space-2) 0 0;
  color: var(--muted);
  font-weight: 700;
}

.cart-items {
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: var(--space-3);
  min-height: 120px;
}

.empty-state {
  color: var(--muted);
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
}

.cart-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: var(--space-3);
  display: grid;
  gap: var(--space-2);
}

.cart-item .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
}

.cart-item .item-name {
  font-weight: 800;
}

.cart-item .item-meta {
  color: var(--muted);
  font-size: 13px;
}

.cart-item .qty-controls {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.qty-controls button {
  width: 28px;
  height: 28px;
  border: 0;
  background: #f5f6f9;
  cursor: pointer;
  font-weight: 800;
}

.qty-controls button:hover {
  background: #ffdccc;
}

.qty-controls span {
  width: 30px;
  text-align: center;
  font-weight: 700;
}

.cart-totals {
  border-top: 1px dashed var(--border);
  padding-top: var(--space-3);
  display: grid;
  gap: var(--space-2);
}

.cart-totals div {
  display: flex;
  justify-content: space-between;
}

.cart-totals .grand {
  margin-top: var(--space-2);
  font-size: 20px;
  font-weight: 800;
}

.payment-methods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.pay-btn {
  border-color: var(--border);
  background: #fff;
}

.pay-btn.is-active {
  border-color: #ffbcaa;
  background: #fff2ec;
  color: #b83f1a;
}

.modal {
  border: 0;
  border-radius: var(--radius-lg);
  padding: 0;
  width: min(560px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(17, 23, 34, 0.45);
  backdrop-filter: blur(2px);
}

.modal-content {
  padding: var(--space-6);
  display: grid;
  gap: var(--space-4);
  background: #fff;
}

.modal-content h3 {
  margin: 0;
  font-size: 30px;
  font-family: "Fraunces", serif;
}

.modal-content p {
  margin: var(--space-1) 0 0;
  color: var(--muted);
}

.order-type-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

.order-type-card {
  border: 1px solid var(--border);
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: var(--space-4);
  text-align: left;
  display: grid;
  gap: var(--space-2);
  min-height: 120px;
  cursor: pointer;
}

.order-type-card:hover,
.order-type-card:focus-visible {
  border-color: #ffbcaa;
  background: #fff4ee;
}

.table-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}

.table-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  height: 88px;
  background: #fff;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}

.table-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: var(--space-1);
}

.table-card[data-status="occupied"],
.table-card[data-status="cleaning"] {
  opacity: 0.45;
  pointer-events: none;
}

.table-card.is-selected {
  border-color: #ffbcaa;
  background: #fff2ec;
  color: #b63f1b;
}

.field {
  display: grid;
  gap: var(--space-2);
}

.field span {
  font-weight: 700;
}

.field input,
.field textarea,
.field select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}

.field textarea {
  min-height: 84px;
  resize: vertical;
}

#modifier-dynamic-fields {
  display: grid;
  gap: var(--space-3);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(24px);
  opacity: 0;
  background: #121926;
  color: #fff;
  padding: 10px 14px;
  border-radius: 999px;
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 1320px) {
  .app-shell {
    margin: var(--space-4);
    min-height: calc(100vh - 2 * var(--space-4));
    grid-template-columns: 72px 1fr 320px;
  }

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

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 1fr;
    margin: 0;
    min-height: 100vh;
    border-radius: 0;
  }

  .nav-rail {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    grid-template-rows: auto;
    grid-template-columns: auto repeat(4, auto);
    justify-content: start;
    padding: var(--space-3);
  }

  .workspace {
    border-right: 0;
    grid-template-rows: auto 1fr;
  }

  .topbar {
    padding: var(--space-3);
    flex-direction: column;
    align-items: stretch;
  }

  .session {
    text-align: left;
  }

  .cart-panel {
    border-top: 1px solid var(--border);
  }

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

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
