:root {
  color-scheme: dark;
  --ink: #fff8ee;
  --muted: #d4c6b5;
  --subtle: rgba(255, 248, 238, 0.68);
  --line: rgba(255, 248, 238, 0.16);
  --panel: rgba(18, 20, 18, 0.82);
  --panel-strong: rgba(11, 12, 11, 0.94);
  --gold: #d8b46a;
  --gold-strong: #efca78;
  --green: #19382f;
  --wine: #79343c;
  --paper: #fbf3e6;
  --paper-ink: #241b15;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.46);
  font-family:
    "Inter", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at 82% 16%, rgba(216, 180, 106, 0.2), transparent 28%),
    linear-gradient(90deg, rgba(7, 9, 8, 0.94), rgba(7, 9, 8, 0.5)),
    url("/assets/restaurant-bg.png") center / cover;
  background-attachment: scroll;
  color: var(--ink);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.shell {
  min-height: 100vh;
  padding: 22px;
}

.app-frame {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(460px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(18, 21, 19, 0.93), rgba(18, 21, 19, 0.78));
  box-shadow: var(--shadow);
}

.brand-kicker {
  color: var(--gold-strong);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.title {
  margin: 8px 0 8px;
  font-size: clamp(34px, 8vw, 64px);
  line-height: 0.98;
  font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
  font-weight: 500;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.field span {
  color: var(--subtle);
  font-size: 13px;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid rgba(255, 248, 238, 0.22);
  border-radius: 8px;
  padding: 12px 13px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  outline: none;
}

.select option {
  background: #171a17;
  color: var(--ink);
}

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

.input:focus,
.select:focus,
.textarea:focus {
  border-color: rgba(216, 180, 106, 0.82);
  box-shadow: 0 0 0 3px rgba(216, 180, 106, 0.13);
}

.file-input {
  padding: 10px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 5px;
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.segmented button,
.tabbar button {
  min-height: 40px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.segmented button.active,
.tabbar button.active {
  color: #16130e;
  background: var(--gold);
  font-weight: 700;
}

.primary,
.secondary,
.danger,
.ghost {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 16px;
  white-space: nowrap;
}

.primary {
  color: #17130e;
  background: linear-gradient(180deg, #edcf86, #cda154);
  font-weight: 800;
}

.secondary {
  color: var(--ink);
  border: 1px solid rgba(216, 180, 106, 0.45);
  background: rgba(216, 180, 106, 0.13);
}

.danger {
  color: #ffecef;
  background: rgba(121, 52, 60, 0.82);
}

.ghost {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.08);
}

.login-submit,
.form-submit {
  width: 100%;
  margin-top: 18px;
}

.header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: end;
  padding: 18px 0 20px;
}

.header h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
  font-size: clamp(36px, 6vw, 68px);
  line-height: 0.95;
  font-weight: 500;
}

.header p {
  margin: 8px 0 0;
  color: var(--muted);
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--subtle);
  background: rgba(0, 0, 0, 0.2);
  font-size: 13px;
}

.tabbar {
  display: flex;
  gap: 8px;
  padding: 7px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.24);
  overflow-x: auto;
}

.tabbar button {
  flex: 1;
  min-width: 92px;
  padding: 0 14px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(0, 0.94fr) minmax(0, 1.06fr);
}

.panel,
.order-card,
.dish-card,
.admin-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.2);
}

.panel {
  padding: 18px;
}

.panel h2,
.panel h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 12px;
}

.section-title.spaced {
  margin-top: 26px;
}

.section-title h2 {
  margin: 0;
  font-size: 19px;
}

.small {
  color: var(--subtle);
  font-size: 12px;
}

.menu-layout {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 16px;
}

.category-rail {
  position: sticky;
  top: 16px;
  align-self: start;
  display: grid;
  gap: 8px;
}

.category-btn {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--muted);
  text-align: left;
  background: rgba(0, 0, 0, 0.34);
}

.category-btn.active {
  color: var(--paper-ink);
  background: var(--paper);
  font-weight: 800;
}

.dish-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
  padding-bottom: 88px;
}

.dish-card {
  overflow: hidden;
  background: linear-gradient(180deg, rgba(25, 56, 47, 0.68), rgba(13, 14, 13, 0.88));
  contain: content;
}

.dish-image {
  aspect-ratio: 4 / 3;
  background:
    linear-gradient(135deg, rgba(216, 180, 106, 0.26), rgba(121, 52, 60, 0.18)),
    url("/assets/restaurant-bg.png") center / cover;
}

.dish-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dish-body {
  display: grid;
  gap: 9px;
  padding: 14px;
}

.dish-name {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.dish-name h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.price {
  color: var(--gold-strong);
  font-weight: 900;
  white-space: nowrap;
}

.dish-desc {
  min-height: 42px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}

.qty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stepper {
  display: inline-grid;
  grid-template-columns: 34px 38px 34px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.24);
}

.stepper button {
  width: 34px;
  height: 34px;
  color: var(--ink);
  background: transparent;
  font-size: 18px;
}

.stepper span {
  text-align: center;
  font-weight: 800;
}

.cart-bar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 28px));
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(216, 180, 106, 0.42);
  border-radius: 10px;
  background: rgba(12, 13, 12, 0.96);
  box-shadow: var(--shadow);
  z-index: 10;
}

.checkout {
  width: min(820px, 100%);
  margin: 0 auto;
}

.checkout-list,
.order-lines {
  display: grid;
  gap: 8px;
}

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

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

.order-card {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.order-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.status {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  color: #17130e;
  background: var(--paper);
  white-space: nowrap;
}

.status.pending {
  background: #edcf86;
}

.status.accepted {
  background: #9fd2bd;
}

.status.completed {
  background: #d9efdf;
}

.status.expired,
.status.cancelled {
  color: #ffecef;
  background: var(--wine);
}

.order-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.order-actions,
.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.order-footer,
.checkout-total {
  align-items: end;
}

.admin-list,
.admin-category-list,
.device-list {
  display: grid;
  gap: 12px;
}

.admin-category {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.admin-category-head {
  width: 100%;
  min-height: 50px;
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.07);
  text-align: left;
}

.admin-category-head span,
.admin-category-head em {
  color: var(--subtle);
  font-size: 12px;
  font-style: normal;
}

.admin-category-body {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.admin-card {
  padding: 14px;
  display: grid;
  gap: 10px;
}

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

.form-grid .wide {
  grid-column: 1 / -1;
}

.category-admin {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 9px 7px 12px;
  background: rgba(255, 255, 255, 0.08);
}

.chip button {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.1);
}

.thumb {
  width: 112px;
  height: 82px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.device-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  max-width: min(520px, calc(100% - 28px));
  padding: 12px 16px;
  border: 1px solid rgba(216, 180, 106, 0.48);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(12, 13, 12, 0.96);
  box-shadow: var(--shadow);
}

.loading {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  gap: 12px;
  align-content: center;
  color: var(--ink);
  background: rgba(7, 9, 8, 0.58);
}

.loading[hidden] {
  display: none;
}

.spinner {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(255, 248, 238, 0.22);
  border-top-color: var(--gold-strong);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

.loading-text {
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.34);
  color: var(--muted);
  font-size: 13px;
}

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

.empty {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 820px) {
  body {
    background:
      linear-gradient(90deg, rgba(7, 9, 8, 0.95), rgba(7, 9, 8, 0.7)),
      url("/assets/restaurant-bg.png") center top / auto 100vh no-repeat,
      #070908;
  }

  .shell {
    padding: 14px;
  }

  .login-panel {
    padding: 24px;
  }

  .header {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .header-actions {
    justify-content: start;
  }

  .grid.two,
  .menu-layout,
  .form-grid,
  .device-row {
    grid-template-columns: 1fr;
  }

  .category-rail {
    position: static;
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .category-btn {
    min-width: 112px;
    text-align: center;
  }

  .dish-list {
    grid-template-columns: 1fr;
  }

  .cart-bar {
    bottom: 10px;
    grid-template-columns: 1fr;
  }

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