/* شاشة الكاشير بملء الشاشة: شريط علوي، أقسام، مربعات منتجات، والسلة على الجنب */
html, body { height: 100%; }
.pos { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.topbar { height: 64px; flex-shrink: 0; background: var(--nav); color: #fff; display: flex; align-items: center; gap: 18px; padding: 0 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; flex-shrink: 0; }
.brand .tlogo { width: 42px; height: 42px; border-radius: 10px; background: #fff; object-fit: contain; padding: 2px; flex-shrink: 0; }
.brand .tname { display: flex; flex-direction: column; line-height: 1.2; white-space: nowrap; }
.brand .tname span { font-size: 12px; font-weight: 400; color: var(--navMuted); }
.brand .word { font-size: 17px; letter-spacing: .5px; }
.seg { display: flex; gap: 4px; background: var(--tile); border: 1px solid var(--tileB); border-radius: 12px; padding: 4px; }
.seg button { white-space: nowrap; min-height: 36px; padding: 0 14px; border-radius: 9px; background: transparent; color: #E6DDD0; }
.seg button.on { background: var(--onDark); color: var(--nav); }
.search { flex: 1; max-width: 420px; display: flex; align-items: center; gap: 8px; background: var(--tile); border: 1px solid var(--tileB); border-radius: 12px; padding: 0 14px; height: 44px; color: var(--navMuted); }
.search input { flex: 1; background: transparent; border: 0; outline: none; color: #fff; }
.spacer { flex: 1; }
.net { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--navMuted); }
.net .dot { width: 9px; height: 9px; border-radius: 50%; background: #4ADE80; }
.net.off .dot { background: #F59E0B; }
.who { display: flex; flex-direction: column; line-height: 1.25; font-size: 13px; white-space: nowrap; }
.who span { font-size: 12px; color: var(--navMuted); }
.clock { font-weight: 700; }

.body { flex: 1; min-height: 0; display: flex; }
.menu { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; padding: 16px 20px 0; }
.cats { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 2px; flex-shrink: 0; }
.cats button { flex-shrink: 0; min-height: 52px; padding: 0 18px; border-radius: 14px; background: #fff; color: var(--ink); border: 2px solid var(--line); display: flex; align-items: center; gap: 8px; }
.cats button:hover { border-color: var(--brand); background: #fff; }
.cats button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.cats .count { font-family: var(--num); font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--salt); color: var(--ink); }
.cats button.on .count { background: var(--onDark); color: var(--nav); }

.grid { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; align-content: start; }
.tile { padding: 0; border-radius: 16px; overflow: hidden; background: #fff; color: var(--ink); border: 2px solid var(--line); text-align: start; display: flex; flex-direction: column; font-weight: 400; transition: transform .1s; }
.tile:hover { background: #fff; border-color: var(--brand); }
.tile:active { transform: scale(.98); }
.tile.in { border-color: var(--brand); }
.tile .img { position: relative; height: 118px; display: flex; align-items: center; justify-content: center; color: var(--brandInk); background-size: cover; background-position: center; }
.tile .qty { position: absolute; top: 8px; inset-inline-end: 8px; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 99px; background: var(--brand); color: var(--onBrand); font-family: var(--num); font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 3px #fff; }
.tile .info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.tile .name { font-weight: 700; line-height: 1.35; }
.tile .price { font-family: var(--num); font-weight: 700; color: var(--brandInk); }
.tile .price small { font-family: var(--font); font-size: 12px; }

.cart { width: 420px; flex-shrink: 0; background: #fff; border-inline-start: 1px solid var(--line); display: flex; flex-direction: column; }
.cart-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.cart-head .title { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.cart-head .title b { font-size: 17px; }
.cart-head .title span { font-size: 13px; color: var(--muted); }
.lines { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 18px; }
.empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); }
.line { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid #F1EBE2; }
.line .what { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.line .what b { font-size: 14px; }
.line .what span { font-size: 12px; color: var(--muted); }
.step { display: flex; align-items: center; gap: 6px; }
.step button { min-height: 36px; width: 36px; padding: 0; font-size: 18px; }
.step .num { min-width: 22px; text-align: center; font-weight: 700; }
.line .lt { width: 80px; text-align: end; font-weight: 700; }
.cart-foot { padding: 14px 18px 18px; border-top: 1px solid var(--line); background: #FCF8F2; display: flex; flex-direction: column; gap: 10px; }
.tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tools button { font-size: 13px; padding: 0; }
.sums { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.sums div { display: flex; justify-content: space-between; }
.sums .num { color: var(--ink); }
.total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 6px; border-top: 1px dashed var(--line); font-weight: 700; }
.total b { font-size: 28px; }
.pays { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pays button { min-height: 48px; }
.pays button.on { border-color: var(--brand); box-shadow: inset 0 -3px 0 var(--brand); }
.pay { min-height: 60px; border-radius: 14px; font-size: 18px; display: flex; align-items: center; justify-content: center; gap: 10px; }

.toast { pointer-events: none; position: fixed; bottom: 20px; inset-inline-start: 20px; background: var(--nav); color: #fff; padding: 12px 18px; border-radius: 12px; border-inline-start: 4px solid var(--brand); opacity: 0; transform: translateY(10px); transition: .2s; }
.toast.show { opacity: 1; transform: none; }

/* شاشات أصغر: السلة تحت */
@media (max-width: 900px) {
  .pos { height: auto; min-height: 100vh; overflow: visible; }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 14px; }
  .body { flex-direction: column; }
  .cart { width: auto; border-inline-start: 0; border-top: 1px solid var(--line); }
  .grid { overflow: visible; }
}
.cart-head #orderNo { direction: ltr; unicode-bidi: isolate; }


/* ===== شاشات الربط والـ PIN ===== */
.screen.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.card.narrow { width: min(440px, 100%); min-width: 0; }
.card.narrow input { width: 100%; min-width: 0; box-sizing: border-box; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.card h1 { margin: 0; font-size: 22px; }
.card label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.card input, dialog input, dialog select { height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; font-size: 16px; background: #fff; color: var(--ink); }
.big { font-size: 24px !important; font-weight: 700; text-align: center; }
.ltr { direction: ltr; }
.ltr-iso { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.wide { width: 100%; min-height: 52px; font-size: 17px; }
.muted { color: var(--muted); margin: 0; }
.error { color: var(--bad); min-height: 1.2em; font-size: 13px; }
.brandline { display: flex; align-items: center; gap: 10px; font-family: Inter, sans-serif; font-size: 18px; }
.brandline .mark { width: 38px; height: 38px; border-radius: 10px; background: var(--nav); color: var(--onDark); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.seg.light { background: #F4EFE7; border-color: var(--line); }
.seg.light button { color: var(--ink); }
.seg.light button.on { background: var(--brand); color: #fff; }
/* اختيار نوع الجهاز: 4 أنواع، على الموبايل بيتقسموا صفين بدل ما يخرجوا برّه الكارت */
#pairKind { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
#pairKind button { padding: 0 8px; }
.paircode { font-size: 64px; font-weight: 700; letter-spacing: 12px; text-align: center; color: var(--brand); direction: ltr; }
.tenant { display: flex; align-items: center; gap: 12px; }
.tenant img { width: 56px; height: 56px; border-radius: 12px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
.tenant b { font-size: 18px; display: block; }
.wide-card { width: min(760px, 100%); }
.users { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.user { background: #fff; color: var(--ink); border: 2px solid var(--line); border-radius: 16px; min-height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-weight: 600; }
.user:hover { background: #fff; border-color: var(--brand); }
.user .av { width: 52px; height: 52px; border-radius: 50%; background: var(--brandSoft); color: var(--nav); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; }
.pinpad { display: flex; flex-direction: column; align-items: center; gap: 12px; border-top: 1px solid var(--line); padding-top: 16px; }
.dots { display: flex; gap: 10px; direction: ltr; }
.dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--brand); }
.dots span.on { background: var(--brand); }
.keys { display: grid; grid-template-columns: repeat(3, 76px); gap: 10px; direction: ltr; }
.keys button { height: 64px; font-size: 24px; font-family: var(--num); }
.keys button.ok { background: var(--ok); }

/* ===== البيع ===== */
.brand .tlogo[hidden] { display: none; }
.net { background: transparent; border: 0; min-height: 0; padding: 0; font-weight: 400; color: var(--navMuted); }
.net:hover { background: transparent; }
.who { background: transparent; color: #fff; text-align: start; padding: 0 6px; min-height: 0; font-weight: 400; }
.who:hover { background: rgba(255,255,255,.08); }
.cart-head .sm { min-height: 36px; padding: 0 10px; font-size: 13px; }
.danger-text { color: var(--bad) !important; }
.line.sent { opacity: .75; }
.line.sent .what b::after { content: ' ✓'; color: var(--ok); }
.tile .img .initial { font-size: 40px; font-weight: 700; color: var(--nav); opacity: .55; }
.tile .tag { position: absolute; bottom: 8px; inset-inline-start: 8px; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: #fff; color: var(--brand); }
.tile .soldout { position: absolute; inset: 0; background: rgba(27,42,61,.6); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.tile.off { opacity: .7; cursor: not-allowed; }
.pay kbd { font-family: var(--num); font-size: 11px; padding: 1px 6px; border-radius: 6px; background: rgba(255,255,255,.15); }
/* بدائل شكل المربع: صورة بملء المربع، أو مضغوط للفاست فود */
.grid.full .tile .img { height: 150px; }
.grid.full .tile .info { position: absolute; bottom: 0; inset-inline: 0; background: rgba(27,42,61,.86); color: #fff; }
.grid.full .tile { position: relative; }
.grid.full .tile .price { color: var(--onDark); }
.grid.compact { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid.compact .tile { flex-direction: row; align-items: center; min-height: 64px; }
.grid.compact .tile .img { width: 52px; height: 52px; border-radius: 10px; margin: 6px; flex-shrink: 0; }
.grid.compact .tile .img .initial { font-size: 20px; }
.grid.compact .tile .tag, .grid.compact .tile .qty { display: none; }
.grid.compact .tile .info { flex-direction: row; justify-content: space-between; flex: 1; align-items: center; }

/* ===== النوافذ ===== */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, 94vw); color: var(--ink); }
dialog.wide { width: min(820px, 96vw); }
dialog::backdrop { background: rgba(27, 42, 61, .55); }
.dhead { padding: 16px 20px; border-bottom: 1px solid var(--line); font-size: 17px; }
.dbody { padding: 18px 20px; display: grid; gap: 14px; max-height: 70vh; overflow: auto; }
.dbody label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.dfoot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; background: #FCF8F2; flex-wrap: wrap; }
.dsum { flex: 1; color: var(--muted); }
.dsum b { font-size: 22px; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { min-height: 44px; padding: 0 14px; }
.chips button.on, .paymethods button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.glabel { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.paymethods { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.paymethods button { min-height: 52px; }
.payrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.payrow b { font-size: 18px; }
.paylist { display: grid; gap: 6px; }
.menu-actions { grid-template-columns: 1fr 1fr; }
.menu-actions button { min-height: 56px; }
.orow { display: grid; grid-template-columns: 110px 1fr auto auto auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.heldrow { grid-template-columns: 110px 1fr auto; background: #F6F1E8; padding: 8px 10px; border-radius: 10px; margin-bottom: 6px; border: 0; }
.preview { justify-items: center; background: #EEE7DC; }
.paper { width: 302px; height: auto; background: #fff; box-shadow: 0 2px 14px rgba(27,42,61,.15); }
.zrows { display: grid; gap: 6px; }
.toast.bad { border-inline-start-color: var(--bad); }
.toast.ok { border-inline-start-color: var(--ok); }

/* ===== خريطة الطاولات ===== */
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.ttile { aspect-ratio: 1.1; border-radius: 14px; border: 2px solid var(--line); background: #fff; color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 0; padding: 6px; }
.ttile b { font-size: 24px; }
.ttile small { font-size: 11px; color: var(--muted); }
.ttile.busy { background: var(--brand); border-color: var(--brand); color: #fff; }
.ttile.busy small { color: #E6DDD0; }
.ttile.long { background: #9A3412; border-color: #9A3412; }
.ttile.mine { outline: 3px solid var(--sand); outline-offset: 2px; }
.ttile:disabled { opacity: .35; cursor: not-allowed; }
#areaTabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ===== تقسيم الفاتورة ===== */
.splitlist { display: grid; gap: 6px; }
.splitrow { display: grid !important; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font-weight: 400 !important; }
.splitrow input[type=checkbox] { width: 20px; height: 20px; }
.splitrow input[type=number] { width: 64px; height: 38px !important; }
/* الطلبات الأونلاين */
.onbtn { position: relative; min-height: 40px; }
.onbtn.hot { background: var(--bad); color: #fff; border-color: var(--bad); animation: onpulse 1.2s infinite; }
@keyframes onpulse { 50% { opacity: .7; } }
.onbtn .badge { background: #fff; color: var(--bad); border-radius: 999px; padding: 0 7px; font-size: 13px; }
#onlineList { display: grid; gap: 10px; max-height: 70vh; overflow: auto; }
.oncard { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; background: #fff; }
.oncard.hot { border-color: var(--bad); box-shadow: 0 0 0 2px var(--bad-bg); }
.onhead { display: flex; align-items: center; gap: 8px; } .onhead .spacer { flex: 1; }
.onlines { font-size: 14px; display: grid; gap: 2px; }
.onacts { display: flex; gap: 8px; flex-wrap: wrap; }
