/* Food Passport — cổng nhà hàng & khách hàng (mobile first, minimal) */
:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --text: #1c1917;
  --muted: #78716c;
  --line: #e7e5e4;
  --accent: #c2410c;
  --accent-soft: #fff7ed;
  --ok: #15803d;
  --ok-soft: #f0fdf4;
  --warn: #a16207;
  --warn-soft: #fefce8;
  --err: #b91c1c;
  --err-soft: #fef2f2;
  --radius: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* để thuộc tính hidden thắng các class đặt display */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1 { font-size: 22px; font-weight: 600; margin: 8px 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 28px 0 10px; }
.muted { color: var(--muted); }
.container { max-width: 520px; margin: 0 auto; padding: 16px 16px 48px; }

/* top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar-inner { max-width: 520px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; min-width: 0; }
.brand span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-mark { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; }
.brand-lg { font-size: 15px; margin-bottom: 24px; }
.topnav { display: flex; align-items: center; gap: 16px; font-size: 14px; color: var(--muted); }
.topnav a.active { color: var(--text); font-weight: 600; }
.avatar { width: 28px; height: 28px; border-radius: 50%; }

/* auth */
.auth { min-height: calc(100vh - 64px); display: flex; align-items: center; }
.auth-card { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px 22px; }
.auth-card h1 { margin-bottom: 4px; }
.auth-card form { margin-top: 20px; }

/* form */
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], input[type=date] {
  width: 100%; font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; outline: none;
}
input:focus { border-color: var(--text); }
.inline-form { display: flex; gap: 8px; }
.inline-form input { text-transform: uppercase; letter-spacing: .08em; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font: inherit; font-weight: 600; padding: 12px 18px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.btn-primary { background: var(--text); border-color: var(--text); color: #fff; }
.btn-primary:disabled { opacity: .35; cursor: not-allowed; }
.btn-block { width: 100%; margin-top: 8px; }
.btn-google { background: var(--surface); }

/* alerts & badges */
.alert { padding: 10px 12px; border-radius: 10px; font-size: 14px; margin: 12px 0; }
.alert-error { background: var(--err-soft); color: var(--err); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #f5f5f4; color: var(--muted); white-space: nowrap; }
.badge-active { background: var(--ok-soft); color: var(--ok); }
.badge-expired, .badge-cancelled, .badge-voided { background: #f5f5f4; color: var(--muted); }
.badge-refunded { background: var(--warn-soft); color: var(--warn); }
.badge-completed { background: #eff6ff; color: #1d4ed8; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; }
.card-link { display: block; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; }
.card-row + .card-row { margin-top: 6px; }
.label { font-size: 12px; color: var(--muted); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 17px; font-weight: 600; letter-spacing: .08em; }
.back { display: inline-block; color: var(--muted); font-size: 14px; margin: 4px 0 8px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* scanner */
.scanner { margin: 16px 0; }
#reader { display: none; width: 100%; border-radius: var(--radius); overflow: hidden; background: #000; }
#reader.active { display: block; min-height: 240px; margin-bottom: 8px; } /* cao tạm khi camera đang khởi động */
#reader video { display: block; }
#reader img { display: none; } /* ảnh minh hoạ mặc định của thư viện */
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 20px 0 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* items */
.items { list-style: none; padding: 0; margin: 0; }
.item { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; transition: border-color .15s; }
.item-selected { border-color: var(--text); }
.item-disabled { opacity: .5; }
.item-name { font-weight: 600; }
.item-meta { font-size: 13px; color: var(--muted); }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; flex: none; }
.stepper button { width: 38px; height: 38px; border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--text); }
.stepper input { width: 40px; border: 0; padding: 0; text-align: center; font-weight: 600; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.summary { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 2px 4px; }
.summary strong { font-size: 20px; }

/* lines / history */
.lines { list-style: none; margin: 0; padding: 0; }
.lines li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.lines li:last-child { border-bottom: 0; }
.lines li.is-done { color: var(--muted); text-decoration: line-through; }
.group-title { font-weight: 600; margin-bottom: 4px; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; font-size: 14px; }
.history li.is-void { opacity: .55; }
.history-head, .history-foot { display: flex; justify-content: space-between; gap: 12px; }
.history-foot { margin-top: 6px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-head input { width: auto; padding: 8px 10px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.stat .value { font-weight: 600; font-size: 15px; margin-top: 2px; }

/* success */
.success { text-align: center; padding: 24px 0 8px; }
.success-icon { width: 56px; height: 56px; margin: 0 auto 8px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); font-size: 28px; line-height: 56px; }

/* customer */
.passports { list-style: none; margin: 16px 0 0; padding: 0; }
.progress { height: 4px; background: #f5f5f4; border-radius: 4px; overflow: hidden; margin: 12px 0 8px; }
.progress span { display: block; height: 100%; background: var(--accent); }
.qr-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; text-align: center; margin: 8px 0 12px; }
.qr { width: 100%; max-width: 260px; image-rendering: pixelated; }
.qr-off { height: 200px; display: flex; align-items: center; justify-content: center; }
.qr-card .code { margin-top: 8px; }
.qr-card p { font-size: 13px; margin: 6px 0 0; }

@media (max-width: 360px) {
  .stats { grid-template-columns: 1fr; }
}

/* dish image */
.dish-img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex: none; background: #f5f5f4; }
.item-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lines li .item-main { gap: 10px; }
.lines .dish-img { width: 36px; height: 36px; border-radius: 8px; }
