/* =========================================================
   Quầy thu ngân — nhanh, rõ, chạm to
   ========================================================= */
body.pos { background: var(--cream); }
.pbtn { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 12px; border: 0; background: rgba(255, 255, 255, .1); color: var(--paper); font-weight: 600; font-size: 14px; transition: background .2s; white-space: nowrap; }
.pbtn:hover { background: rgba(255, 255, 255, .18); }
.pbtn--ghost { background: transparent; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .25); }
.pbtn--sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.bill .pbtn--ghost { color: var(--ink-soft); box-shadow: inset 0 0 0 1.5px var(--line-2); }
.bill .pbtn--ghost:hover { background: var(--plaster); }
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: var(--clay); color: #fff; font-style: normal; font-size: 12px; font-weight: 700; animation: pop .4s var(--ease-out); }
@keyframes pop { 50% { transform: scale(1.3); } }

/* ---------- đăng nhập ---------- */
.login { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: var(--cocoa-3) var(--noise); }
.login[hidden] { display: none; }
.login__card { width: min(380px, 100%); padding: 34px 28px; border-radius: 28px; background: var(--paper); display: grid; gap: 14px; text-align: center; justify-items: center; box-shadow: var(--shadow-l); }
.login__ico { width: 56px; height: 56px; color: var(--clay); }
.login__title { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 34px; }
.login__card p { margin: -6px 0 6px; }
.login__input { text-align: center; font-size: 20px; letter-spacing: .2em; }
.login__back { font-size: 14px; }

/* ---------- thanh trên ---------- */
.ptop { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; min-height: 66px; padding: 10px 18px; background: var(--cocoa-3) var(--noise); color: var(--paper); }
.ptop__brand { display: flex; align-items: center; gap: 10px; }
.ptop__brand .logo__mark { width: 32px; height: 32px; --spot: var(--cocoa-3); }
.ptop__brand b { display: block; font-size: 19px; font-weight: 400; line-height: 1.1; }
.ptop__brand small { display: block; font-family: var(--f-mono); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--rattan-l); }
.ptop__stats { display: flex; gap: 22px; margin-left: 18px; padding-left: 18px; border-left: 1px solid rgba(255, 255, 255, .15); }
.ptop__stats small { display: block; font-size: 11px; color: #BFAE99; }
.ptop__stats b { display: block; font-family: var(--f-mono); font-size: 16px; }
.ptop__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.clock { font-family: var(--f-mono); font-size: 15px; color: var(--rattan-l); padding: 0 8px; }

/* ---------- bố cục ---------- */
.pmain { display: grid; grid-template-columns: minmax(0, 1fr) 430px; height: calc(100vh - 66px); height: calc(100dvh - 66px); }
.pmenu { overflow-y: auto; padding: 16px 18px 30px; }
.pmenu__tools { position: sticky; top: -16px; z-index: 5; display: grid; gap: 10px; margin: -16px -18px 14px; padding: 16px 18px 12px; background: linear-gradient(var(--cream) 85%, transparent); }
.psearch { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 16px; border-radius: 14px; background: #fff; border: 1.5px solid var(--line-2); }
.psearch:focus-within { border-color: var(--clay); box-shadow: 0 0 0 4px rgba(192, 104, 58, .14); }
.psearch svg { width: 20px; height: 20px; color: var(--ink-soft); flex: none; }
.psearch input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 16px; min-width: 0; }
.pcats { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.pcats::-webkit-scrollbar { display: none; }
.pcat { flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line-2); background: var(--paper); font-size: 13.5px; font-weight: 600; }
.pcat[aria-selected="true"] { background: var(--cocoa); border-color: var(--cocoa); color: var(--paper); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { position: relative; display: grid; grid-template-columns: 54px 1fr; gap: 8px; align-items: center; min-height: 86px; padding: 8px 10px 8px 6px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--paper); text-align: left; transition: transform .15s, border-color .2s, box-shadow .2s; }
.tile:hover { border-color: var(--cocoa); box-shadow: var(--shadow-s); }
.tile:active { transform: scale(.97); }
.tile.hit { animation: tilehit .45s var(--ease-out); }
@keyframes tilehit { 30% { background: #F7E4D3; border-color: var(--clay); } }
.tile__cup { height: 70px; display: flex; align-items: flex-end; justify-content: center; border-radius: 999px 999px 8px 8px; background: var(--plaster); }
.tile__cup .cup { width: 44px; height: 58px; margin-bottom: 2px; }
.tile__name { font-weight: 700; font-size: 13.5px; line-height: 1.3; }
.tile__price { display: block; margin-top: 3px; font-family: var(--f-mono); font-size: 13px; color: var(--clay-d); font-weight: 600; }
.tile__star { position: absolute; top: 6px; right: 8px; color: var(--gold); font-size: 12px; }
.tile__qty { position: absolute; top: -7px; left: -7px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 99px; display: grid; place-items: center; background: var(--clay); color: #fff; font-size: 12px; font-weight: 700; box-shadow: 0 0 0 3px var(--cream); }
.tiles__empty { grid-column: 1 / -1; padding: 40px; text-align: center; color: var(--ink-soft); }

/* ---------- hoá đơn ---------- */
.bill { display: flex; flex-direction: column; min-height: 0; background: var(--paper); border-left: 1px solid var(--line); }
.bill__bar { display: none; }
.bill__inner { display: flex; flex-direction: column; min-height: 0; flex: 1; padding: 16px 18px 18px; gap: 12px; overflow-y: auto; }
.bill__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.bill__kicker { margin: 0; font-family: var(--f-mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--clay-d); }
.bill__title { margin: 2px 0 0; font-family: var(--f-display); font-weight: 500; font-size: 24px; line-height: 1.15; }
.bill.from-table .bill__kicker { color: var(--leaf); }
.bill__label { min-height: 44px; padding: 10px 14px; font-size: 15px; }
.lines { flex: 1 0 auto; min-height: 170px; max-height: 46vh; overflow-y: auto; margin: 0 -18px; padding: 0 18px; border-top: 1px dashed var(--line-2); border-bottom: 1px dashed var(--line-2); }
.lines__empty { display: grid; place-items: center; gap: 8px; height: 100%; min-height: 140px; color: var(--ink-soft); text-align: center; font-size: 14px; }
.lines__empty span { width: 44px; height: 44px; color: var(--sand); }
.line { padding: 10px 0; border-bottom: 1px solid var(--line); animation: linein .35s var(--ease-out); }
@keyframes linein { from { opacity: 0; transform: translateX(16px); } }
.line__top { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.line__name { border: 0; background: none; padding: 0; text-align: left; font-weight: 700; font-size: 14.5px; line-height: 1.3; }
.line__name small { display: block; font-weight: 500; font-size: 12.5px; color: var(--ink-soft); margin-top: 1px; }
.line__name:hover small { color: var(--clay-d); text-decoration: underline; }
.line__right { display: flex; align-items: center; gap: 8px; }
.line__sum { min-width: 72px; text-align: right; font-family: var(--f-mono); font-weight: 600; font-size: 14px; }
.mini-step { display: inline-flex; align-items: center; border-radius: 10px; border: 1.5px solid var(--line-2); background: #fff; }
.mini-step button { width: 32px; height: 32px; border: 0; background: none; font-size: 18px; border-radius: 8px; }
.mini-step button:hover { background: var(--plaster); }
.mini-step output { min-width: 22px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.line__x { width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: var(--ink-soft); font-size: 18px; }
.line__x:hover { background: #F6DCCB; color: var(--clay-d); }
.line__edit { display: grid; gap: 10px; margin-top: 10px; padding: 12px; border-radius: 14px; background: var(--cream); }
.line__edit .seg .face { min-height: 40px; font-size: 13px; }
.line__edit .seg .face small { font-size: 9.5px; }
.line__edit .label { font-size: 10.5px; }
.input--sm { min-height: 40px; padding: 8px 12px; font-size: 15px; }
.sums { display: grid; gap: 8px; }
.sums__row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14.5px; }
.sums__row > span:last-child { font-family: var(--f-mono); font-weight: 600; }
.sums__row--custom .input { width: 140px; text-align: right; }
.disc { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.disc button { min-height: 32px; padding: 0 10px; border-radius: 8px; border: 1.5px solid var(--line-2); background: #fff; font-size: 12.5px; font-weight: 600; }
.disc button[aria-pressed="true"] { background: var(--cocoa); border-color: var(--cocoa); color: var(--paper); }
.sums__total { padding-top: 8px; border-top: 1.5px solid var(--cocoa); font-weight: 700; font-size: 17px; }
.sums__total > span:last-child { font-family: var(--f-display); font-size: 30px; font-weight: 500; }
.pay { display: grid; gap: 10px; }
.pay__method .face { min-height: 46px; font-size: 14.5px; }
.pay__cash { display: grid; gap: 8px; }
.pay__given { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; }
.pay__given label { font-weight: 600; font-size: 14px; }
.pay__given .input { min-height: 46px; text-align: right; font-family: var(--f-mono); font-size: 18px; font-weight: 600; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.quick button { min-height: 40px; border-radius: 10px; border: 1.5px solid var(--line-2); background: #fff; font-family: var(--f-mono); font-size: 12.5px; font-weight: 600; }
.quick button:hover { border-color: var(--cocoa); }
.change { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-radius: 12px; background: #EAF0DF; color: var(--leaf); font-weight: 600; }
.change b { font-family: var(--f-display); font-size: 26px; font-weight: 500; }
.change.short { background: #F8E1D6; color: var(--clay-d); }
.pay__transfer { display: grid; justify-items: center; gap: 8px; padding: 12px; border-radius: 14px; background: #fff; border: 1px solid var(--line); text-align: center; font-size: 13.5px; }
.pay__transfer img { width: 210px; height: 210px; object-fit: contain; }
.pay__transfer .muted { margin: 0; }
.pay__btn { min-height: 60px; font-size: 17px; }

/* ---------- ngăn kéo ---------- */
.pscrim { position: fixed; inset: 0; z-index: 48; background: rgba(42, 24, 16, .4); animation: fadein .25s; }
@keyframes fadein { from { opacity: 0; } }
.drawer { position: fixed; z-index: 50; top: 0; right: 0; bottom: 0; width: min(480px, 100%); display: flex; flex-direction: column; background: var(--cream); box-shadow: -20px 0 60px rgba(42, 24, 16, .3); animation: slidein .4s var(--ease-out); }
.drawer[hidden] { display: none; }
@keyframes slidein { from { transform: translateX(100%); } }
.drawer__head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; background: var(--cocoa-3); color: var(--paper); }
.drawer__head h2 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 24px; }
.drawer__x { width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: var(--paper); font-size: 24px; }
.drawer__body { flex: 1; overflow-y: auto; padding: 16px 16px 40px; }
.drawer__sub { margin: 24px 0 10px; font-family: var(--f-mono); font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); }
.ocard { padding: 14px; margin-bottom: 10px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-s); }
.ocard.is-new { border-color: var(--clay); box-shadow: 0 0 0 2px rgba(192, 104, 58, .25); }
.ocard__head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ocard__code { font-family: var(--f-mono); font-weight: 700; font-size: 16px; }
.ocard__table { font-weight: 700; }
.ocard__time { margin-left: auto; font-size: 12.5px; color: var(--ink-soft); }
.ocard ul { margin: 0 0 10px; padding: 0; list-style: none; font-size: 13.5px; }
.ocard li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
.ocard li small { display: block; color: var(--ink-soft); font-size: 12px; }
.ocard__note { margin: 0 0 10px; padding: 8px 10px; border-radius: 8px; background: #FFF3DF; font-size: 13px; }
.ocard__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ocard__total { margin-right: auto; font-family: var(--f-mono); font-weight: 700; }
.ocard__foot button { min-height: 36px; padding: 0 12px; border-radius: 10px; border: 1.5px solid var(--line-2); background: #fff; font-size: 13px; font-weight: 600; }
.ocard__foot button.primary { background: var(--clay); border-color: var(--clay); color: #fff; }
.ocard__foot button.on { background: var(--cocoa); border-color: var(--cocoa); color: #fff; }
.tag { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; background: var(--plaster); }
.tag--new { background: #F8E1D6; color: var(--clay-d); }
.tag--making { background: #FBEBC9; color: #8A5A14; }
.tag--served { background: #E3EBD6; color: var(--leaf); }
.tag--paid { background: var(--leaf); color: #fff; }
.tag--void { background: #eee; color: #888; text-decoration: line-through; }
.empty { padding: 26px; text-align: center; color: var(--ink-soft); border: 1.5px dashed var(--line-2); border-radius: 16px; font-size: 14px; }
.bk { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); font-size: 13.5px; }
.bk b { font-family: var(--f-mono); }
.bk button { margin-left: auto; min-height: 32px; padding: 0 10px; border-radius: 8px; border: 1.5px solid var(--line-2); background: #fff; font-size: 12.5px; font-weight: 600; }
.bk.arrived { opacity: .55; }
.hsum { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.hsum div { padding: 12px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); }
.hsum small { display: block; font-size: 11.5px; color: var(--ink-soft); }
.hsum b { font-family: var(--f-mono); font-size: 16px; }
.hsum .wide { grid-column: 1 / -1; }
.hsum .wide ol { margin: 6px 0 0; padding-left: 20px; font-size: 13px; }
.hrow { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center; padding: 12px; margin-bottom: 8px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); font-size: 13.5px; }
.hrow__code { font-family: var(--f-mono); font-weight: 700; }
.hrow__meta { color: var(--ink-soft); font-size: 12.5px; }
.hrow__total { font-family: var(--f-mono); font-weight: 700; text-align: right; }
.hrow__items { grid-column: 1 / -1; color: var(--ink-soft); font-size: 12.5px; }
.hrow__btns { grid-column: 1 / -1; display: flex; gap: 6px; }
.hrow__btns button { min-height: 32px; padding: 0 10px; border-radius: 8px; border: 1.5px solid var(--line-2); background: #fff; font-size: 12.5px; font-weight: 600; }
.hrow.void { opacity: .5; }

/* ---------- thanh toán xong ---------- */
.done { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgba(42, 24, 16, .55); backdrop-filter: blur(4px); animation: fadein .25s; }
.done[hidden] { display: none; }
.done__card { width: min(420px, 100%); max-height: 94vh; overflow-y: auto; padding: 26px 22px 22px; border-radius: 26px; background: var(--paper); text-align: center; display: grid; gap: 10px; animation: popin .45s var(--ease-out); }
@keyframes popin { from { transform: scale(.9); opacity: 0; } }
.done__check { width: 64px; height: 64px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--leaf); color: #fff; font-size: 32px; font-weight: 700; animation: pop .5s .1s var(--ease-out) both; }
.done h2 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 28px; }
.done__change { margin: 0; font-size: 16px; }
.done__change b { font-family: var(--f-display); font-size: 30px; color: var(--leaf); font-weight: 500; }
.done__receipt { margin: 6px auto; width: 100%; max-width: 300px; padding: 16px 14px; background: #fff; border: 1px solid var(--line); border-radius: 6px; text-align: left; box-shadow: var(--shadow-s); }
.done__btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* hoá đơn in nhiệt (dùng chung cho xem trước và in) */
.rc { font-family: var(--f-mono); font-size: 12px; line-height: 1.5; color: #1E1612; }
.rc .c { text-align: center; }
.rc .b { font-weight: 700; }
.rc .big { font-size: 15px; font-weight: 700; letter-spacing: .1em; }
.rc .sm { font-size: 10.5px; }
.rc .sep { border-top: 1px dashed #999; margin: 6px 0; }
.rc .row { display: flex; justify-content: space-between; gap: 8px; }
.rc .row span:last-child { white-space: nowrap; text-align: right; }
.rc .sub { padding-left: 1.5ch; font-size: 10.5px; color: #555; }
.rc .tot { font-size: 14px; font-weight: 700; }
#printArea { display: none; }

@media print {
  @page { size: 58mm auto; margin: 2mm; }
  body * { visibility: hidden !important; }
  #printArea, #printArea * { visibility: visible !important; }
  #printArea { display: block !important; position: absolute; left: 0; top: 0; width: 54mm; }
  #printArea .rc { font-size: 10.5px; color: #000; }
  #printArea .rc .sub { color: #000; }
}

/* ---------- máy tính bảng / điện thoại ---------- */
@media (max-width: 1100px) {
  .ptop__stats { display: none; }
  .pmain { grid-template-columns: minmax(0, 1fr) 380px; }
}
@media (max-width: 860px) {
  body.pos { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .ptop { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .ptop__actions { margin-left: auto; }
  .ptop__actions .clock { display: none; }
  .pbtn { min-height: 38px; padding: 0 12px; font-size: 13px; }
  .pmain { display: block; height: auto; }
  .pmenu { overflow: visible; padding: 12px; }
  .pmenu__tools { top: 58px; margin: -12px -12px 10px; padding: 12px; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .bill { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; max-height: 92vh; max-height: 92dvh; border-left: 0; border-radius: 22px 22px 0 0; box-shadow: 0 -12px 40px rgba(42, 24, 16, .25); transform: translateY(calc(100% - 70px - env(safe-area-inset-bottom))); transition: transform .5s var(--ease-out); }
  .bill.open { transform: none; }
  .bill__bar { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 70px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border: 0; background: var(--cocoa); color: var(--paper); border-radius: 22px 22px 0 0; font-size: 15px; }
  .bill.open .bill__bar { padding-bottom: 12px; }
  .bill__bar > b { margin-left: auto; font-family: var(--f-display); font-size: 22px; font-weight: 500; }
  .bill__caret { font-size: 11px; transition: transform .3s; }
  .bill.open .bill__caret { transform: rotate(180deg); }
  .bill__inner { overflow-y: auto; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .lines { flex: none; overflow: visible; }
}
@media (max-width: 560px) {
  .ptop__brand small { display: none; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile { grid-template-columns: 44px 1fr; min-height: 78px; }
  .tile__cup { height: 60px; }
  .tile__cup .cup { width: 38px; height: 50px; }
  .tile__name { font-size: 12.5px; }
  .quick { grid-template-columns: repeat(2, 1fr); }
}

/* món tạm hết */
.tile.is-out { cursor: not-allowed; opacity: .5; }
.tile.is-out .tile__cup .cup { filter: grayscale(.8); }
.tile__out { display: block; margin-top: 2px; font-size: 10.5px; font-weight: 700; color: var(--clay-d); text-transform: uppercase; letter-spacing: .04em; }
