/* POS Food Solutions — واجهة الكاشير (لمس أولًا، RTL) */
:root{--bg:#FFFFFF;--panel:#F3F1E4;--panel-2:#FFFFFF;--line:rgba(147,178,168,.55);--text:#08261F;--muted:#2A6A5D;--accent:#F08A2A;--accent-ink:#08261F;--free:#4FC08D;--busy:#F08A2A;--danger:#EC6B5E;--ok:#4FC08D;--warn:#F6C445;--radius:14px;--font:'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, 'Noto Sans Arabic', system-ui, sans-serif;--on-fill:#08261F;--ok-text:#2A6A5D;--danger-text:#EC6B5E;--info:#77A9E0;--warn-text:#08261F;color-scheme:light}
:root[data-theme="dark"]{--bg:#08261F;--panel:#0F3A32;--panel-2:#15493F;--line:#1C5146;--text:#F3F1E4;--muted:#93B2A8;--accent:#F08A2A;--accent-ink:#08261F;--free:#4FC08D;--busy:#F08A2A;--danger:#EC6B5E;--ok:#4FC08D;--warn:#F6C445;--on-fill:#08261F;--ok-text:#4FC08D;--danger-text:#EC6B5E;--info:#77A9E0;--warn-text:#F6C445;color-scheme:dark}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body, #app { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }
body { overflow: hidden; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
input { font: inherit; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }

/* ───────── أزرار عامة ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); font-weight: 600; font-size: 15px; transition: transform .06s, background .15s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: var(--on-fill); }
.btn.danger { background: transparent; border-color: color-mix(in srgb, var(--danger) 60%, transparent); color: var(--danger-text); }
.btn.ghost { background: transparent; }
.btn.lg { min-height: 60px; font-size: 18px; }
.btn.block { width: 100%; }

/* ───────── تسجيل الدخول ───────── */
.login { height: 100%; display: grid; place-items: center; background:
  radial-gradient(900px 500px at 85% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%), var(--bg); }
.login-card { width: min(380px, 92vw); text-align: center; }
.brand { display: flex; align-items: center; gap: 10px; justify-content: center; font-weight: 700; font-size: 20px; }
.brand img { width: 36px; height: 36px; }
.login h1 { font-size: 15px; font-weight: 500; color: var(--muted); margin: 8px 0 26px; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin-bottom: 22px; height: 18px; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); transition: .15s; }
.pin-dots span.on { background: var(--accent); border-color: var(--accent); }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; direction: ltr; }
.keypad button { height: 66px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); font-size: 24px; font-weight: 600; }
.keypad button:active { background: var(--panel-2); }
.keypad .muted { font-size: 15px; color: var(--muted); }
.login-hint { margin-top: 18px; color: var(--muted); font-size: 13px; }

/* ───────── الهيكل ───────── */
.shell { height: 100%; display: grid; grid-template-rows: 60px 1fr; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar .brand { font-size: 16px; margin-inline-end: 10px; }
.topbar .brand img { width: 30px; height: 30px; }
.topbar .brand small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.nav { display: flex; gap: 6px; }
.nav button { height: 42px; padding: 0 16px; border-radius: 10px; color: var(--muted); font-weight: 600; }
.nav button.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.topbar .spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.who b { color: var(--text); font-weight: 600; }
.live { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); display: inline-block; }
.live.on { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 25%, transparent); }
.main { overflow: hidden; }

/* ───────── الطاولات ───────── */
.tables-view { height: 100%; display: grid; grid-template-rows: auto 1fr; }
.tables-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 8px; flex-wrap: wrap; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 16px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.pill.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.pill .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--busy); color: var(--on-fill); font-size: 12px; display: inline-grid; place-items: center; }
.legend { margin-inline-start: auto; display: flex; gap: 14px; color: var(--muted); font-size: 13px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: middle; }
.table-grid { overflow-y: auto; padding: 8px 16px 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; align-content: start; }
.tcard { position: relative; min-height: 124px; border-radius: var(--radius); padding: 12px 14px; text-align: start; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); transition: transform .06s; }
.tcard:active { transform: scale(.97); }
.tcard .tname { font-size: 28px; font-weight: 700; line-height: 1.1; }
.tcard .seats { color: var(--muted); font-size: 12px; margin-top: 2px; }
.tcard .status { margin-top: auto; font-size: 13px; color: var(--muted); }
.tcard.free { border-color: color-mix(in srgb, var(--free) 40%, var(--line)); }
.tcard.free .status { color: var(--ok-text); }
.tcard.busy { background: color-mix(in srgb, var(--busy) 14%, var(--panel)); border-color: color-mix(in srgb, var(--busy) 65%, transparent); }
.tcard.busy .amount { font-size: 18px; font-weight: 700; margin-top: auto; }
.tcard.busy .meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 2px; }
.badge { position: absolute; top: 10px; left: 10px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--warn); color: var(--on-fill);
  font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.tcard.late .meta .elapsed { color: var(--danger-text); font-weight: 600; }

/* ───────── شاشة الطلب ───────── */
.order-view { height: 100%; display: grid; grid-template-columns: 150px 1fr 400px; }
.cats { background: var(--panel); border-inline-start: 0; border-inline-end: 1px solid var(--line); overflow-y: auto; padding: 10px 8px; display: flex; flex-direction: column; gap: 8px; }
.cat { min-height: 64px; border-radius: 12px; padding: 8px 10px; text-align: start; font-weight: 600; font-size: 14px; background: var(--panel-2);
  border-inline-start: 4px solid var(--c, var(--accent)); line-height: 1.3; }
.cat.active { background: color-mix(in srgb, var(--c, var(--accent)) 28%, var(--panel-2)); }
.menu { display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.menu-head { padding: 12px 14px 6px; display: flex; gap: 10px; align-items: center; }
.search { flex: 1; height: 46px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--text); padding: 0 14px; outline: none; }
.search:focus { border-color: var(--accent); }
.items { overflow-y: auto; padding: 6px 14px 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; align-content: start; }
.item { position: relative; min-height: 96px; border-radius: 14px; padding: 12px; text-align: start; display: flex; flex-direction: column; justify-content: space-between;
  background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--c, var(--accent)); transition: transform .06s, background .15s; }
.item:active { transform: scale(.96); background: var(--panel-2); }
.item .iname { display: block; font-weight: 600; font-size: 15px; line-height: 1.35; padding-left: 28px; }
.item .iprice { color: var(--muted); font-size: 14px; margin-top: 8px; }
.item.has-img { padding: 0; overflow: hidden; justify-content: flex-start; }
.item .ipic { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--panel-2); }
.item.has-img .iname { padding: 8px 10px 0; font-size: 14px; }
.item.has-img .iprice { padding: 0 10px 10px; margin-top: 4px; }
.item.has-img .inq { top: 6px; left: 6px; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.item .inq { position: absolute; top: 8px; left: 8px; background: var(--accent); color: var(--on-fill); border-radius: 999px; min-width: 24px; height: 24px; font-size: 13px; font-weight: 700; display: grid; place-items: center; padding: 0 6px; }
.empty { color: var(--muted); text-align: center; padding: 40px 10px; }

.ticket { background: var(--panel); border-inline-start: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.ticket > * { flex: 0 0 auto; }
.ticket > .lines { flex: 1 1 auto; min-height: 0; }
.ticket-head { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.ticket-head .title { font-size: 20px; font-weight: 700; }
.ticket-head .sub { color: var(--muted); font-size: 12px; }
.ticket-head .spacer { flex: 1; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); display: grid; place-items: center; font-size: 18px; }
.lines { overflow-y: auto; padding: 6px 0; }
.line { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 14px; border-bottom: 1px dashed var(--line); }
.line.sel { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.line .lname { font-weight: 600; }
.line .lnote { grid-column: 1 / -1; font-size: 12px; color: var(--warn-text); }
.line .lmeta { color: var(--muted); font-size: 12px; }
.line .ltotal { font-weight: 700; text-align: end; }
.line.sent .lname::after { content: '✓ مطبخ'; font-size: 11px; color: var(--ok-text); margin-inline-start: 8px; font-weight: 500; }
.line.voided { opacity: .45; }
.line.voided .lname { text-decoration: line-through; }
.line-actions { grid-column: 1 / -1; display: flex; gap: 6px; margin-top: 6px; }
.line-actions button { height: 40px; min-width: 44px; padding: 0 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); font-weight: 600; }
.line-actions .qty { min-width: 40px; display: grid; place-items: center; font-weight: 700; }
.line-actions .del { color: var(--danger-text); margin-inline-start: auto; }

.ticket-foot { border-top: 1px solid var(--line); padding: 10px 14px 14px; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px; font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.totals .grand { color: var(--text); font-size: 22px; font-weight: 700; margin-top: 4px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions .btn { white-space: nowrap; padding: 0 10px; }
.cnt { background: rgb(8 38 31 / .18); border-radius: 999px; min-width: 22px; height: 22px; padding: 0 6px; display: inline-grid; place-items: center; font-size: 13px; }
.actions .wide { grid-column: 1 / -1; }

/* ───────── قوائم الطلبات والتقارير ───────── */
.list-view { height: 100%; overflow-y: auto; padding: 16px; }
.list-view h2 { margin: 4px 0 14px; font-size: 18px; }
.row-list { display: grid; gap: 8px; max-width: 900px; }
.row { display: grid; grid-template-columns: 80px 1fr auto auto; gap: 12px; align-items: center; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; text-align: start; }
.row b { font-size: 18px; }
.row .muted { color: var(--muted); font-size: 13px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; max-width: 900px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.kpi .k { color: var(--muted); font-size: 13px; }
.kpi .v { font-size: 26px; font-weight: 700; margin-top: 6px; }
.report-table { width: 100%; max-width: 900px; border-collapse: collapse; background: var(--panel); border-radius: 12px; overflow: hidden; }
.report-table th, .report-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: start; }
.report-table th { color: var(--muted); font-weight: 500; font-size: 13px; }

/* ───────── النوافذ المنبثقة ───────── */
.overlay { position: fixed; inset: 0; background: rgb(0 0 0 / .6); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: 92vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.modal h3 { margin: 0 0 14px; font-size: 18px; display: flex; align-items: center; justify-content: space-between; }
.modal .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }
.field { width: 100%; height: 52px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); color: var(--text); padding: 0 14px; font-size: 18px; outline: none; }
.field:focus { border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { height: 40px; padding: 0 14px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-size: 14px; }

.pay-total { text-align: center; padding: 10px 0 16px; }
.pay-total .k { color: var(--muted); font-size: 13px; }
.pay-total .v { font-size: 40px; font-weight: 700; }
.pay-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.pay-methods button { height: 56px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); font-weight: 700; }
.pay-methods button.active { background: var(--accent); border-color: var(--accent); color: var(--on-fill); }
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.amount-box { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 8px; }
.amount-box.focus { border-color: var(--accent); }
.amount-box .k { color: var(--muted); font-size: 12px; }
.amount-box .v { font-size: 26px; font-weight: 700; }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.quick button { height: 44px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); font-weight: 600; }
.change { text-align: center; margin-top: 12px; font-size: 16px; }
.change b { font-size: 26px; color: var(--ok-text); }
.keypad.small button { height: 54px; font-size: 20px; }

.move-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.move-grid button { height: 64px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); font-size: 20px; font-weight: 700; }
.move-grid button:disabled { opacity: .3; }

#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; z-index: 100;
  background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: 12px; font-weight: 600; transition: .2s; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--danger); color: var(--on-fill); }

/* ───────── تابلت ───────── */
@media (max-width: 1100px) {
  .order-view { grid-template-columns: 118px 1fr 340px; }
  .items { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .topbar .brand small, .who .clock { display: none; }
}
@media (max-width: 820px) {
  .order-view { grid-template-columns: 1fr; grid-template-rows: auto 1fr 46%; }
  .cats { flex-direction: row; overflow-x: auto; border: 0; border-bottom: 1px solid var(--line); }
  .cat { min-width: 110px; min-height: 52px; }
  .menu-head { display: none; }
  .ticket { border: 0; border-top: 1px solid var(--line); }
  .nav button { padding: 0 10px; }
  .topbar .brand span { display: none; }
}

/* جرس الطلب الأونلاين */
#online-alarm { position: fixed; inset: 0; z-index: 200; background: rgb(0 0 0 / .72); display: grid; place-items: center; padding: 16px; animation: oaflash 1.1s infinite; }
@keyframes oaflash { 50% { background: rgb(119 169 224 / .55); } }
#online-alarm .oa-card { width: min(460px, 100%); background: var(--panel); border: 2px solid var(--info); border-radius: 22px; padding: 22px; text-align: center; box-shadow: 0 20px 60px rgb(0 0 0 / .5); }
#online-alarm .oa-ic { font-size: 56px; animation: oashake .5s infinite; display: inline-block; }
@keyframes oashake { 25% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } }
#online-alarm h2 { margin: 6px 0 12px; font-size: 26px; }
#online-alarm .oa-list { display: grid; gap: 8px; margin-bottom: 16px; font-size: 17px; max-height: 40vh; overflow-y: auto; }
#online-alarm .oa-list div { background: var(--panel-2); border-radius: 12px; padding: 10px 12px; }
#online-alarm .btn { width: 100%; }

/* طلب أونلاين */
.online-tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--info); color: var(--on-fill); font-size: 12px; font-weight: 700; }

/* ───────── موبايل (الكاشير المستقل على الآيفون / الكابتن على موبايل) ───────── */
@media (max-width: 600px) {
  .shell { grid-template-rows: auto 1fr; }
  .topbar { padding: 6px 8px; gap: 6px; min-height: 54px; }
  .topbar .brand, .topbar .spacer, .who b { display: none; }
  .who { gap: 8px; font-size: 13px; flex: 0 0 auto; }
  .who .btn { min-height: 38px; padding: 0 10px; }
  .nav { flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav button { flex: 0 0 auto; white-space: nowrap; }
  .tables-head { padding: 10px 10px 6px; }
  .legend { margin: 0; width: 100%; }
  .table-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); padding: 6px 10px 20px; gap: 8px; }
  .tcard { min-height: 86px; padding: 8px 10px; border-radius: 12px; }
  .tcard .tname { font-size: 22px; }
  .tcard .seats { font-size: 11px; }
  .tcard .status { font-size: 12px; }
  .tcard.busy .amount { font-size: 14px; white-space: nowrap; }
  .tcard.busy .meta { font-size: 10.5px; gap: 4px; }
  .badge { top: 6px; left: 6px; min-width: 18px; height: 18px; font-size: 11px; }
  .pill { height: 36px; padding: 0 12px; font-size: 13px; }
  .cat { min-width: 92px; min-height: 44px; font-size: 13px; }
  .items { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); padding: 6px 10px 12px; gap: 8px; }
  .item { min-height: 78px; padding: 10px; }
  .ticket-head { padding: 8px 10px; gap: 6px; }
  .ticket-head .title { font-size: 17px; }
  .icon-btn { width: 40px; height: 40px; }
  .line { padding: 8px 10px; }
  .ticket-foot { padding: 8px 10px 10px; }
  .totals { font-size: 13px; margin-bottom: 8px; gap: 2px; }
  .order-view { grid-template-rows: auto minmax(0, 1fr) 62%; }
  .actions { display: flex; flex-wrap: wrap; gap: 5px; }
  .actions .btn { flex: 1 1 0; min-width: 0; min-height: 44px; font-size: 12px; padding: 2px 4px; line-height: 1.25; gap: 3px; white-space: normal; text-align: center; }
  .actions .btn .cnt { min-width: 18px; height: 18px; font-size: 11px; }
  .actions .wide { flex-basis: 100%; min-height: 50px; font-size: 17px; }
  .cust-strip { margin: 6px 10px 0; width: calc(100% - 20px); padding: 7px 10px; font-size: 13px; }
  .row { grid-template-columns: 56px 1fr auto; }
  .row > :nth-child(4) { grid-column: 2 / -1; }
  .pay-grid { grid-template-columns: 1fr; }
  .modal { padding: 14px; border-radius: 14px; }
  .list-view { padding: 10px; }
}

/* ───────── شاشة المطبخ (KDS) ───────── */
.kds { height: 100%; display: grid; grid-template-rows: auto 1fr; }
.kds-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 8px; flex-wrap: wrap; }
.kds-stats { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kstat { padding: 6px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.kstat b { color: var(--text); font-size: 16px; margin-inline-end: 4px; }
.kstat.new b { color: var(--warn-text); }
.kstat.ready b { color: var(--ok-text); }
.kds-grid { overflow-y: auto; padding: 6px 14px 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; align-content: start; }
.kds-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 80px 10px; font-size: 20px; line-height: 1.8; }
.kds-empty small { font-size: 14px; }
.kcard { display: flex; flex-direction: column; background: var(--panel); border: 2px solid var(--line); border-radius: 16px; overflow: hidden; }
.kcard header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 12px 14px; background: var(--panel-2); }
.kcard .kwhere { font-size: 24px; font-weight: 700; line-height: 1.15; }
.kcard .kmeta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.kcard .ktime { font-size: 22px; font-weight: 700; padding: 4px 10px; border-radius: 10px; background: rgb(8 38 31 / .14); }
.kcard.ok { border-color: color-mix(in srgb, var(--ok) 55%, transparent); }
.kcard.ok header { background: color-mix(in srgb, var(--ok) 22%, var(--panel-2)); }
.kcard.warn { border-color: var(--warn); }
.kcard.warn header { background: color-mix(in srgb, var(--warn) 30%, var(--panel-2)); }
.kcard.late { border-color: var(--danger); }
.kcard.late header { background: color-mix(in srgb, var(--danger) 35%, var(--panel-2)); }
.kcard.late .ktime { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.kcard.ready { border-color: var(--ok-text); opacity: .8; }
.kcard.ready header { background: color-mix(in srgb, var(--ok) 40%, var(--panel-2)); }
.kcard.done { opacity: .6; }
.kcard.flash { animation: kflash .5s 4; }
@keyframes kflash { 50% { box-shadow: 0 0 0 6px var(--accent); } }
.kcard .knote { padding: 8px 14px; background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn-text); font-weight: 600; font-size: 14px; }
.kcard ul { list-style: none; margin: 0; padding: 6px 0; flex: 1; }
.kcard li { display: flex; gap: 12px; align-items: flex-start; padding: 9px 14px; border-bottom: 1px dashed var(--line); font-size: 18px; cursor: pointer; }
.kcard li:last-child { border-bottom: 0; }
.kcard .kq { min-width: 34px; height: 34px; border-radius: 10px; background: var(--text); color: var(--bg); font-weight: 700; display: grid; place-items: center; font-size: 18px; }
.kcard .kn { font-weight: 600; line-height: 1.35; padding-top: 3px; }
.kcard .kn small { display: block; color: var(--warn-text); font-size: 15px; font-weight: 700; margin-top: 2px; }
.kcard .kn em { font-style: normal; color: var(--danger-text); font-size: 13px; margin-inline-start: 6px; }
.kcard li.struck .kn, .kcard li.struck .kq { opacity: .35; text-decoration: line-through; }
.kcard li.void .kn { text-decoration: line-through; opacity: .55; }
.kcard footer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.kbtn { flex: 1; height: 56px; border-radius: 12px; font-size: 18px; font-weight: 700; border: 1px solid var(--line); background: var(--panel-2); }
.kbtn.ready { background: var(--ok); border-color: var(--ok); color: var(--on-fill); }
.kbtn.done { background: var(--text); color: var(--bg); border-color: var(--text); }
.kbtn.ghost { flex: 0 0 auto; padding: 0 16px; background: transparent; }
.kbtn:active { transform: scale(.97); }

/* إشعارات "جاهز" على الطاولات وشاشة الطلب */
.tbadges { position: absolute; top: 10px; left: 10px; display: flex; gap: 4px; }
.tb { height: 22px; min-width: 22px; padding: 0 7px; border-radius: 999px; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.tb.unsent { background: var(--warn); color: var(--on-fill); }
.tb.ready { background: var(--ok); color: var(--on-fill); animation: pulse 1.4s infinite; }
.tb.cook { background: var(--panel-2); color: var(--muted); }
.ready-strip { display: block; width: 100%; padding: 12px 14px; background: var(--ok); color: var(--on-fill); font-weight: 700; font-size: 15px; text-align: center; animation: pulse 1.4s infinite; }
.cook-strip { padding: 8px 14px; background: var(--panel); color: var(--muted); font-size: 13px; text-align: center; }
#toast.ready { background: var(--ok); color: var(--on-fill); font-size: 17px; padding: 14px 22px; }
@media (max-width: 820px) {
  .kds-grid { grid-template-columns: 1fr; }
  .kds-stats { margin-inline-start: 0; }
}

/* ───────── الربط بلوحة المالك ───────── */
.cloud-card { max-width: 900px; margin-bottom: 18px; }
.cloud-card:empty { display: none; }
.cc-row { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.cc-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.cc-actions { display: flex; gap: 8px; }
.cc-ok { color: var(--ok-text); font-size: 13px; margin-inline-start: 8px; }
.cc-warn { color: var(--warn-text); font-size: 13px; margin-inline-start: 8px; }
.cc-bad { color: var(--danger-text); font-size: 13px; margin-inline-start: 8px; }

/* ───────── الفوترة الإلكترونية ───────── */
.cc-alert { border-color: color-mix(in srgb, var(--danger) 60%, transparent); background: color-mix(in srgb, var(--danger) 8%, var(--panel)); }
.flabel { display: block; color: var(--muted); font-size: 13px; margin: 10px 0 4px; }
.flabel .field { margin-top: 4px; }
.li-doc { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.li-doc.credit b { color: var(--danger-text); }
.row.credit-row { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.row.credit-row span:last-child { color: var(--danger-text); }
.chip.active-chip { background: var(--accent); border-color: var(--accent); color: var(--on-fill); }

/* أنواع الخدمة (سفري / توصيل / سيارات / تطبيقات) */
.svc-row { display: flex; flex-wrap: wrap; gap: 12px; max-width: 900px; margin-bottom: 18px; }
.svc-row .btn.block { flex: 1 1 100%; }
.btn.svc { flex: 1 1 160px; height: 76px; flex-direction: column; gap: 2px; font-size: 16px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.btn.svc .svc-ic { font-size: 22px; line-height: 1; }
.svc-row .btn.block .svc-ic { margin-inline-end: 8px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-fill); }
.app-chips { margin: 4px 0 6px; }
.app-chips .chip { height: 46px; font-size: 15px; padding: 0 18px; }

/* العميل والعروض على الطلب */
.cust-strip { display: block; width: calc(100% - 24px); margin: 8px 12px 0; padding: 9px 12px; border-radius: 12px; border: 1px dashed var(--line); color: var(--muted); text-align: start; font-size: 14px; background: transparent; }
.cust-strip.has { border-style: solid; color: var(--text, #fff); background: var(--panel-2); }
.cust-res { display: grid; gap: 6px; margin-top: 6px; }
.cust-hit { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; text-align: start; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); }
.cust-hit .muted { grid-column: 1 / -1; font-size: 12px; }
.totals .promo { color: var(--ok-text); }
.totals .bad { color: var(--danger-text); font-size: 13px; }

.seg { display: grid; gap: 8px; margin: 6px 0 4px; }
.seg label { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; font-size: 15px; }
.seg input { width: 18px; height: 18px; accent-color: var(--accent); }

/* الوضع الفاتح: الملاحظات والتنبيهات الصفرا بخلفية مظللة عشان تتقري */
[data-theme="light"] .kn small, [data-theme="light"] .line .lnote, [data-theme="light"] .cc-warn { background: color-mix(in srgb, var(--warn) 40%, transparent); border-radius: 6px; padding: 1px 6px; display: inline-block; }
[data-theme="light"] .kstat.new b { background: var(--warn); border-radius: 6px; padding: 0 6px; }
.theme-btn { display: inline-grid; place-items: center; }

/* المقاسات والألوان */
.variant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; max-height: 60vh; overflow: auto; }
.variant { display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center; min-height: 64px; padding: 8px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.variant:hover, .variant:focus-visible { border-color: var(--accent); }
.variant span { color: var(--muted); font-size: 13px; }
.doc-search { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.doc-search .field { max-width: 260px; margin-bottom: 8px; }

/* ───── الكاشير المستقل (الموبايل والتابلت) ───── */
body.web-cashier { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.wc-card { max-width: 420px; width: calc(100% - 32px); }
.wc-card h1 { margin-bottom: 8px; }
.wc-p { color: var(--muted, #93B2A8); margin: 0 0 16px; line-height: 1.7; }
.wc-small { font-size: 13px; color: var(--muted, #93B2A8); margin-top: 12px; }
.wc-form { display: grid; gap: 10px; }
.wc-form input { font: inherit; font-size: 16px; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); color: inherit; width: 100%; box-sizing: border-box; }
.wc-btn { font: inherit; font-size: 17px; font-weight: 600; padding: 14px; border-radius: 12px; border: 0; background: var(--accent, #F08A2A); color: var(--on-fill, #08261F); cursor: pointer; width: 100%; }
.wc-btn:disabled { opacity: .6; }
.wc-err { color: var(--danger-text, #EC6B5E); font-size: 14px; }
.wc-list { display: grid; gap: 10px; }
.wc-branch { font: inherit; font-size: 17px; text-align: start; padding: 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); color: inherit; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.wc-branch small { color: var(--muted, #93B2A8); font-size: 13px; }
