/* SHAWARMA کھا لو POS */
:root {
  --bg: #f6f2ec; --card: #fff; --ink: #1f1b16; --muted: #6f655a; --line: #e4dcd1;
  --brand: #b3261e; --brand-ink: #fff; --accent: #f2a516; --ok: #1e7b45; --err: #b3261e; --warn: #9a6400;
  --radius: 12px; --tap: 48px;
  --urdu: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Urdu Typesetting", "Noto Naskh Arabic", serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); }
h1, h2, h3 { margin: 0 0 .6em; line-height: 1.2; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 16px; }

/* Restaurant name: Latin + Urdu mixed. unicode-bidi keeps the Urdu run correctly ordered. */
.rname { font-family: var(--urdu), system-ui, sans-serif; font-weight: 700; unicode-bidi: isolate; line-height: 2.1; }
.rname.big { font-size: 1.8rem; color: var(--brand); }

/* Top bar */
.topbar { background: var(--ink); color: #fff; display: flex; align-items: center; gap: 12px; padding: 4px 16px; flex-wrap: wrap; }
.brand { color: var(--accent); text-decoration: none; font-size: 1.15rem; }
.topbar nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.topbar nav a, .linkish { color: #fff; text-decoration: none; padding: 10px 12px; border-radius: 8px; background: none; border: 0; font: inherit; cursor: pointer; }
.topbar nav a.active, .topbar nav a:hover, .linkish:hover { background: rgba(255,255,255,.12); }
.menu-toggle { display: none; margin-left: auto; background: none; color: #fff; border: 0; font-size: 1.5rem; min-height: var(--tap); min-width: var(--tap); }
@media (max-width: 760px) {
  .menu-toggle { display: block; }
  .topbar nav { display: none; width: 100%; flex-direction: column; align-items: stretch; margin: 0 0 8px; }
  .nav-open .topbar nav { display: flex; }
}

/* Cards, forms, buttons */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card.narrow { max-width: 480px; }
.empty { text-align: center; padding: 24px 8px; color: var(--muted); }
label { display: block; margin: 0 0 12px; font-weight: 600; font-size: .95rem; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; min-height: var(--tap); font: inherit; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
label.check input { width: auto; min-height: 0; margin: 0; transform: scale(1.3); }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 12px; padding: 12px; }
legend { font-weight: 700; padding: 0 4px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; touch-action: manipulation; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.danger { color: var(--err); }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: .9rem; }
.btn.block { width: 100%; }
.btn.xl { min-height: 60px; font-size: 1.15rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
form.inline { display: inline; }
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; font-weight: 600; }
.flash.ok { background: #e3f4ea; color: var(--ok); }
.flash.err { background: #fbe4e2; color: var(--err); }
.flash.warn { background: #fff3d6; color: var(--warn); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; }
.num { text-align: right; white-space: nowrap; }
tr.inactive td { color: var(--muted); }
.strike { text-decoration: line-through; color: var(--muted); }
td.actions { white-space: nowrap; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.grid-2 > * { min-width: 0; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; } }
.filters { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; }
.filters label { margin: 0; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 12px; }
.var-row { display: grid; grid-template-columns: 1fr 110px 70px auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.var-row input { margin: 0; }
.var-row label.check { margin: 0; }
.var-row input { min-width: 0; }
@media (max-width: 480px) { .var-row { grid-template-columns: minmax(0,1fr) minmax(0,1fr); padding-bottom: 8px; border-bottom: 1px dashed var(--line); } }

/* Dashboard */
.dash-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 4px; }
.big-num { font-size: 1.7rem; font-weight: 800; }
.checks { list-style: none; padding: 0; }
.checks li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.checks li.ok span { color: var(--ok); } .checks li.bad span { color: var(--err); }

/* Login */
.login-card { max-width: 400px; margin: 40px auto; text-align: center; }
.login-card form { text-align: left; }

/* POS order screen */
.pos-page .wrap { max-width: 1400px; }
.pos { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.menu-pane, .cart-pane { min-width: 0; }
@media (min-width: 900px) { .pos { grid-template-columns: minmax(0, 1fr) 400px; align-items: start; } .cart-pane { position: sticky; top: 12px; } }
.cat-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; scrollbar-width: thin; }
.tab { flex: 0 0 auto; min-height: var(--tap); padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.prod-grid, .var-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.prod { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; min-height: 92px; padding: 12px; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; font: inherit; text-align: left; cursor: pointer; touch-action: manipulation; }
.prod:active { transform: scale(.98); background: #fff7e6; }
.pname { font-weight: 700; } .pprice { color: var(--brand); font-weight: 700; }
.cart-head { display: flex; justify-content: space-between; align-items: center; }
.cart-lines { max-height: 45vh; overflow-y: auto; margin-bottom: 12px; }
.cline { display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cinfo { grid-column: 1 / -1; }
.qty { display: flex; gap: 4px; align-items: center; }
.qty input { width: 60px; min-height: 38px; margin: 0; text-align: center; padding: 4px; }
.cright { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.seg label { margin: 0; position: relative; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label { display: flex; align-items: center; justify-content: center; min-height: var(--tap); cursor: pointer; font-weight: 700; }
.seg label:has(input:checked) { background: var(--ink); color: #fff; }
.cust { margin-bottom: 12px; } .cust summary { cursor: pointer; padding: 8px 0; font-weight: 700; }
.delivery-only { display: none; }
.is-delivery .delivery-only { display: block; }
dl.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0 0 12px; }
dl.totals dd { margin: 0; text-align: right; font-weight: 600; }
.is-delivery dl.totals .delivery-only { display: block; }
dl.totals .grand { font-size: 1.35rem; font-weight: 800; }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet[hidden] { display: none; }
.sheet-body { width: 100%; max-width: 560px; margin: 0; border-radius: 16px 16px 0 0; }
.sheet-body .var-grid { margin-bottom: 12px; }
@media (min-width: 700px) { .sheet { align-items: center; } .sheet-body { border-radius: 16px; } }

/* Receipt (screen preview) */
.invoice-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 16px; }
.receipt { --paper: 58mm; width: var(--paper); max-width: 100%; margin: 0 auto; background: #fff; color: #000; padding: 3mm; font: 12px/1.35 "Courier New", ui-monospace, monospace; box-shadow: 0 2px 12px rgba(0,0,0,.12); }
.receipt .r-head { text-align: center; border-bottom: 1px dashed #000; padding-bottom: 2mm; margin-bottom: 2mm; }
.receipt-name { display: block; font-size: 20px; line-height: 2.2; color: #000; word-break: break-word; }
.r-meta div, .r-totals div { display: flex; justify-content: space-between; gap: 4px; }
.r-meta .addr { display: block; }
.r-meta { border-bottom: 1px dashed #000; padding-bottom: 2mm; margin-bottom: 1mm; }
.r-items { width: 100%; border-collapse: collapse; font-size: 12px; }
.r-items th, .r-items td { padding: 1mm 0; border-bottom: 1px dotted #000; color: #000; }
.r-items th { font-size: 11px; }
.r-items td.num, .r-items th.num { padding-left: 2mm; }
.r-items .each { font-size: 10px; }
.r-totals { padding-top: 1mm; }
.r-totals .grand { font-size: 15px; font-weight: 800; border-top: 1px solid #000; border-bottom: 1px solid #000; padding: 1mm 0; margin-top: 1mm; }
.r-foot { text-align: center; margin-top: 3mm; font-family: var(--urdu), "Courier New", monospace; line-height: 2; }
/* Feed: blank space ending in a tiny dot, so printer drivers that trim white space still feed the paper out */
.r-feed { display: none; }

/* Printing: only the receipt, black on white, sized for the receipt paper */
@media print {
  body { background: #fff; margin: 0; }
  .no-print, .topbar, .flash, .invoice-actions { display: none !important; }
  .wrap { padding: 0; max-width: none; }
  /* zoom shrinks/enlarges the text; width is divided by it so the printed width stays exactly --paper */
  .receipt { box-shadow: none; margin: 0 0 0 calc(var(--offset, 0mm) / var(--zoom, 1)); zoom: var(--zoom, 1); width: calc(var(--paper) / var(--zoom, 1)); max-width: none; padding: 0; }
  /* Thermal printers render thin strokes faintly: print every receipt line bold and dark */
  .receipt, .receipt * { font-weight: 700 !important; color: #000 !important; }
  .receipt { -webkit-font-smoothing: none; }
  .r-items .each, .r-items small { font-size: 11px; }
  .r-items th, .r-items td { border-bottom-style: dashed; }
  .r-feed { display: block; height: calc(var(--feed, 20mm) / var(--zoom, 1)); font-size: 6px; line-height: 1; color: #000; text-align: center; display: flex; align-items: flex-end; justify-content: center; }
  .r-meta div, .r-totals div { gap: 2px; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
