.small { font-size: 13px; }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(circle at 20% 10%, #ffe2cf, transparent 50%), var(--bg); }
.auth-box { width: 100%; max-width: 400px; padding: 28px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 800; }
.logo-mark { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  background: var(--brand); color: #fff; font-size: 14px; font-weight: 800; }

/* ---------- layout ---------- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.shop-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hdr-logo { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; background: var(--brand-soft); flex: none; }
.hdr-name { font-weight: 800; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-status { font-size: 13px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.tabs { display: flex; gap: 4px; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 14px 14px 12px; font-weight: 600; color: var(--muted); cursor: pointer;
  border-bottom: 3px solid transparent; white-space: nowrap; position: relative; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-ic { font-size: 16px; line-height: 1; }
.tab-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: 12px; }

/* nút trong hộp tính tiền: nút thu tiền to ở trên, hai nút phụ chia đôi bên dưới */
.checkout-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.checkout-actions #confirmCheckoutBtn { grid-column: 1 / -1; }
.checkout-actions .btn { white-space: normal; text-align: center; }

.console-main { max-width: 1200px; margin: 0 auto; padding: 20px; }
.sec-title { font-size: 18px; margin: 22px 0 12px; }
section > .sec-title:first-child, .sec-head .sec-title { margin-top: 0; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.sub-title { font-size: 16px; margin: 22px 0 4px; }

/* ---------- vận hành ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { padding: 16px; }
.stat-val { font-size: 24px; font-weight: 800; margin-top: 4px; }

.requests { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.req { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-left: 5px solid var(--warn); }
.req.payment { border-left-color: var(--ok); }
.req-icon { font-size: 26px; }
.req-body { flex: 1; min-width: 0; }
.req-title { font-weight: 800; }
.req.flash { animation: flash 1s ease-in-out 3; }
@keyframes flash { 50% { background: var(--warn-soft); } }

.live-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 20px; }
.orders { display: flex; flex-direction: column; gap: 10px; }
/* thẻ đơn gọi món: chỉ tóm tắt, bấm mở popup chi tiết */
.order { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 12px 14px;
  border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; transition: box-shadow .15s; }
.order:hover { box-shadow: 0 0 0 2px var(--brand-soft), var(--shadow); }
.order.served { opacity: .75; }
.oh-main { display: flex; flex-direction: column; min-width: 0; }
.oh-side { display: flex; align-items: center; gap: 8px; flex: none; }
.oh-total { font-size: 15px; }
.oh-chev { font-size: 22px; line-height: 1; color: var(--muted); }

/* popup đơn: tick đã lên từng món */
.serve-hint { margin: 0 0 8px; }
.serve-lines { list-style: none; margin: 0 0 12px; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.serve-lines li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.serve-lines li:last-child { border-bottom: 0; }
.serve-lines li.served { background: var(--ok-soft); }
.serve-lines li.served .serve-name { color: var(--muted); text-decoration: line-through; }
.serve-check { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; cursor: pointer; }
.serve-check input { position: absolute; opacity: 0; }
.serve-box { display: grid; place-items: center; width: 26px; height: 26px; flex: none; border: 2px solid var(--line); border-radius: 7px; color: transparent; font-weight: 800; background: #fff; }
.serve-check input:checked + .serve-box { background: var(--ok); border-color: var(--ok); color: #fff; }
.serve-check input:focus-visible + .serve-box { outline: 2px solid var(--brand); outline-offset: 2px; }
.serve-name b { color: var(--brand); }
.serve-amt { white-space: nowrap; font-variant-numeric: tabular-nums; }
.om-actions { align-items: center; }
.order-table { font-weight: 800; font-size: 16px; }
.order-lines { margin: 0; padding: 0; list-style: none; }
.order-lines li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.order-lines li:last-child { border-bottom: 0; }
.order-lines b { color: var(--brand); margin-right: 6px; }
.order-note { margin-top: 6px; padding: 6px 10px; background: var(--warn-soft); border-radius: 8px; font-size: 14px; }
.order-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.order.new { outline: 2px solid var(--brand); }

.table-bills { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.tb { padding: 12px; cursor: pointer; border: 2px solid transparent; text-align: left; }
.tb:hover { border-color: var(--brand-soft); }
.tb.busy { background: var(--brand-soft); }
.tb-name { font-weight: 800; }
.tb-total { font-size: 17px; font-weight: 800; color: var(--brand); margin-top: 2px; }
.tb.idle .tb-total { color: var(--muted); font-weight: 500; font-size: 14px; }

/* ---------- thực đơn ---------- */
.cat-title { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 20px 0 10px; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.item { display: flex; gap: 12px; padding: 10px; cursor: pointer; align-items: center; }
.item:hover { box-shadow: 0 0 0 2px var(--brand-soft), var(--shadow); }
.item img, .item .noimg { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; flex: none; background: var(--bg); }
.noimg { display: grid; place-items: center; font-size: 28px; }
.item-name { font-weight: 700; }
.item-price { color: var(--brand); font-weight: 800; }
.item.off { opacity: .55; }

.img-edit { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.img-edit img { width: 96px; height: 96px; border-radius: 12px; object-fit: cover; background: var(--bg); }

/* ---------- QR ---------- */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 14px; }
.qr-card { padding: 14px; text-align: center; }
.qr-name { font-weight: 800; font-size: 18px; margin: 8px 0; }
.qr-actions { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }

/* ---------- cài đặt ---------- */
.settings { padding: 22px; max-width: 560px; }
.logo-edit { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.site-card { display: flex; gap: 18px; padding: 18px; max-width: 760px; margin-bottom: 18px; align-items: center; }
.site-qr { width: 140px; height: 140px; flex: none; border-radius: 10px; border: 1px solid var(--line); }
.site-info { min-width: 0; }
.site-url { display: block; font-size: 17px; font-weight: 800; word-break: break-all; margin: 2px 0 6px; }
.cover-edit { position: relative; margin-bottom: 14px; }
.cover-preview { width: 100%; aspect-ratio: 3 / 1; object-fit: cover; border-radius: 12px; background: var(--bg); }
.cover-btn { position: absolute; right: 10px; bottom: 10px; }
.logo-edit { margin-top: -44px; padding-left: 16px; position: relative; }
.logo-edit .logo-preview { border: 4px solid #fff; }
.logo-edit > div { padding-top: 44px; }
.logo-preview { width: 88px; height: 88px; border-radius: 18px; object-fit: cover; background: var(--brand-soft); }

/* ---------- checkout ---------- */
.bill-lines { list-style: none; margin: 0 0 12px; padding: 0; }
.bill-lines li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.bill-total { display: flex; justify-content: space-between; font-size: 20px; font-weight: 800; }
.bill-total span:last-child { color: var(--brand); }

/* ---------- hóa đơn & nhân viên ---------- */
.user-chip { font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); white-space: nowrap; }
.bills-summary { display: flex; gap: 8px; flex-wrap: wrap; }
.bills-list { display: flex; flex-direction: column; gap: 10px; }
.bill-row { display: grid; grid-template-columns: auto 1fr auto auto auto; gap: 14px; align-items: center; padding: 12px 14px; }
.bill-no { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.bill-main b { font-size: 16px; }
.bill-amt { font-weight: 800; font-size: 17px; color: var(--brand); white-space: nowrap; }
.staff-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 14px; }
.staff-card { padding: 14px; }
.staff-card.off { opacity: .6; }
.staff-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.staff-name { font-weight: 800; font-size: 16px; }
.staff-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.pay-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 10px; }
/* thẻ chọn hình thức: viền cam là đã chọn, ẩn nút tròn để chữ không bị xuống dòng */
.pay-pick label { position: relative; display: flex; gap: 8px; align-items: center; justify-content: center; min-height: 52px; padding: 10px 8px;
  border: 2px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 700; white-space: nowrap; text-align: center; }
.pay-pick label input { position: absolute; opacity: 0; pointer-events: none; }
.pay-pick label:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--brand-soft); }
.pay-pick label:has(input:checked), .pay-pick label.on { border-color: var(--brand); background: var(--brand-soft); }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }

/* chuyển khoản trong popup tính tiền */
.transfer-box { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; background: #fcfbfa; }
.transfer-qr { display: flex; gap: 14px; align-items: center; }
.transfer-zoom { position: relative; flex: none; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: zoom-in; overflow: hidden; }
.transfer-zoom img { width: 150px; height: 150px; object-fit: contain; display: block; }
.transfer-zoom span { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px; font-size: 11.5px; font-weight: 700; color: #fff; background: rgba(31, 26, 23, .7); opacity: .9; }
.transfer-zoom:hover span { opacity: 1; }
.qr-zoom .modal-box { text-align: center; max-width: 460px; }
.qr-zoom img { width: min(100%, 400px); aspect-ratio: 1; object-fit: contain; margin: 8px auto 0; display: block; cursor: zoom-out; }
.qr-zoom-info { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; color: var(--muted); }
.qr-zoom-info b { font-size: 30px; color: var(--brand); }
.transfer-info { display: flex; flex-direction: column; gap: 3px; font-size: 13.5px; color: var(--muted); min-width: 0; }
.transfer-info b { font-size: 22px; color: var(--brand); }
.transfer-nobank { margin: 0; }
.proof { margin-top: 12px; }
.proof-btn { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 2px dashed color-mix(in srgb, var(--brand) 45%, var(--line));
  border-radius: 12px; background: var(--brand-soft); color: var(--brand-dark); cursor: pointer; transition: background .15s; }
.proof-btn:hover { background: color-mix(in srgb, var(--brand) 14%, #fff); }
.proof-btn svg { width: 28px; height: 28px; flex: none; }
.proof-btn b { display: block; }
.proof-btn small { display: block; font-size: 12.5px; opacity: .8; }
.proof-preview { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; background: var(--ok-soft); }
.proof-preview img { width: 64px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.proof-preview > div { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.proof-ok { color: var(--ok); font-size: 14px; }

/* dòng bật/tắt in phiếu (dùng công tắc .switch có sẵn) */
.switch-row { display: flex; margin-top: 12px; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.switch-row b { display: block; font-size: 14.5px; }
.switch-row small { display: block; font-size: 12.5px; color: var(--muted); }

/* ảnh chuyển khoản trong danh sách hóa đơn */
.proof-thumb { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--ok-soft); cursor: pointer; font-size: 18px; padding: 0; }
.proof-thumb.add { background: var(--bg); border-style: dashed; }
.proof-view { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; border-radius: 12px; }


/* phiếu tính tiền in nhiệt 80mm */
@media print {
  @page { margin: 4mm; }
  .receipt { width: 72mm; margin: 0 auto; font-family: "Be Vietnam Pro", Arial, sans-serif; font-size: 10pt; color: #000; line-height: 1.35; }
  .receipt .r-center { text-align: center; }
  .receipt .r-shop { font-size: 14pt; font-weight: 800; }
  .receipt .r-title { font-size: 12pt; font-weight: 800; margin: 3mm 0 1mm; letter-spacing: .03em; }
  .receipt .r-logo { width: 16mm; height: 16mm; object-fit: cover; margin: 0 auto 1mm; border-radius: 2mm; }
  .receipt hr { border: 0; border-top: 1px dashed #000; margin: 2mm 0; }
  .receipt table { width: 100%; border-collapse: collapse; }
  .receipt td { padding: .6mm 0; vertical-align: top; }
  .receipt td.n { text-align: right; white-space: nowrap; padding-left: 2mm; }
  .receipt .r-total td { font-size: 13pt; font-weight: 800; padding-top: 1.5mm; }
  .receipt .r-qr { width: 40mm; margin: 2mm auto 0; }
  .receipt .r-meta td { font-size: 9pt; }
}

/* ---------- in mã QR ---------- */
.print-area, .receipt-area { display: none; }
/* body.print-receipt: đang in phiếu tính tiền (khổ 80mm), ngược lại là in mã QR */
@media print {
  body > *:not(.print-area):not(.receipt-area) { display: none !important; }
  body:not(.print-receipt) .print-area { display: grid !important; grid-template-columns: repeat(2, 1fr); gap: 12mm; padding: 6mm; }
  body.print-receipt .receipt-area { display: block !important; }
  .print-card { break-inside: avoid; width: 85mm; margin: 0 auto; }
  .print-card .qcard-in { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 860px) {
  .live-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .console-main { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .tabs { padding: 0 8px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat:first-child { grid-column: 1 / -1; }
  #openLabel { display: none; }
  .site-card { flex-direction: column; align-items: flex-start; }
  .bill-row { grid-template-columns: auto 1fr auto auto; }
  .bill-row .btn { grid-column: 1 / -1; }
}

/* ---------- đơn đặt trước ---------- */
.pre-head { margin-top: 22px; }
.pre-head .sec-title { margin: 0; display: flex; align-items: center; gap: 6px; }
.pre-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.pre-filter button { border: 1px solid var(--line); background: #fff; padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: 13px; cursor: pointer; }
.pre-filter button.active { background: var(--text); color: #fff; border-color: var(--text); }
.preorders { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.pre-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 12px 14px; text-align: left;
  border: 2px solid transparent; cursor: pointer; font: inherit; color: inherit; }
.pc-main { min-width: 0; }
.pc-title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-title b { color: var(--muted); font-weight: 700; margin-right: 2px; }
.pc-sub { font-size: 13px; color: var(--muted); }
.pc-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.pc-total { color: var(--brand); font-size: 16px; white-space: nowrap; }
.pc-detail { grid-column: 1 / -1; font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  padding-top: 6px; margin-top: 4px; border-top: 1px dashed var(--line); }
.pre-card:hover { border-color: var(--brand-soft); }
.pre-card.pending { border-left: 5px solid var(--danger); }
.pre-card.accepted { border-left: 5px solid var(--ok); }
.pre-card.done, .pre-card.cancelled { opacity: .7; }

.pre-box { max-width: 560px; }
.pre-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 14px; }
.pre-title h3 { margin: 0; }
.pre-customer { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; padding: 12px 14px; margin-bottom: 14px; border-radius: 12px; background: var(--bg); }
.pre-customer div { display: flex; flex-direction: column; font-size: 14px; }
.pre-customer .muted { font-size: 12px; }
.pre-customer a { color: inherit; }
.pre-cancel { margin-top: 10px; padding: 8px 12px; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-weight: 600; font-size: 14px; }
.pre-history { margin-top: 12px; font-size: 13px; }
.pre-history summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.pre-history ul { margin: 8px 0 0; padding-left: 18px; }
.pre-actions { flex-wrap: wrap; margin-top: 16px; }

.reason-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.reason-chips button { border: 1px solid var(--line); background: #fff; padding: 6px 12px; border-radius: 999px; font-size: 13px; cursor: pointer; }
.reason-chips button:hover { border-color: var(--brand); }

.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.edit-lines { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.edit-line { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.edit-line:last-child { border-bottom: 0; }
.edit-line .grow { flex: 1; min-width: 0; }
.qty-box { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; }
.qty-box button { width: 28px; height: 28px; border: 0; background: none; font-weight: 800; color: var(--brand); cursor: pointer; }
.qty-box span { min-width: 22px; text-align: center; font-weight: 800; }
.line-amt { min-width: 80px; text-align: right; }
.add-line { margin: 10px 0 12px; }
#preEditForm .bill-total { margin-bottom: 16px; }

@media (max-width: 600px) {
  .pre-customer { grid-template-columns: 1fr; }
  .line-amt { display: none; }
}

/* ---------- điện thoại ---------- */
@media (max-width: 700px) {
  /* thanh trên cùng gọn: logo + tên quán, công tắc mở/đóng, đăng xuất */
  .topbar { padding: 8px 12px; gap: 8px; }
  .hdr-logo { width: 36px; height: 36px; }
  .hdr-name { font-size: 15px; }
  .hdr-status { display: none; }
  .topbar-right { gap: 4px; flex: none; }
  .topbar .btn-sm { padding: 0 8px; }
  .user-chip { padding: 5px 9px; }

  /* thanh mục cố định dưới đáy, icon + nhãn ngắn */
  .bottom-tabs .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; gap: 0; padding: 0 0 env(safe-area-inset-bottom);
    border-bottom: 0; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0,0,0,.06); overflow: visible; }
  .bottom-tabs .tabs button { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 3px; padding: 8px 2px 7px; font-size: 11px;
    border-bottom: 0; border-top: 3px solid transparent; }
  .bottom-tabs .tabs button.active { border-top-color: var(--brand); background: var(--brand-soft); }
  .bottom-tabs .tab-ic { font-size: 20px; }
  .bottom-tabs .tab-tx { font-size: 0; }
  .bottom-tabs .tab-tx::after { content: attr(data-short); font-size: 11px; }
  .bottom-tabs .tab-count { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 11px; padding: 0 5px; }
  .bottom-tabs .console-main { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }

  /* trang nhà cung cấp: thanh mục trong thẻ, cuộn ngang */
  .inline-tabs .tabs { padding: 0 6px; }
  .inline-tabs .tabs button { padding: 12px 10px 10px; font-size: 14px; }

  .console-main { padding: 14px 12px; }
  .sec-title { font-size: 17px; margin: 18px 0 10px; }
  .stats { gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat-val { font-size: 20px; }
  .requests, .preorders { grid-template-columns: 1fr; }
  .table-bills { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .tb { padding: 10px; }
  .tb-total { font-size: 15px; }
  .items { grid-template-columns: 1fr; }
  .qr-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .qr-card { padding: 10px; }
  .qr-name { font-size: 15px; }
  .qr-actions .btn { flex: 1 1 45%; padding: 0 6px; }
  .staff-list { grid-template-columns: 1fr; }
  .settings { padding: 16px; }
  .sec-head .btn-primary { min-height: 38px; }
  .pre-head { flex-direction: column; align-items: flex-start; }
}

.logout-btn { gap: 6px; }
.logout-btn .ic { width: 18px; height: 18px; }
@media (max-width: 700px) {
  .logout-tx { display: none; }
  .logout-btn { width: 38px; padding: 0 !important; justify-content: center; }
}

/* ---------- cài đặt: biểu mẫu + xem trước trang web ---------- */
.settings-layout { display: grid; grid-template-columns: minmax(0, 560px) 1fr; gap: 24px; align-items: start; margin-top: 18px; }
.settings-layout .settings { max-width: none; }
.settings-save { position: sticky; bottom: 0; display: flex; align-items: center; gap: 12px; margin: 18px -22px -22px; padding: 14px 22px;
  background: #fff; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.site-preview { position: sticky; top: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.preview-head { display: flex; flex-direction: column; align-items: center; }
.phone-frame { width: 340px; height: 680px; padding: 10px; border-radius: 40px; background: #1f1a17; box-shadow: 0 20px 50px rgba(0,0,0,.18); }
.phone-frame iframe { width: 100%; height: 100%; border: 0; border-radius: 30px; background: var(--bg); }

.theme-pick { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 4px; }
.swatch { position: relative; width: 38px; height: 38px; border-radius: 50%; border: 3px solid #fff; background: var(--c);
  box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch.active { box-shadow: 0 0 0 2px var(--c), 0 0 0 4px #fff, 0 0 0 5px var(--line); }
.swatch.custom { display: grid; place-items: center; overflow: hidden; color: #fff; font-weight: 800; font-size: 18px; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.swatch.custom span { pointer-events: none; text-shadow: 0 1px 2px rgba(0,0,0,.4); }

@media (max-width: 1100px) {
  .settings-layout { grid-template-columns: 1fr; }
  .site-preview { position: static; order: -1; }
  .phone-frame { width: 300px; height: 560px; }
}
@media (max-width: 700px) {
  .site-preview { display: none; }
  .settings-save { margin: 16px -16px -16px; padding: 12px 16px; }
}

/* ---------- thẻ QR dán bàn (tỉ lệ 5:7, kích thước theo bề rộng thẻ) ---------- */
/* .qcard chỉ là khung đo bề rộng (cqw tính theo khung này); .qcard-in vẽ thẻ */
.qcard { container-type: inline-size; width: 100%; }
.qcard-in { position: relative; width: 100cqw; aspect-ratio: 5 / 7; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 7cqw 6cqw 6cqw;
  background: var(--qc-card) center / cover no-repeat; color: var(--qc-text); text-align: center; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.qcard-in.rounded { border-radius: 7cqw; }
.qcard-in.has-bg::before { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.35); }
.qcard-in > * { position: relative; }
.qcard-top { display: flex; flex-direction: column; align-items: center; gap: 2.5cqw; }
.qcard-brand { width: 12cqw; height: 12cqw; border-radius: 2.8cqw; object-fit: cover; }
.qcard-title { font-size: 6.2cqw; font-weight: 800; line-height: 1.15; }
.qcard-qr { position: relative; width: 66cqw; aspect-ratio: 1; padding: 3cqw; border-radius: 3.6cqw; background: var(--qc-light); }
.qcard-qr svg { display: block; width: 100%; height: 100%; }
.qcard-logo { position: absolute; left: 50%; top: 50%; width: 13cqw; height: 13cqw; transform: translate(-50%, -50%);
  border-radius: 2.2cqw; object-fit: cover; outline: 1.2cqw solid var(--qc-light); background: var(--qc-light); }
.qcard-table { padding: 1.6cqw 6cqw; border-radius: 99cqw; background: var(--qc-accent); color: #fff; font-size: 7cqw; font-weight: 800; }
.qcard-hint { font-size: 3.6cqw; line-height: 1.35; opacity: .9; }

.qr-card { display: flex; flex-direction: column; gap: 10px; }
.qr-card .qcard-in { box-shadow: 0 4px 14px rgba(0,0,0,.08), inset 0 0 0 1px rgba(0,0,0,.06); }

/* ---------- trình thiết kế thẻ QR ---------- */
.qr-designer { margin: 16px 0 6px; overflow: hidden; }
.qr-designer summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 16px 18px; cursor: pointer; font-weight: 700; list-style: none; }
.qr-designer summary::-webkit-details-marker { display: none; }
.qr-designer summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
.qr-designer[open] summary::after { content: "▴"; }
.qd-body { display: grid; grid-template-columns: 1fr 280px; gap: 24px; padding: 0 18px 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.qd-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.qd-presets button { border: 1px solid var(--line); background: #fff; padding: 7px 12px; border-radius: 999px; font-weight: 600; font-size: 13px; cursor: pointer; }
.qd-presets button:hover { border-color: var(--brand); color: var(--brand); }
.qd-colors { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 12px; }
.qd-colors label { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; }
.qd-colors input { width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: none; cursor: pointer; }
.qd-colors input::-webkit-color-swatch-wrapper { padding: 3px; }
.qd-colors input::-webkit-color-swatch { border: 0; border-radius: 9px; }
.qd-warn { margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 600; }
.qd-row { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.qd-controls .check { margin-bottom: 8px; }
.qd-save { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.qd-preview { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.qd-preview-card { width: 100%; max-width: 260px; }
.qd-preview-card .qcard-in { box-shadow: 0 10px 30px rgba(0,0,0,.15), inset 0 0 0 1px rgba(0,0,0,.06); }

@media (max-width: 860px) {
  .qd-body { grid-template-columns: 1fr; }
  .qd-preview { order: -1; }
  .qd-preview-card { max-width: 220px; }
}
@media (max-width: 700px) {
  .qd-colors { grid-template-columns: repeat(5, 1fr); gap: 4px; }
  .qd-colors input { width: 40px; height: 40px; }
  .qr-designer summary { padding: 14px; }
  .qd-body { padding: 14px; }
}

/* ---------- hóa đơn theo ngày ---------- */
.bills-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bills-tools .input { width: auto; min-height: 36px; padding: 6px 10px; }
.bills-days-box { padding: 14px 16px 10px; margin-bottom: 14px; }
.bills-days-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.bills-days { display: flex; gap: 4px; overflow-x: auto; padding: 0 0 4px; margin: 0; scrollbar-width: thin; }
.bday { flex: 1 0 34px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 2px; border: 0; border-radius: 8px;
  background: none; cursor: pointer; font: inherit; color: var(--muted); }
.bday:hover { background: var(--bg); }
.bday.active { background: var(--brand-soft); color: var(--brand-dark); }
.bday-bar { display: flex; align-items: flex-end; width: 14px; height: 54px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.bday-bar i { display: block; width: 100%; border-radius: 4px 4px 0 0; background: var(--brand); }
.bday.empty-day .bday-bar { background: transparent; border-bottom: 2px solid var(--line); border-radius: 0; }
.bday-date { font-size: 11px; font-weight: 700; }
.bday-amt { font-size: 10px; white-space: nowrap; }
.bills-summary { margin-bottom: 12px; }

@media (max-width: 700px) {
  .bills-tools { width: 100%; }
  .bills-tools .input { flex: 1; }
}
.session-note { margin: 10px 0 0; }

/* điện thoại: thẻ đơn chỉ hiện tóm tắt, bấm vào mới mở chi tiết */
@media (max-width: 700px) {
  .pre-card { padding: 10px 12px; gap: 2px 10px; }
  .pc-detail { display: none; }
  .pc-side { gap: 3px; }
  .pc-side .badge { font-size: 11px; padding: 1px 8px; }
  .orders { gap: 8px; }
  .order { padding: 10px 12px; }
  .order.new { outline-width: 1.5px; }
  .oh-side { gap: 6px; }
  .oh-side .badge { font-size: 11px; padding: 1px 8px; }
  .om-actions #omCancel { order: 9; flex-basis: 100%; }
}

/* ---------- tạo đơn giúp khách, mang về, hủy đơn bàn ---------- */
.live-actions { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.tab-count-muted { background: var(--text); }
.takeaway-bills { margin-bottom: 4px; }
.tb.takeaway { border-left: 4px solid var(--brand); }
.tb-cust { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.checkout-actions .cancel-table-btn { grid-column: 1 / -1; min-height: 36px; font-size: 14px; }
.takeaway-qr-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin: 10px 0 6px; }
.takeaway-qr { border: 2px dashed var(--brand); }

.new-order-box { max-width: 560px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; margin-bottom: 14px; border-radius: 12px; background: var(--bg); }
.seg button { border: 0; background: none; padding: 9px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--muted); }
.seg button.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.pick-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
.pick:last-child { border-bottom: 0; }
.pick.on { background: var(--brand-soft); }
.pick-name { flex: 1; min-width: 0; font-weight: 600; }
.pick-name small { display: block; color: var(--brand); font-weight: 700; }
.new-order-box .bill-total { margin: 4px 0 4px; }

@media (max-width: 700px) {
  .live-actions .btn { width: 100%; }
  .pick-list { max-height: 42vh; }
}

/* ---------- vận hành trên điện thoại: 3 nhóm + thanh icon dọc cố định ---------- */
.live-rail { display: none; }
@media (max-width: 700px) {
  /* thanh icon dọc nổi đè lên trang, không thu hẹp nội dung; nhấn giữ để kéo ra chỗ khác */
  [data-panel="live"] .live-group:not(.active-group) { display: none; }
  [data-panel="live"] .live-group > .sec-title:first-child, [data-panel="live"] .live-group > .live-actions:first-child { margin-top: 0; }
  .live-grid { display: block; }
  .live-rail { position: fixed; right: 6px; top: 50%; transform: translateY(-50%); z-index: 35; display: flex; flex-direction: column; gap: 4px;
    padding: 6px; border-radius: 18px; background: #fff; box-shadow: 0 6px 24px rgba(0,0,0,.14); }
  .live-rail button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 48px; padding: 8px 2px;
    border: 0; border-radius: 12px; background: none; font: inherit; font-size: 9.5px; font-weight: 700; color: var(--muted); cursor: pointer; line-height: 1.1; }
  .live-rail button.active { background: var(--brand-soft); color: var(--brand-dark); }
  .lr-ic { font-size: 20px; line-height: 1; }
  .lr-badge { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: var(--text); color: #fff; font-size: 11px; font-style: normal; font-weight: 800; display: grid; place-items: center; }
  .lr-badge.lr-urgent { background: var(--danger); }
  .lr-badge[hidden] { display: none; }
  .table-bills { grid-template-columns: repeat(2, 1fr); }
}
.table-quota { align-self: center; font-size: 13px; font-weight: 600; color: var(--muted); }
.table-quota.full { color: var(--danger); }
@media (max-width: 700px) {
  .oh-by { display: none; }
  .order .order-table { font-size: 15px; }
  .oh-main .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
.checkout-actions #printDraftBtn, .checkout-actions #resetSessionBtn { grid-column: 1 / -1; }

/* thanh icon dọc: nhấn giữ để kéo */
@media (max-width: 700px) {
  .live-rail { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: box-shadow .15s, transform .15s; }
  .live-rail.dragging { box-shadow: 0 12px 34px rgba(0,0,0,.28); cursor: grabbing; }
  .live-rail.dragging button { pointer-events: none; }
  .lr-grip { display: block; width: 22px; height: 4px; margin: 2px auto 2px; border-radius: 4px; background: var(--line); }
  .live-rail.dragging .lr-grip { background: var(--brand); }
}

/* ---------- máy tính: nút tạo đơn + số liệu trải hết chiều ngang; bên dưới chia 2 cột,
   trái: yêu cầu → đặt trước → đơn gọi; phải: các bàn + mang về ---------- */
@media (min-width: 861px) {
  section[data-panel="live"] { display: grid; grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr); grid-template-rows: auto auto auto 1fr; gap: 0 24px; align-items: start; }
  section[data-panel="live"] .live-grid { display: contents; }
  section[data-panel="live"] .live-top { grid-column: 1 / -1; grid-row: 1; }
  section[data-panel="live"] .lg-requests { grid-column: 1; grid-row: 2; }
  section[data-panel="live"] .lg-preorders { grid-column: 1; grid-row: 3; }
  section[data-panel="live"] .lg-orders { grid-column: 1; grid-row: 4; }
  section[data-panel="live"] .lg-right { grid-column: 2; grid-row: 2 / span 3; }
  section[data-panel="live"] .table-bills { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}
@media (max-width: 700px) {
  [data-panel="live"] .live-top + .live-group > .sec-title:first-child { margin-top: 18px; }
}

/* quán tắt nhận đặt trước: ẩn hẳn mục Đơn đặt trước (cả máy tính lẫn điện thoại) */
[data-panel="live"] .live-group.off { display: none !important; }
@media (max-width: 700px) {
  [data-panel="live"] .lg-orders > .sec-title:first-child { margin-top: 18px; }
  [data-panel="live"] .lg-preorders > .pre-head { margin-top: 0; }
}

/* cột phải (bàn + mang về): điện thoại tách thành 2 nhóm riêng */
@media (max-width: 860px) { [data-panel="live"] .lg-right { display: contents; } }
@media (max-width: 700px) { [data-panel="live"] .lg-takeaway > .sec-title:first-child { margin-top: 0; } }

/* ---------- khuyến mãi ---------- */
.promo-box { padding: 16px; margin-bottom: 16px; }
.promo-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.promo-head h3 { font-size: 16px; margin-bottom: 4px; }
.promo-head p { margin: 0; max-width: 560px; }
.promo-head .btn { flex: none; }
.promo-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; margin: 14px 0; }
.promo-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; text-align: left; font: inherit; }
.promo-row:hover { border-color: var(--brand); }
.promo-pct { flex: none; min-width: 58px; padding: 8px 6px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-dark); font-weight: 800; text-align: center; }
.promo-main { flex: 1; min-width: 0; }
.promo-main b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.promo-main small { display: block; color: var(--muted); font-size: 12.5px; }
.promo-empty { padding: 12px 0; }
.staff-discount { font-size: 14px; }

/* giảm giá trong popup tính tiền */
.bill-sub { display: flex; justify-content: space-between; font-size: 15px; color: var(--muted); padding: 2px 0; }
.bill-sub.disc { color: var(--ok); font-weight: 600; }
.opt-card { border: 1px solid var(--line); border-radius: 12px; margin-top: 14px; overflow: hidden; }
.opt-card .switch-row { border: 0; border-radius: 0; margin-top: 0; }
#discountSub.on { color: var(--ok); font-weight: 600; }
.discount-panel { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.discount-input { display: flex; align-items: center; gap: 4px; height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.discount-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.discount-input input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 22px; font-weight: 800; color: var(--brand); text-align: right; -moz-appearance: textfield; }
.discount-input input::-webkit-outer-spin-button, .discount-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.discount-input input::placeholder { color: #c9c1ba; font-weight: 700; font-size: 18px; }
.discount-input span { font-size: 20px; font-weight: 800; color: var(--muted); }
.discount-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.discount-chips:empty { display: none; }
.dchip { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer; font: inherit; font-size: 13px; }
.dchip b { color: var(--brand); }
.dchip.on { border-color: var(--brand); background: var(--brand-soft); }
.dchip:disabled { opacity: .45; cursor: not-allowed; }
.bill-disc { color: var(--ok); font-weight: 600; }
@media (max-width: 700px) {
  .promo-head { flex-direction: column; }
  .promo-list { grid-template-columns: 1fr; }
}

/* mã gọi chung của bàn (máy khác ở cùng bàn nhập để gọi món chung) */
.tb-pin { margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--brand-dark); letter-spacing: .04em; }
.checkout-pin { margin: -4px 0 8px; padding: 8px 12px; border-radius: 10px; background: var(--brand-soft); font-size: 13.5px; }
.checkout-pin b { color: var(--brand); font-size: 16px; letter-spacing: .1em; }
