:root {
  --bg: #f4f7fa;
  --ink: #23303e;
  --muted: #68788c;
  --panel: #ffffff;
  --line: #dfe6ee;
  --accent: #007bfc;
  --accent-hover: #0069d9;
  --accent-soft: #e8f2ff;
  --accent-ink: #ffffff;
  --ok: #1e8e5a;
  --err: #d93025;
  --shadow: 0 1px 3px rgba(35, 48, 62, 0.08);
  --shadow-lg: 0 8px 24px rgba(35, 48, 62, 0.12);
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--sans);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: .8rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-size: 1.3rem;
  font-weight: 750;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -.02em;
  line-height: 1;
}
.brand:hover { text-decoration: none; }
.brand-logo {
  width: 30px;
  height: 30px;
  display: block;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 110, 230, .3);
}
.brand-name em {
  font-style: normal;
  color: var(--accent);
}
.nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: .45rem .9rem;
  border-radius: 6px;
  font-weight: 500;
}
.nav a:hover {
  background: #f0f4f9;
  color: var(--ink);
  text-decoration: none;
}
.nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.container {
  width: min(1100px, calc(100% - 2rem));
  margin: 1.5rem auto 3rem;
}
.hero {
  padding: 3rem 0 2rem;
}
.hero h1, .panel h1, .panel h2, .guest-header h1, .menu-section h2 {
  margin: 0 0 .5rem;
  font-weight: 600;
  letter-spacing: -.01em;
}
.eyebrow {
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 600;
  margin: 0 0 .75rem;
}
.lede { font-size: 1.08rem; color: var(--muted); max-width: 36rem; }
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}
.steps article, .panel, .stat, .qr-card, .order-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.steps article { padding: 1.25rem; }
.panel { padding: 1.4rem; margin-bottom: 1rem; }
.panel.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.muted { color: var(--muted); }
.btn-row, .row-actions, .filters, .cart-summary { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.btn {
  appearance: none;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-ink);
  padding: .6rem 1.1rem;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:hover { background: #0069d9; text-decoration: none; }
.btn.ghost {
  background: #ffffff;
  color: var(--ink);
  border-color: var(--line);
}
.btn.ghost:hover { border-color: #b9c6d4; background: #f7fafc; }
.btn.danger { background: var(--err); color: #fff; }
.btn.danger:hover { background: #b3251c; }
.btn.small { padding: .32rem .7rem; font-size: .88rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.form { display: grid; gap: .85rem; }
.form.inline { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); align-items: end; }
label { display: grid; gap: .35rem; font-size: .9rem; color: var(--muted); font-weight: 500; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .62rem .75rem;
  font: inherit;
  background: #fff;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 123, 252, .15);
}
.alert {
  padding: .85rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}
.alert.success { background: #e6f6ee; color: var(--ok); border-color: #bfe8d2; }
.alert.error { background: #fdecea; color: var(--err); border-color: #f6c8c4; }

.toast-host {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  width: min(360px, calc(100vw - 2rem));
  pointer-events: none;
}
.toast {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem 1rem;
  border-radius: 10px;
  border: 1px solid transparent;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  opacity: 0;
  transform: scale(.96);
  transition: opacity .22s ease, transform .22s ease;
}
.toast.toast-show {
  opacity: 1;
  transform: scale(1);
}
.toast.toast-leave {
  opacity: 0;
  transform: scale(.96);
}
.toast-success {
  background: #e6f6ee;
  color: var(--ok);
  border-color: #bfe8d2;
}
.toast-error {
  background: #fdecea;
  color: var(--err);
  border-color: #f6c8c4;
}
.toast-msg {
  flex: 1;
  line-height: 1.45;
  font-size: .95rem;
}
.toast-close {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  margin: -.15rem -.25rem 0 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  opacity: .7;
}
.toast-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, .06);
}

.stats { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stat { padding: 1rem 1.25rem; min-width: 140px; }
.stat strong { display: block; font-size: 1.8rem; font-weight: 650; color: var(--accent); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .7rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.list { list-style: none; padding: 0; margin: 1rem 0 0; }
.list li { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }

.table-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.qr-card {
  text-align: center;
  padding: 1rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.qr-card:hover {
  border-color: #b9d5f8;
  box-shadow: var(--shadow-lg);
}
.qr-card h2 {
  margin: .35rem 0 .2rem;
}
.qr-card .table-label {
  letter-spacing: 0.02em;
}
.qr-card .check-row {
  margin-bottom: .35rem;
}
.qr-card .btn {
  margin-top: .65rem;
}
.qr-card .card-actions {
  display: flex;
  justify-content: center;
  gap: .5rem;
  margin-top: .65rem;
}
.qr-card .card-actions .btn {
  margin-top: 0;
}
.table-code-link {
  color: inherit;
  text-decoration: none;
}
.table-code-link:hover code {
  color: var(--accent);
  text-decoration: underline;
}

.chip {
  display: inline-flex;
  padding: .35rem .8rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  text-decoration: none;
}
.chip:hover { border-color: #b9c6d4; text-decoration: none; color: var(--ink); }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.order-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.order-card header, .order-card footer {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: center;
}
.item-list { list-style: none; padding: 0; margin: .8rem 0; }
.item-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem 0; }
.note { color: var(--muted); font-size: .92rem; }
.badge {
  display: inline-flex;
  padding: .2rem .6rem;
  border-radius: 999px;
  background: #eef2f7;
  font-size: .8rem;
  font-weight: 500;
}
.status-pending { background: #fff4d6; color: #8a6100; }
.status-confirmed { background: #e8f2ff; color: #0059c1; }
.status-kitchen { background: #ffe9d6; color: #a34e00; }
.status-ready { background: #e0f5e9; color: #14713f; }
.status-served { background: #eceff3; color: #5a6675; }
.status-cancelled { background: #fdecea; color: #b3251c; }

.guest-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}
.dish-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.price { margin: .35rem 0 0; color: var(--accent); font-weight: 600; }
.qty { display: inline-flex; align-items: center; gap: .35rem; }
.qty input {
  width: 2.5rem;
  text-align: center;
  padding: .35rem;
}
.qty-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}
.qty-btn:hover { border-color: var(--accent); color: var(--accent); }
.cart-bar {
  position: sticky;
  bottom: 0;
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: .75rem;
  box-shadow: var(--shadow-lg);
}
.note-field { display: grid; gap: .35rem; }

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}
.section-head h2 { margin: 0; }
.dish-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}
.image-upload-form {
  margin: 0;
}
.dish-picker {
  position: relative;
  display: inline-flex;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  border: 1px dashed var(--line);
  background: #f7fafc;
  overflow: hidden;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.dish-picker.has-image {
  border-style: solid;
  background: #fff;
}
.dish-picker-placeholder {
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.25;
  padding: .25rem;
}
.dish-picker input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  font-size: 0;
}
.dish-picker:hover {
  border-color: var(--accent);
}
.dish-photo {
  width: 84px;
  height: 84px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.dish-photo.placeholder {
  display: grid;
  place-items: center;
  background: #eef2f7;
  color: var(--muted);
  font-size: .75rem;
}
.dish-info { flex: 1; min-width: 0; }
.preview-banner {
  display: flex;
  gap: .75rem;
  align-items: baseline;
  flex-wrap: wrap;
}
.check-row {
  display: flex;
  gap: .4rem;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: .85rem;
  margin-bottom: .5rem;
}
.top-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
textarea {
  resize: vertical;
}

.table-cards-inner {
  display: contents;
}
.card-fade-enter-active,
.card-fade-leave-active {
  transition: opacity .18s ease, transform .18s ease;
}
.card-fade-enter-from,
.card-fade-leave-to {
  opacity: 0;
  transform: scale(.98);
}

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(35, 48, 62, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.confirm-modal {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 1.4rem;
}
.confirm-modal h3 {
  margin: 0 0 .5rem;
  font-weight: 600;
}
.confirm-modal p {
  margin: 0;
  color: var(--muted);
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
  margin-top: 1.1rem;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .45rem .8rem;
}
.batch-modal {
  width: min(480px, 100%);
}
.batch-modal .preview-line {
  margin: .25rem 0 0;
}
.batch-modal .section-head {
  margin-bottom: .35rem;
}
.text-link {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}
.text-link:hover {
  color: #0069d9;
}

.edit-item-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.edit-item-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: .85rem 0;
  border-bottom: 1px solid var(--line);
}
.edit-total {
  margin: 1rem 0 0;
  font-size: 1.1rem;
}
.menu-filter {
  width: 100%;
  margin-bottom: .75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .62rem .75rem;
  font: inherit;
}
.add-dish-list {
  display: grid;
  gap: .5rem;
  max-height: 420px;
  overflow: auto;
}
.add-dish-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: .65rem 0;
  border-bottom: 1px solid var(--line);
}
.add-dish-row .muted {
  display: block;
  font-size: .85rem;
}

@media (max-width: 800px) {
  .steps, .grid-2 { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
  .hero { padding-top: 1.5rem; }
}
