/* ── Base ─────────────────────────────────────────────────────────── */
body { background: #f0f2f7; font-size: 15px; margin: 0; padding: 0; }

.view { display: none; }
/* Bám top:0/bottom:0 thay cho height:100vh: 100vh trên trình duyệt mobile/
   tablet tính cả phần bị thanh địa chỉ/thanh điều hướng che -> nội dung dưới
   cùng bị khuất mà không cuộn tới được. Phần tử fixed bám 2 cạnh thì trình
   duyệt tự co theo vùng nhìn thấy thật (giống #viewTables bên dưới). */
.view.active {
  display: block; position: fixed;
  top: 0; bottom: 0; left: 0; right: 0;
  background: #f0f2f7; z-index: 10; overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom);
}
#viewLowRate.active,
#viewAlreadyRated.active {
  display: flex; align-items: center; justify-content: center;
}
/* Màn Mã QR: căn giữa bằng margin:auto thay vì align/justify center — tab
   Banks nhiều QR cao hơn màn hình thì vẫn cuộn được từ đầu, không bị cắt
   mất phần trên như khi dùng justify-content: center. */
#viewQrCodes.active { display: flex; }
#viewQrCodes .qr-view-inner { margin: auto; padding-top: 72px; padding-bottom: 24px; }
/* Canh top thay vì center để bàn phím ảo trên tablet/mobile không che nút
   Đăng nhập / Xác nhận khi focus vào ô nhập PIN. */
#viewPin.active,
#viewRatePinAuth.active {
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 40px;
}
#viewRate.active {
  display: flex; align-items: center; justify-content: center;
  background: #fff; overflow: hidden;
}

/* ── Top bar ──────────────────────────────────────────────────────── */
.topbar {
  background: #fff;
  border-bottom: 1px solid #dee2e6;
  min-height: 52px;
}
/* Gộp topbar + hàng tìm kiếm thành 1 khối đứng yên phía trên vùng scroll của
   danh sách bill, để cả 2 không bị cuộn mất khi lướt danh sách. Dùng flexbox
   (header flex-shrink:0 + vùng scroll flex:1/min-height:0) thay vì
   position:sticky — sticky từng để lại 2 lỗi trên tablet: header vẫn cuộn
   theo trên vài WebView cũ, và bill cuối cùng bị che khuất một phần do vùng
   scroll không được giới hạn chiều cao rõ ràng (cùng cách đã sửa ổn định cho
   CsWebApp). */
#viewList.active { display: flex; flex-direction: column; overflow: hidden; }
.viewlist-sticky-header { flex-shrink: 0; background: #fff; }
.bill-search-row { background: #fff; border-bottom: 1px solid #dee2e6; }

/* ── Auth / form cards: fluid width thay vì px cố định ──────────────── */
.auth-card { width: 380px; max-width: 92vw; }
.form-card { width: 480px; max-width: 92vw; }

#pinHotline { font-size: 15px; }
.pin-hotline-number { font-size: 20px; font-weight: 700; color: #0d6efd; }
.pin-logo { width: 50%; height: auto; margin-top: 14px; margin-bottom: 14px; }
.pin-version {
  position: fixed; bottom: 10px; left: 0; right: 0; text-align: center;
  font-size: 12px; font-style: italic; color: #adb5bd;
}
#pinBranchName { font-size: 20px; }

/* ── Show/hide password icon ─────────────────────────────────────── */
.btn-toggle-password {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: #6c757d;
  padding: 4px 8px; cursor: pointer; font-size: 20px; line-height: 1;
}
.btn-toggle-password:hover { color: #0d6efd; }
/* Ô PIN type="text" che ký tự như ô mật khẩu — để trình duyệt không hỏi lưu
   mật khẩu (xem index.html); nút mắt bỏ class này để hiện PIN. */
.pin-mask { -webkit-text-security: disc; text-security: disc; }

/* ── Top bar: my stats (1 dòng) + tên user ──────────────────────────── */
.topbar-stats {
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; color: #495057; white-space: nowrap;
}
.topbar-stats b { font-size: 15px; font-weight: 700; margin-right: 2px; }
.topbar-stats b.bad  { color: #A32D2D; }
.topbar-stats b.good { color: #0F6E56; }
.topbar-stats b.stat-month { font-weight: 900; margin-right: 6px; }
.topbar-stats .stat-sep { margin: 0 2px; color: #ced4da; }
.stat-icon { font-size: 15px; -webkit-text-stroke: .3px currentColor; }
.stat-icon.bad  { color: #A32D2D; }
.stat-icon.good { color: #0F6E56; }
.top-staff-name {
  font-size: .875rem; font-weight: 600; color: #212529;
  padding: .25rem .5rem;
}
.top-staff-name.admin {
  cursor: pointer; border-radius: 20px;
  background: #f0f4ff; border: 1px solid #d0deff;
}
.top-staff-name.admin:hover { background: #e2eaff; }
.role-icon-staff { color: #6c757d; }
.role-icon-admin { color: #0d6efd; }
.role-icon-cashier { color: #b58105; }

/* Modal phiên đăng nhập kết thúc (đổi role / khoá tài khoản) */
.session-ended { border: none; border-radius: 16px; }
.session-ended-icon {
  width: 72px; height: 72px; border-radius: 50%; font-size: 36px;
  display: flex; align-items: center; justify-content: center;
}
.session-ended-icon.role   { background: #fff3cd; color: #b58105; }
.session-ended-icon.locked { background: #f8d7da; color: #dc3545; }
.session-role-change {
  display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 12px; padding: 10px 16px;
}
.session-role-change .badge { font-size: .95rem; padding: .45em .75em; }
.session-role-change .bi-arrow-right { color: #6c757d; font-size: 1.2rem; }


/* ── Bill area ────────────────────────────────────────────────────── */
.bill-area { padding-top: 16px; flex: 1; min-height: 0; overflow-y: auto; }

/* ── Order card ───────────────────────────────────────────────────── */
.order-card {
  cursor: pointer; border-left: 4px solid #dee2e6;
  transition: box-shadow .2s, transform .1s;
}
.order-card.open   { border-left-color: #198754; background: #f3fff9; }
.order-card.closed { border-left-color: #343a40; }
.order-card:active { transform: scale(.98); }
.order-card:hover  { box-shadow: 0 4px 16px rgba(0,0,0,.12); }

/* ── Table badge (số bàn) ─────────────────────────────────────────── */
.table-badge {
  font-size: 15px; font-weight: 700; padding: 4px 12px;
  border-radius: 6px; display: inline-block;
}
.table-badge.dinein  { background: #fff3cd; color: #7a5800; }
.table-badge.takeout { background: #d9d9d9; color: #495057; }

/* ── Amount badge (số tiền) — đi kèm table-badge ở view danh sách bill,
   cùng hình dạng nhưng màu riêng để phân biệt ──────────────────────── */
.amount-badge {
  font-size: 15px; font-weight: 700; padding: 4px 12px;
  border-radius: 6px; display: inline-block;
  background: #e7f5ec; color: #146c43;
}

/* Thông tin bill ở sidebar (detailInfo) — đồng đều với phần còn lại của
   màn chi tiết bill thay vì nhỏ hẳn theo mặc định .small của Bootstrap. */
.detail-sidebar .small { font-size: 14px; }

/* ── Detail layout ────────────────────────────────────────────────── */
.layout-detail {
  display: grid; grid-template-columns: 1fr 2fr;
  height: 100%; overflow: hidden;
}
.detail-sidebar {
  background: #fff; border-right: 1px solid #dee2e6;
  overflow-y: auto; height: 100%;
}
/* Chừa đệm dưới để nút OK/Lưu cuối trang không dính sát mép màn hình */
.detail-main { overflow-y: auto; height: 100%; padding-bottom: 48px !important; }

/* Chữ trong 2 nút đánh giá nhỏ lại, nằm giữa cỡ chữ hiện tại (btn-lg) và nút Danh sách */
#rateBox .btn-lg { font-size: 18px; }

/* Nút "Không có đánh giá": viền + chữ xám đậm, hover đảo màu nền/chữ */
.btn-no-rating {
  border: 1px solid #495057; color: #495057; background-color: transparent;
}
.btn-no-rating:hover, .btn-no-rating:focus, .btn-no-rating:active {
  background-color: #495057; color: #fff;
}

/* ── Bảng món chi tiết bill — chép từ màn order của POS (order.scss,
   _pos.scss: .content-order/.bg-selected/.row-header/.row-body/.summary) ── */
.pos-order { border: 1px solid #cecece; background: #fff; transition: box-shadow .3s; }
/* Nháy viền xanh khi bảng món vừa tự cập nhật theo thay đổi từ POS */
.pos-order.pos-updated { box-shadow: 0 0 0 3px #0288d1; }
/* Pill VN / EN đầu bill (setBillLang) */
.pos-lang-bar {
  display: flex; justify-content: flex-end; padding: .35rem .25rem;
  border-bottom: 1px solid #cecece;
}
.pos-lang-pills {
  display: inline-flex; padding: 3px; gap: 2px;
  background: #ebebeb; border-radius: 999px;
}
.pos-lang-pills button {
  border: none; background: transparent; color: #495057;
  font-weight: 600; font-size: 14px; padding: .3rem 1.1rem; border-radius: 999px;
}
.pos-lang-pills button.active { background: #0288d1; color: #fff; }
.pos-bg-selected {
  padding: .25rem; font-weight: bold;
  background: linear-gradient(180deg, #fcfcfc, #ebebeb);
  border-bottom: 1px solid #cecece;
}
.pos-row-header, .pos-item-detail {
  display: grid; grid-template-columns: 6fr 2fr 3fr;
}
.pos-row-header { box-shadow: 0 0 2px #d9d9d9; padding: .5rem .25rem; }
.pos-col-name { padding-right: 10px; white-space: pre-line; }
/* Đơn giá dưới tên món (thay cột Giá): "@ 80.000,00" */
.pos-unit-price { display: block; }
.pos-col-num { text-align: right; padding: 0 .5rem; white-space: nowrap; }
.pos-row-header .pos-col-num:last-child,
.pos-item-detail .pos-col-num:last-child { padding-right: 0; }
.pos-content-item { padding: 0 .25rem .25rem; }
.pos-row-body { box-shadow: 0 1px 3px #9e9a9a; margin: .35rem 0; background: #fff; }
.pos-item-detail {
  padding: .75rem .25rem;
  background: linear-gradient(180deg, #fcfcfc, #ebebeb);
  border-bottom: 1px solid #e4e4e4ba;
}
.pos-item-detail.item-modifier,
.pos-item-detail.item-discount { background: #f5f5f5; }
.pos-item-detail.printed { background: #ffeb3b; }
.pos-item-detail.text-waiting span { color: #12a406; }
.pos-summary {
  padding: 0 .5rem; display: flex; justify-content: flex-end;
  background: linear-gradient(180deg, #fcfcfc, #ebebeb);
  border-top: 1px solid #e4e4e4;
}
.pos-summary td { vertical-align: middle; padding: .25rem 0; }
.pos-summary td:first-child { padding-right: 1rem; }
.pos-summary tr.total td { font-size: 1.2rem; font-weight: bold; }

/* ── Stars ────────────────────────────────────────────────────────── */
/* margin: top 32px (không đổi) / bottom 64px (x2 khoảng cách cũ 32px) —
   khoảng cách riêng giữa hàng sao và nút OK bên dưới */
.stars-wrap { display: flex; justify-content: center; gap: 16px; margin: 32px 0 64px; }
.star-btn {
  font-size: 80px; color: #ddd; background: none; border: none;
  cursor: pointer; transition: color .15s; line-height: 1; padding: 0;
}
.star-btn.active, .star-btn:hover { color: #ffc107; }
/* Chọn 1-3 sao (rate xấu, xem badThreshold): sao đã chọn chuyển màu đỏ
   thay vì vàng, để báo hiệu ngay cả trước khi bấm OK */
.stars-wrap.stars-bad .star-btn.active { color: #A32D2D; }

/* ── Rate info bar ────────────────────────────────────────────────── */
.rate-info-bar {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; flex-wrap: wrap;
}
.rate-info-bar .info-chip {
  background: #f0f4ff; border: 1px solid #d0deff;
  border-radius: 20px; padding: 6px 16px;
  font-size: 14px; font-weight: 500; color: #1a3a7c;
  display: flex; align-items: center; gap: 6px;
}
.staff-serving-label {
  font-size: 12px; font-weight: 600; color: #adb5bd;
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px;
}
.rate-info-bar .info-chip.staff {
  background: #0d6efd; border-color: #0d6efd; color: #fff;
  font-size: 17px; font-weight: 700; padding: 8px 22px;
}

/* ── Fullscreen views ─────────────────────────────────────────────── */
.fullscreen-view { position: relative; }
.fullscreen-view img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center; display: block;
}
#viewThank.active, #viewSorry.active, #viewVatAsk.active { padding: 0; overflow: hidden; }
/* View hỏi VAT sau "Khách không đánh giá": không có ảnh nền làm chiều cao
   như 2 view trên, nên tự đặt chiều cao full màn hình cho overlay canh giữa */
#viewVatAsk { background: #fff2e5; }
/* Không có ảnh nền riêng cho mobile ở view thank-you nữa, dùng màu nền thay thế */
#viewThank { background: #fff2e5; }
#viewSorry { background: #fdebda; }
.close-overlay { position: fixed; top: 24px; right: 24px; z-index: 99; }

/* Ảnh sorry: scale theo đúng full chiều rộng (không crop kiểu cover), giữ
   nguyên tỉ lệ ảnh gốc (height: auto) rồi ghim đáy — phần dư ra phía trên
   (nếu ảnh theo tỉ lệ này cao hơn viewport) bị ẩn nhờ overflow:hidden của
   #viewSorry.active ở trên, không co giãn biến dạng ảnh. */
#viewSorry img {
  width: 100%; height: auto; object-fit: contain;
  position: absolute; left: 0; bottom: 0; top: auto;
}

/* ── Ảnh thank-you/sorry riêng cho ngang (tablet) và dọc (mobile) ──── */
.fullscreen-view img.img-portrait  { display: none; }
.fullscreen-view img.img-landscape { display: block; }
@media (orientation: portrait) {
  .fullscreen-view img.img-portrait  { display: block; }
  .fullscreen-view img.img-landscape { display: none; }
}

/* ── Overlay thông tin + QR đè lên ảnh thank-you: xếp dọc, canh giữa,
   giống layout của view 5 ngôi sao (viewRate) thay vì ghim góc ──────── */
.thank-overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 90px 24px 24px; overflow-y: auto; box-sizing: border-box;
}
/* flex-wrap: nowrap để số bill và số tiền luôn nằm chung 1 dòng, kể cả
   trên mobile màn hình nhỏ — tên chi nhánh và tên nhân viên mỗi cái đứng
   riêng 1 dòng (.thank-chip solo bên ngoài, không bọc trong row này) */
.thank-info-row {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; flex-wrap: nowrap; width: 100%;
}
.thank-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px solid #5e0708; border-radius: 999px;
  padding: 5px 18px; background: rgba(255,255,255,.85);
  color: #5e0708; font-size: 14px; font-weight: 600;
}
.thank-chip-staff { font-size: 18px; font-weight: 700; }
/* QR: căn giữa-giữa (mặc định canh giữa của .thank-overlay) */
.thank-qr-row { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; width: 100%; }
/* padding 8px (thay vì 12px/16px) để 2 khung QR luôn nằm chung 1 dòng,
   kể cả trên mobile màn hình nhỏ */
.thank-qr-item {
  background: #fff; border-radius: 14px; padding: 8px; min-width: 150px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
.thank-qr-item img { width: 130px; height: 130px; min-width: 130px; min-height: 130px; object-fit: contain; }
.thank-qr-item span { font-size: 13px; font-weight: 600; color: #343a40; line-height: 1.3; text-align: center; }
/* Câu cảm ơn: không nền, 2 dòng VN/EN dùng màu giống .sorry-message hiện
   tại (VN: #212529, EN: #5e0808) thay vì 1 màu đỏ đô chung như trước */
.thank-message {
  font-size: 14px; font-weight: 700; text-align: center;
  width: 100%;
}
.thank-message div + div { margin-top: 6px; }
.thank-message .thank-message-vi { color: #212529; }
.thank-message .thank-message-en { color: #5e0808; }

/* Khung overlay chứa câu xin lỗi + khối hỏi hoá đơn VAT: xếp dọc thành 1
   cột canh giữa màn hình (thay vì mỗi khối tự ghim absolute riêng) để 2 khối
   không bao giờ đè lên nhau dù màn hình thấp; overflow-y cho màn quá thấp. */
.sorry-overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 24px; padding: 90px 24px 24px; overflow-y: auto; box-sizing: border-box;
}

/* Câu xin lỗi ở view sorry: có nền trắng mờ + bo góc để đọc được rõ dù
   ảnh sorry.jpg của từng chi nhánh nền màu gì cũng không rành trước được
   (khác thank-message vốn thiết kế sẵn 1 vùng nền sáng riêng cho chữ).
   Canh giữa nhờ .sorry-overlay (flex) — chỉ khác nhau ở width: PC 30%
   viewport, tablet/mobile 80% viewport. Ngưỡng 1024px để bắt được cả tablet
   ở chiều ngang (landscape) lẫn dọc (portrait), chỉ màn hình PC/laptop mới
   còn lại ở mức 30%. */
.sorry-message {
  color: #212529; font-size: 18px; font-weight: 600; text-align: center;
  line-height: 1.5;
  background: rgba(255,255,255,.9); border-radius: 16px; padding: 20px 28px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  box-sizing: border-box;
  width: 30vw;
}
.sorry-message div + div { margin-top: 12px; }
/* Câu tiếng Anh: in nghiêng, màu riêng để phân biệt với câu tiếng Việt */
.sorry-message .sorry-en { font-style: italic; color: #5e0808; }
@media (max-width: 1024px) {
  .sorry-message { width: 80vw; }
}

/* ── Đánh giá + hoá đơn VAT ngay trong màn chi tiết bill ─────────────
   Tổng tiền nằm cuối bảng món (.pos-summary), rồi tới 5 sao/Bỏ qua/câu hỏi
   VAT — tất cả trong #detailRateArea (xem renderDetailRateArea trong app.js). */
/* Mọi nút hành động trong khu đánh giá/VAT (Có/Không, Chụp ảnh, Lưu, Ký lại,
   Sửa thông tin, OK) cùng 1 cỡ — trước đây lẫn btn-sm/btn/btn-lg nên lệch
   nhau rõ trên mobile/tablet. Nút link "Đổi lựa chọn" giữ dạng chữ. */
#detailRateArea .btn:not(.btn-link),
#detailVatInfoBtn .btn {
  height: 48px; padding: 0 1rem; white-space: nowrap;
  font-size: 18px; border-radius: .5rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
}
/* Cùng bề ngang khung VAT (420px, mobile thì full chiều ngang): nút đứng 1
   mình (Chụp ảnh, Sửa thông tin, OK) chiếm hết, 2 nút cạnh nhau (Có/Không,
   Chụp lại/Lưu, Ký lại/Lưu) chia đôi. */
#vatChoiceButtons, #btnDetailOk { width: 100%; max-width: 420px; margin-left: auto; margin-right: auto; }
/* Thẻ "Khách mua từ xa" (bill Take Out / Delivery) trên 5 sao: ô tick + tiêu
   đề; bật (.on) thì viền + nền xanh, ô tick tô xanh có dấu tick. */
.vat-remote-card {
  display: flex; align-items: center; gap: 12px; text-align: left;
  width: 100%; max-width: 420px; margin-left: auto; margin-right: auto;
  padding: 12px 14px; border-radius: 10px; cursor: pointer;
  border: 1px solid #ced4da; background: #fff; color: #212529;
}
.vat-remote-card.on { border: 2px solid #0d6efd; background: #e7f1ff; padding: 11px 13px; }
.vat-remote-box {
  width: 24px; height: 24px; flex-shrink: 0; border-radius: 6px;
  border: 2px solid #adb5bd; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px;
}
.vat-remote-card.on .vat-remote-box { background: #0d6efd; border-color: #0d6efd; }
.vat-remote-title { font-size: 17px; font-weight: 600; }
@media (max-width: 420px) { .vat-remote-title { font-size: 15px; } }
.vat-capture-card .d-flex, .vat-capture-summary .btn,
.vat-capture-card > .btn:not(.btn-link) { width: 100%; }
.vat-capture-card .d-flex > .btn,
#vatChoiceButtons > .btn { flex: 1 1 0; min-width: 0; }
@media (max-width: 420px) {
  #detailRateArea .btn:not(.btn-link),
  #detailVatInfoBtn .btn { font-size: 16px; padding: 0 .75rem; }
}
.vat-question { font-size: 17px; }
/* Câu hỏi trải nghiệm ngay trên 5 sao — cùng cỡ chữ câu hỏi VAT (.vat-question),
   sát hàng sao hơn khoảng cách mặc định của .stars-wrap. */
.rate-question + .stars-wrap { margin-top: 14px; }
/* scrollToVatCard canh đầu khung nhập VAT (câu hỏi đã ẩn khi chọn xong). */
#vatCaptureBox .vat-capture-card { scroll-margin-top: 12px; }
.vat-question .text-muted { font-size: 14px; }
.vat-capture-card {
  display: inline-flex; flex-direction: column; align-items: center; gap: 10px;
  max-width: 420px; width: 100%;
  scroll-margin-top: 12px; /* scrollToVatCard: chừa khoảng trên dòng hướng dẫn ký */
}
.vat-capture-photo {
  max-width: 100%; max-height: 280px; border-radius: 10px;
  border: 1px solid #dee2e6; object-fit: contain; background: #fff;
}
/* Tối đa 2 ảnh hoá đơn, xếp theo chiều dọc. */
.vat-photo-list { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
/* Khung pinch-zoom từng ảnh (bill.js: vatZoomApply) — ảnh phóng to chỉ trong
   phạm vi khung; chưa zoom vẫn cuộn trang bằng 1 ngón được. */
.vat-zoom { max-width: 100%; overflow: hidden; border-radius: 10px; touch-action: pan-x pan-y; }
.vat-zoom.zoomed { touch-action: none; }
/* Nút X xoá từng ảnh (form chụp/tải ảnh) — góc trên phải, nổi trên ảnh. */
.vat-photo-item { position: relative; max-width: 100%; }
.vat-photo-del {
  position: absolute; top: 6px; right: 6px; z-index: 1;
  width: 36px; height: 36px; border-radius: 50%; border: 0; padding: 0;
  background: rgba(220, 53, 69, .92); color: #fff; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.vat-zoom > .vat-capture-photo { display: block; transform-origin: center center; }
.vat-capture-summary {
  background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 12px;
  padding: 14px; display: inline-flex; flex-direction: column; align-items: center; gap: 8px;
  max-width: 420px; width: 100%;
}
/* Cột trái màn chi tiết khi bill chưa đánh giá / chưa chọn lấy hoá đơn —
   khung mờ, viền nét đứt cho đỡ trống (xem renderDetail / loadBillVatInfoButton). */
.detail-empty-info {
  border: 1px dashed #ced4da; border-radius: 12px; color: #adb5bd;
  padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  max-width: 420px; width: 100%;
}

/* Ô ký tên: to, nền trắng, viền nét đứt; touch-action none để kéo ngón tay
   vẽ chữ ký không bị trình duyệt hiểu thành cuộn trang / zoom. */
.sign-pad-wrap {
  position: relative; height: 50vh; min-height: 260px;
  border: 2px dashed #adb5bd; border-radius: 12px; background: #fff;
}
.sign-pad-wrap canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.sign-placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #ced4da; font-size: 28px; font-style: italic; pointer-events: none;
}

/* ── Staff management ─────────────────────────────────────────────── */
#staffList table code {
  background: #f1f3f5; padding: 2px 8px; border-radius: 4px; font-size: 13px;
}

/* ════════════════════════════════════════════════════════════════
   PORTRAIT — tablet dựng đứng: xếp chồng sidebar/main, thu nhỏ vừa
   chiều ngang hẹp hơn thay vì layout 2 cột kiểu landscape.
   ════════════════════════════════════════════════════════════════ */
@media (orientation: portrait) {
  /* Chi tiết đơn: bỏ layout 2 cột, xếp dọc sidebar rồi tới danh sách món,
     cuộn theo trang thay vì 2 vùng cuộn lồng nhau. */
  .layout-detail {
    grid-template-columns: 1fr;
    height: auto;
  }
  .detail-sidebar {
    height: auto; overflow: visible;
    border-right: none; border-bottom: 1px solid #dee2e6;
  }
  .detail-main { height: auto; overflow: visible; }

  /* Top bar: cho phép xuống dòng thay vì bóp méo/tràn ngang */
  .topbar {
    flex-wrap: wrap; row-gap: 8px; min-height: auto;
  }
  .topbar-stats { font-size: 12px; }
  .topbar-stats b { font-size: 13px; }

  /* Ngôi sao đánh giá: co giãn theo chiều rộng màn hình dọc — margin-bottom
     x2 (24px -> 48px) giống bản desktop, chỉ đổi khoảng cách sao-tới-nút-OK */
  .stars-wrap { gap: 4vw; margin: 24px 0 48px; }
  .star-btn { font-size: clamp(48px, 13vw, 80px); }

  .rate-info-bar .info-chip.staff { font-size: 15px; padding: 7px 18px; }
}

/* ── Table grid (sơ đồ bàn) ───────────────────────────────────────────
   Chép từ POS: ClientApp/src/app/components/pos/table/grid/style.scss +
   components/pos/style.scss (.btn-pos-floor) + styles/_pagination.scss,
   nút giả lập mat-raised-button của Angular Material. .badge của POS đổi
   tên thành .tbl-badge để không đè .badge của Bootstrap. Lưới dùng CSS
   grid thay cho col-2 của Bootstrap để đổi số cột theo bề ngang tablet
   (--tbl-cols do app.js set: 6 / 4 / 3), vẫn 7 hàng/trang như POS. */
#viewTables.active { display: flex; flex-direction: column; overflow: hidden; }
/* Font như POS chỉ cho thanh tầng + lưới bàn; header (#mainTopbar) dùng chung với
   danh sách bill nên giữ font mặc định để 2 view giống hệt nhau. */
#viewTables .floor-bar, #viewTables .tables-area { font-family: "Open Sans", Helvetica, Arial, sans-serif; }
.tables-header { background: #fff; box-shadow: 0 2px 4px #d9d9d9; position: relative; z-index: 1; }
.floor-bar { border-top: 1px solid #dee2e6; }
.floor-list { flex: 1; min-width: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* Vùng cuộn ngang (overflow) cắt mất bóng/viền dưới của nút tầng nếu cao
   vừa khít nút -> chừa đệm trong list cho bóng, bớt padding ngoài của
   .floor-bar tương ứng để tổng chiều cao thanh tầng giữ nguyên. */
#viewTables .floor-bar { padding-top: 5px !important; padding-bottom: 2px !important; }
#viewTables .floor-list { padding: 3px 3px 6px; }

.btn-pos-table, .btn-pos-floor, .btn-pagination {
  border: none; border-radius: 4px; background: #fff; color: rgba(0,0,0,.87);
  font-weight: bold; line-height: normal; cursor: pointer;
  box-shadow: 0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12);
  transition: box-shadow 280ms cubic-bezier(.4,0,.2,1);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn-pos-table:active, .btn-pos-floor:active, .btn-pagination:active {
  box-shadow: 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12);
}
.btn-pos-floor {
  flex-shrink: 0; padding: 0 .5rem; font-size: 1.2rem; height: 40px; width: 150px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.btn-pos-floor.active { background: #15bdc3; color: #fff; }

.tables-area { flex: 1; min-height: 0; background: #f3f3f3; padding: .25rem; }
.tbl-detail {
  height: 100%; position: relative; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(var(--tbl-cols, 6), minmax(0, 1fr));
  grid-auto-rows: 110px; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
/* Mỗi hàng tối thiểu 100px (ô bàn ~89px) cho dễ nhìn/dễ chạm — màn thấp
   không chứa đủ 7 hàng thì cuộn dọc thay vì bị cắt mất hàng dưới cùng. */
.tbl-detail.paged { grid-template-rows: repeat(var(--tbl-rows, 7), minmax(100px, 1fr)); grid-auto-rows: 0; }
/* Điện thoại: cũng 7 hàng/trang, giãn đều cho vừa khít màn hình; máy quá
   thấp thì mỗi hàng tối thiểu 64px và cuộn dọc. */
@media (max-width: 599.98px) {
  .tbl-detail.paged { grid-template-rows: repeat(var(--tbl-rows, 7), minmax(64px, 1fr)); }
}
.tbl-detail > li { list-style: none; margin: 0; padding: .35rem; position: relative; min-height: 0; }
.tbl-detail > li.tbl-msg { grid-column: 1 / -1; }
.tbl-detail > li.tbl-pager {
  grid-column: var(--tbl-cols, 6); display: flex; gap: 2%; /* grid-row do app.js set */
}
/* Bố cục 1 ô bàn (mọi màn hình): số bàn ở giữa, icon hóa đơn góc trên phải,
   sao góc dưới trái, badge số khách góc dưới phải. padding-bottom để số bàn
   căn giữa phần phía trên hàng sao/badge. */
.tbl-detail .btn-pos-table {
  width: 100%; height: 100%; padding: 0 4px 22px; font-size: 1.2rem; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; overflow-wrap: anywhere; /* tên bàn dài thì xuống dòng, không tràn ô */
}
/* Sao đánh giá (tableRateStars trong app.js) ở góc dưới trái, ngang hàng badge
   số khách (bàn có badge sức chứa ở góc trái thì nằm ngay sau badge đó). Sao
   vàng, phần chưa đạt là sao trắng mờ — nhìn rõ trên mọi màu nền bàn. */
.tbl-detail .tbl-stars {
  position: absolute; left: 8px; bottom: 11px;
  display: flex; gap: 2px; font-size: .95rem; line-height: 1; color: #ffc107;
  filter: drop-shadow(0 0 1px rgba(0,0,0,.45));
}
.tbl-detail .btn-pos-table:has(.tbl-badge.left) .tbl-stars { left: 38px; }
.tbl-detail .tbl-stars .off { color: rgba(255,255,255,.55); }
/* Icon hóa đơn góc trên phải (tableInfoIcon trong app.js). Không nhận chạm:
   bấm vào vẫn mở bàn. */
.tbl-detail .tbl-info {
  position: absolute; top: calc(.35rem + 4px); right: calc(.35rem + 4px); pointer-events: none;
  display: flex; align-items: center; justify-content: center; gap: 1px; border-radius: 50%;
  min-width: 28px; height: 28px; padding: 0 5px; font-size: 16px; color: #fff; background: rgba(0,0,0,.3);
}
.tbl-detail .tbl-info:has(i + i) { border-radius: 14px; }
.btn-pagination { flex: 1; height: 100%; min-height: 40px; padding: 0; font-size: 1.4rem; }
.btn-pagination:disabled { color: rgba(0,0,0,.26); box-shadow: none; background: rgba(0,0,0,.08); }

.tbl-badge {
  position: absolute; display: flex; justify-content: center; align-items: center;
  background-color: var(--bg-color); font-size: 12px; text-overflow: ellipsis;
  white-space: nowrap; overflow: hidden; border-radius: 50%;
}
.tbl-badge.custom { --bg-color: #c8c8c8; }
.tbl-badge.bottom { bottom: 5px; }
.tbl-badge.left   { left: 5px; }
.tbl-badge.right  { right: 5px; }
.tbl-badge.large  { width: 28px; height: 28px; font-size: 12px; }

/* ── Nút chuyển view duy nhất: Sơ đồ bàn ⇄ Danh sách bill ─────────────
   Cùng 1 nút, cùng vị trí trên topbar ở cả 2 view; nửa đang xem tô đậm. */
.view-switch {
  display: inline-flex; padding: 2px; border: 1px solid #0d6efd; border-radius: 20px;
  background: #fff; cursor: pointer; font-family: var(--bs-body-font-family);
  font-size: 14px; font-weight: 600; line-height: 1;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.view-switch > span { padding: 6px 12px; border-radius: 16px; color: #0d6efd; white-space: nowrap; }
#viewTables .view-switch .vs-tables,
#viewList   .view-switch .vs-bill { background: #0d6efd; color: #fff; }
/* Bàn không mở được (trống / bill Saved) — xem isTableUnopenable() trong app.js;
   chữ xám (kiểu nút disabled của Material) để nhìn là biết không bấm được. */
.tbl-detail .btn-pos-table.blocked { cursor: not-allowed; color: rgba(0,0,0,.38); }
.tbl-detail .btn-pos-table.blocked:active {
  box-shadow: 0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12);
}

/* Nút làm mới sơ đồ bàn — to hơn trên tablet/PC, cao bằng nút tầng (40px). */
@media (min-width: 600px) {
  #viewTables .btn-refresh-tables { height: 40px; min-width: 48px; font-size: 1.25rem; }
}

/* Popup chọn bill của bàn tách — PC/tablet ngang: hộp rộng, chữ + nút to
   (điện thoại giữ modal-sm như cũ). */
@media (min-width: 992px) {
  #modalTableTickets .modal-dialog { max-width: 560px; }
  #modalTableTickets .modal-header { padding: .9rem 1.25rem; }
  #modalTableTickets .modal-title { font-size: 1.5rem; }
  #modalTableTickets .modal-body { padding: 1.25rem; gap: 1rem !important; }
  #modalTableTickets .modal-body .btn { font-size: 1.75rem; padding: 1rem 1.25rem; }
  #modalTableTickets .modal-body .badge { font-size: 1.4rem; vertical-align: middle; }
}

/* ── Sơ đồ bàn trên điện thoại dọc: 3 cột ô to (xem tableGridCols), cùng bố
   cục ô như tablet/PC nhưng chữ/sao/badge/icon nhỏ hơn, lề giữa các ô hẹp.
   Chỉ áp cho màn hẹp dọc — tablet, PC và điện thoại xoay ngang giữ nguyên. */
@media (max-width: 599.98px) and (orientation: portrait) {
  .tbl-detail > li { padding: .25rem; }
  .tbl-detail .btn-pos-table { font-size: 1.3rem; font-weight: 700; line-height: 1.15; padding-bottom: 18px; }
  .tbl-detail .tbl-stars { left: 7px; bottom: 10px; gap: 0; font-size: .62rem; }
  .tbl-detail .btn-pos-table:has(.tbl-badge.left) .tbl-stars { left: 32px; }
  .tbl-detail .tbl-info {
    top: calc(.25rem + 4px); right: calc(.25rem + 4px); min-width: 24px; height: 24px; padding: 0 4px; font-size: 13px;
  }
  .tbl-badge.large { width: 24px; height: 24px; font-size: 11px; }
  .tbl-badge.bottom { bottom: 4px; }
  .tbl-badge.left   { left: 4px; }
  .tbl-badge.right  { right: 4px; }
  .btn-pos-floor { width: auto; min-width: 90px; max-width: 140px; height: 32px; font-size: 1rem; }
}

/* ── Header (#mainTopbar) — cùng 1 bố cục 2 hàng cho mọi thiết bị:
     Hàng 1: chi nhánh ........................ tên nhân viên + đăng xuất
     Hàng 2: nút Bàn/Bill + nút QR .......................... thống kê
   Bỏ khung 2 cột trong HTML (display:contents) để sắp lại thứ tự bằng order;
   ::after là phần tử ngắt hàng. Điện thoại chỉ khác lề 2 bên + nút nhỏ hơn. */
#mainTopbar { flex-wrap: wrap; align-items: center !important; column-gap: 8px; row-gap: 6px; }
#mainTopbar .tb-left, #mainTopbar .tb-right, #mainTopbar .tb-actions { display: contents !important; }
#mainTopbar .tb-branch { order: 1; white-space: nowrap; flex-shrink: 0; }
/* Chỉ tên nhân viên co lại khi thiếu chỗ: flex-basis 0 để tên dài không làm
   cả hàng rớt dòng, cắt "…"; max-width: max-content để không giãn quá. */
#mainTopbar .top-staff-name {
  order: 3; margin-left: auto; flex: 1 1 0; min-width: 0; max-width: max-content;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#mainTopbar .tb-logout { order: 4; flex-shrink: 0; }
#mainTopbar::after { content: ""; order: 5; flex-basis: 100%; height: 0; }
#mainTopbar .view-switch { order: 6; flex-shrink: 0; }
#mainTopbar .tb-qr-btn   { order: 6; flex-shrink: 0; }
#mainTopbar .topbar-stats { order: 7; margin-left: auto; flex-shrink: 0; }
@media (max-width: 599.98px) {
  #mainTopbar { padding-left: .5rem !important; padding-right: .5rem !important; }
  #mainTopbar .view-switch { font-size: 13px; }
  #mainTopbar .view-switch > span { padding: 5px 10px; }
  #mainTopbar .tb-qr-btn { height: 29px; width: 38px; font-size: 15px; }
}

/* Nút mở màn Mã QR — ngay bên phải nút Bàn/Bill, cùng chiều cao + viền xanh
   bo tròn như .view-switch để 2 nút nhìn như 1 cụm. */
.tb-qr-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 32px; width: 42px; padding: 0; border: 1px solid #0d6efd; border-radius: 20px;
  background: #fff; color: #0d6efd; font-size: 16px; line-height: 1; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.tb-qr-btn:active { background: #0d6efd; color: #fff; }

/* Màn Mã QR: 2 tab Review / Banks dạng segmented, cùng tông đỏ đô chip */
.qr-tabs {
  display: flex; width: max-content; margin-left: auto; margin-right: auto; padding: 3px; border: 1.5px solid #5e0708; border-radius: 999px;
  background: rgba(255,255,255,.85);
}
.qr-tab {
  border: 0; background: transparent; color: #5e0708; font-weight: 700; font-size: 15px;
  padding: 7px 22px; border-radius: 999px; line-height: 1;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.qr-tab.active { background: #5e0708; color: #fff; }
.qr-bank-item { min-width: 170px; max-width: 220px; gap: 4px; }
.qr-bank-item img { width: 160px; height: 160px; min-width: 160px; min-height: 160px; margin-bottom: 4px; }
.qr-bank-item .qr-bank-name   { font-size: 14px; font-weight: 700; color: #5e0708; }
.qr-bank-item .qr-bank-acc    { font-size: 15px; font-weight: 700; color: #212529; letter-spacing: .5px; }
.qr-bank-item .qr-bank-holder { font-size: 12px; font-weight: 600; color: #6c757d; text-transform: uppercase; }
.qr-bank-empty { color: #6c757d; font-weight: 600; padding: 24px 0; }
/* Điện thoại: 2 QR luôn nằm chung 1 hàng. Khung QR cố định 150px + khoảng
   cách + lề 2 bên cần ~372px, rộng hơn đa số điện thoại Android (360-393px)
   nên trước đây Google / Tripadvisor bị xếp dọc. Giờ mỗi ô chiếm tối đa nửa
   hàng và ảnh co theo ô (vuông, tối đa 130px như cũ) thay vì cố định. Áp cho
   cả màn Mã QR (review + ngân hàng) lẫn 2 QR ở màn cảm ơn. */
@media (max-width: 599.98px) {
  #viewQrCodes .qr-view-inner { width: 100%; padding-left: 12px !important; padding-right: 12px !important; }
  #qrPaneReview, #viewThank .thank-qr-row { flex-wrap: nowrap; gap: 12px; }
  #qrPaneBanks { gap: 12px; }
  #qrPaneReview .thank-qr-item,
  #viewThank .thank-qr-row .thank-qr-item,
  .qr-bank-item { flex: 0 1 calc(50% - 6px); min-width: 0; max-width: 150px; }
  #qrPaneReview .thank-qr-item img,
  #viewThank .thank-qr-row .thank-qr-item img,
  .qr-bank-item img { width: 100%; height: auto; max-width: 130px; min-width: 0; min-height: 0; aspect-ratio: 1; }
  .qr-bank-item .qr-bank-acc { font-size: 14px; letter-spacing: 0; overflow-wrap: anywhere; }
  .qr-bank-item .qr-bank-holder { overflow-wrap: anywhere; }
}

/* Loading dùng chung (showLoading/hideLoading/withLoading trong core.js) — chuyển màn, tải dữ liệu đầu, xác thực PIN...
   Phủ toàn màn hình (trên cả modal), nền mờ + làm nhoè màn phía sau; giữa là
   logo trong vòng tròn, vòng sáng màu vàng logo xoay quanh, 3 chấm nhún và chữ
   "Đang tải". Hiện lên bằng hiệu ứng mờ dần + phóng nhẹ. */
.route-loading {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 45%, rgba(255,255,255,.92) 0%, rgba(240,242,247,.88) 60%, rgba(225,229,238,.9) 100%);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: route-loading-fade .25s ease-out;
}
.route-loading.d-none { display: none !important; }
.route-loading-box {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  animation: route-loading-pop .35s cubic-bezier(.2, .9, .3, 1.2);
}
.route-loading-ring {
  position: relative; width: 132px; height: 132px; border-radius: 50%;
  background: #111; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px rgba(17, 17, 17, .25);
}
/* Vòng sáng xoay: conic-gradient vàng, khoét giữa bằng mask chỉ chừa viền 5px. */
.route-loading-ring::before {
  content: ''; position: absolute; inset: -8px; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(212,167,44,0) 0deg, rgba(212,167,44,.15) 90deg, #d4a72c 270deg, #f7dc85 350deg, rgba(212,167,44,0) 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  animation: route-loading-spin 1s linear infinite;
}
.route-loading-logo {
  width: 104px; height: auto; border-radius: 8px;
  animation: route-loading-breathe 1.6s ease-in-out infinite;
}
.route-loading-dots { display: flex; gap: 8px; }
.route-loading-dots span {
  width: 10px; height: 10px; border-radius: 50%; background: #d4a72c;
  animation: route-loading-bounce 1s ease-in-out infinite;
}
.route-loading-dots span:nth-child(2) { animation-delay: .15s; }
.route-loading-dots span:nth-child(3) { animation-delay: .3s; }
.route-loading-text { font-size: 16px; font-weight: 600; color: #343a40; letter-spacing: .3px; }
.route-loading-text i { font-weight: 400; color: #6c757d; margin-left: 4px; }
@keyframes route-loading-fade    { from { opacity: 0; } to { opacity: 1; } }
@keyframes route-loading-pop     { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }
@keyframes route-loading-spin    { to { transform: rotate(360deg); } }
@keyframes route-loading-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes route-loading-bounce  { 0%, 80%, 100% { transform: translateY(0); opacity: .45; } 40% { transform: translateY(-9px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .route-loading, .route-loading-box, .route-loading-logo, .route-loading-dots span { animation: none; }
  .route-loading-ring::before { animation-duration: 2.5s; }
}


/* Popup "Có phiên bản mới" (xem PHIÊN BẢN ở js/core.js): trên mọi thứ, kể cả
   loading dùng chung (2000) — không có nút đóng, chỉ 1 nút Tải lại. */
.update-popup {
  position: fixed; inset: 0; z-index: 2500;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(17, 24, 39, .55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  animation: route-loading-fade .2s ease-out;
}
.update-popup-card {
  width: 100%; max-width: 400px; padding: 28px 24px 24px; text-align: center;
  background: #fff; border-radius: 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
  animation: route-loading-pop .3s cubic-bezier(.2, .9, .3, 1.2);
}
.update-popup-icon {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #e7f1ff; color: #0d6efd; font-size: 32px;
}

/* ── Nút Customer / Thêm giảm giá / Xem giảm giá (components/bill-pos.js) ──
   Hàng nút ngay dưới Có / Không lấy hoá đơn, trên nút OK — kiểu nút trắng nổi
   như nút Customer / Add Discount ở màn Pay của POS. Mọi nút cùng cao 48px
   (như các nút khác của #detailRateArea), 2 nút cạnh nhau chia đôi. */
#posActionButtons { width: 100%; max-width: 420px; margin-left: auto; margin-right: auto; display: flex; flex-direction: column; gap: 8px; }
.pos-action-row { display: flex; gap: 8px; }
.pos-action-row > .btn { flex: 1 1 0; min-width: 0; }
#detailRateArea .pos-action-btn {
  background: #fff; color: #212529; border: 1px solid #ced4da;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .15);
}
#detailRateArea .pos-action-btn:hover, #detailRateArea .pos-action-btn:active { background: #f1f3f5; color: #212529; border-color: #adb5bd; }
#detailRateArea .pos-action-btn:disabled { background: #fff; color: #adb5bd; box-shadow: none; }
.pos-action-btn.has-customer { border-color: #198754 !important; color: #146c43 !important; }
.pos-action-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-toast-box { position: fixed; top: 16px; right: 16px; z-index: 2000; max-width: min(420px, calc(100vw - 32px)); }

/* Popup: nút đều nhau (cao 48px, chữ 17px), footer chia đều bề ngang */
.pos-modal .pos-btn {
  height: 48px; padding: 0 1rem; font-size: 17px; border-radius: .5rem; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
}
.pos-modal .pos-input { height: 48px; font-size: 18px; }
.pos-modal-footer { flex-wrap: nowrap; gap: 8px; }
.pos-modal-footer > .btn, .pos-btn-row > .btn { flex: 1 1 0; min-width: 0; margin: 0; }
.pos-btn-row { display: flex; gap: 8px; }
.pos-entry-row { display: flex; gap: 8px; }
.pos-entry-row .pos-input { flex: 1 1 auto; min-width: 0; }
.pos-entry-row .pos-btn { flex: 0 0 auto; min-width: 110px; }
.pos-cust-card { border: 1px solid #dee2e6; border-radius: 10px; padding: 14px 16px; background: #f8f9fa; }

/* Popup Thêm giảm giá (chỉ Coupon Program): cỡ cố định như popup Add Discount của POS (900px) */
.pos-disc-dialog { max-width: min(900px, 95vw); }
.pos-disc-body { height: min(60vh, 520px); overflow-y: auto; overflow-x: hidden; }
/* tab Coupon Program: ô nhập (nút x) | Quét QR | Áp dụng; vùng thông báo; voucher đã chọn */
.pos-coupon-entry { display: flex; gap: 8px; }
.pos-coupon-input { position: relative; flex: 1 1 auto; min-width: 0; }
.pos-coupon-input input { padding-right: 46px; font-family: Consolas, "Courier New", monospace; letter-spacing: 1px; }
.pos-coupon-actions { display: flex; gap: 8px; flex: 0 0 auto; }
/* nút chỉ icon, vuông 48px — ô nhập chiếm phần còn lại */
.pos-modal .pos-icon-btn { width: 56px; min-width: 56px; padding: 0; font-size: 22px; }
.pos-coupon-clear {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  width: 32px; height: 32px; border: 0; border-radius: 50%; background: #e9ecef; color: #495057;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.pos-coupon-clear.position-static { transform: none; background: #f8d7da; color: #842029; }
.pos-coupon-clear:hover { filter: brightness(.95); }
.pos-coupon-result { border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; word-break: break-word; }
.pos-coupon-result.ok { color: #0f5132; background: #d1e7dd; border: 1px solid #badbcc; }
.pos-coupon-result.fail { color: #842029; background: #f8d7da; border: 1px solid #f5c2c7; }
.pos-coupon-result.checking { color: #055160; background: #cff4fc; border: 1px solid #b6effb; }
.pos-coupon-selected { border: 1px solid #dee2e6; border-radius: 8px; padding: 6px 10px; }
.pos-coupon-selected-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px dashed #e9ecef; min-width: 0; }
.pos-coupon-tabs .btn { flex: 1 1 0; min-width: 0; }
/* danh sách coupon: thẻ ngang gọn (2 cột ở popup 900px, 1 cột trên điện thoại), không viền —
   tách nhau bằng bóng mờ; ảnh 16:9 bên trái (nhãn giá trị trên ảnh), thông tin bên phải */
.pos-coupon-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; padding: 4px 2px 8px; }
.pos-coupon-item {
  position: relative; display: flex; align-items: stretch; gap: 12px; width: 100%; padding: 8px; text-align: left; color: inherit;
  background: #fff; border: 0; border-radius: 12px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 3px 10px rgba(0, 0, 0, .06);
  transition: transform .12s ease, box-shadow .12s ease;
}
.pos-coupon-item:not(.disabled):active { transform: scale(.98); }
.pos-coupon-item.on { box-shadow: 0 0 0 3px #198754, 0 4px 14px rgba(25, 135, 84, .25); }
.pos-coupon-item.disabled { cursor: default; box-shadow: 0 1px 3px rgba(0, 0, 0, .06); }
.pos-coupon-item.disabled .pos-coupon-img > img, .pos-coupon-item.disabled .pos-coupon-ph { filter: grayscale(1); opacity: .55; }
.pos-coupon-item.disabled .pos-coupon-name, .pos-coupon-item.disabled .pos-coupon-code-row, .pos-coupon-item.disabled .pos-coupon-meta { opacity: .7; }
.pos-coupon-img { position: relative; flex: 0 0 136px; width: 136px; aspect-ratio: 16 / 9; align-self: center; background: #f1f3f5; border-radius: 8px; overflow: hidden; }
.pos-coupon-img > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pos-coupon-img template { display: none; }
.pos-coupon-ph {
  width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #b02a37 0%, #e8590c 100%); color: #fff;
}
.pos-coupon-ph i { font-size: 16px; opacity: .85; line-height: 1; }
.pos-coupon-ph span { font-size: 18px; font-weight: 800; line-height: 1.15; padding: 0 6px; text-align: center; word-break: break-word; }
.pos-coupon-value {
  position: absolute; left: 4px; top: 4px; max-width: calc(100% - 8px);
  background: #dc3545; color: #fff; font-weight: 700; font-size: 12px; line-height: 1.2;
  padding: 2px 7px; border-radius: 999px; box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pos-coupon-img.noimg .pos-coupon-value { display: none; }
.pos-coupon-check {
  position: absolute; right: 8px; top: 8px; width: 26px; height: 26px; border-radius: 50%;
  background: #198754; color: #fff; font-size: 16px; display: flex; align-items: center; justify-content: center;
}
.pos-coupon-info { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; gap: 4px; min-width: 0; }
.pos-coupon-item.on .pos-coupon-info { padding-right: 28px; }
.pos-coupon-name {
  font-weight: 700; font-size: 15px; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pos-coupon-code-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pos-coupon-code {
  font-family: Consolas, "Courier New", monospace; font-weight: 700; letter-spacing: 1px; font-size: 13px;
  background: #f1f3f5; color: #495057; border-radius: 5px; padding: 1px 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.pos-coupon-meta { display: flex; flex-wrap: wrap; gap: 0 10px; font-size: 12px; color: #6c757d; }
.pos-coupon-meta span { white-space: nowrap; }
.pos-coupon-reason { font-size: 12px; color: #dc3545; line-height: 1.3; }
.pos-coupon-empty { text-align: center; color: #adb5bd; padding: 32px 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pos-coupon-empty i { font-size: 40px; }
.pos-scan-area { position: relative; width: 100%; max-width: 420px; margin: 0 auto 8px; aspect-ratio: 4 / 3; background: #000; border-radius: 10px; overflow: hidden; }
.pos-scan-area video { width: 100%; height: 100%; object-fit: cover; }
.pos-scan-target { position: absolute; inset: 18%; border: 3px solid rgba(255, 255, 255, .85); border-radius: 12px; }
.pos-remove-spacer { width: 1.5em; display: inline-block; flex-shrink: 0; }
.min-w-0 { min-width: 0; }

/* Điện thoại: popup toàn màn hình (modal-fullscreen-sm-down), tab chỉ còn icon +
   chữ ngắn, ô nhập mã 1 hàng / 2 nút 1 hàng chia đôi, danh sách 1 cột */
@media (max-width: 575.98px) {
  .pos-modal .modal-body { padding: 12px; }
  .pos-disc-dialog { max-width: none; }
  #modalPosDiscount .modal-body { display: flex; flex-direction: column; }
  .pos-disc-body { height: auto; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  .pos-entry-row .pos-btn { min-width: 0; }
  .pos-modal .pos-btn { font-size: 16px; padding: 0 .6rem; }
  .pos-coupon-list { grid-template-columns: 1fr; gap: 8px; }
  .pos-coupon-img { flex-basis: 112px; width: 112px; }
  .pos-toast-box { left: 16px; right: 16px; max-width: none; }
}
