/* The app carries its own Arabic face instead of borrowing the phone's. IBM Plex Sans Arabic is
   cleaner and more even than the system Arabic fonts, its ٥ and ٠ stay distinct at small sizes, and
   it ships with the app so every phone renders the same thing. */
@font-face{font-family:"Plex Arabic";font-style:normal;font-weight:400;font-display:swap;src:url("/fonts/plex-ar-arabic-400.woff2") format("woff2")}
@font-face{font-family:"Plex Arabic";font-style:normal;font-weight:500;font-display:swap;src:url("/fonts/plex-ar-arabic-500.woff2") format("woff2")}
@font-face{font-family:"Plex Arabic";font-style:normal;font-weight:600;font-display:swap;src:url("/fonts/plex-ar-arabic-600.woff2") format("woff2")}
@font-face{font-family:"Plex Arabic";font-style:normal;font-weight:700;font-display:swap;src:url("/fonts/plex-ar-arabic-700.woff2") format("woff2")}
@font-face{font-family:"Plex Arabic";font-style:normal;font-weight:400;font-display:swap;src:url("/fonts/plex-ar-latin-400.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Plex Arabic";font-style:normal;font-weight:500;font-display:swap;src:url("/fonts/plex-ar-latin-500.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Plex Arabic";font-style:normal;font-weight:600;font-display:swap;src:url("/fonts/plex-ar-latin-600.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Plex Arabic";font-style:normal;font-weight:700;font-display:swap;src:url("/fonts/plex-ar-latin-700.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
/* colours: public/theme.css owns every one of them */
*{box-sizing:border-box}html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--white);font-family:"Plex Arabic",system-ui,-apple-system,"Segoe UI",Tahoma,"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif;font-weight:400;letter-spacing:normal;max-width:520px;margin-inline:auto;min-height:100vh;padding-bottom:calc(104px + env(safe-area-inset-bottom,0px))}
/* with the cart bar on screen the page must clear the nav AND the bar */
body.has-cart{padding-bottom:calc(168px + env(safe-area-inset-bottom,0px))}
body.wide{max-width:980px}
header{display:flex;align-items:center;justify-content:space-between;padding:14px 16px 6px;gap:8px}
.logo{font-weight:800;font-size:22px}.logo i{color:var(--pink);font-style:normal}
.pill{background:var(--s2);border-radius:20px;padding:6px 12px;font-size:13px;cursor:pointer;border:0;color:var(--white);font-weight:600}
h2{font-size:18px;margin:16px 16px 8px}h3{margin:6px 0}
.card{background:var(--cream);color:var(--ink);border-radius:16px;padding:14px;margin:10px 16px;border:1px solid var(--creamb)}
.hero{background:linear-gradient(135deg,var(--deep),var(--deep2));border-radius:20px;margin:8px 16px;padding:18px}
.hero small{color:var(--tint);line-height:1.6}.hero b{display:block;font-size:32px;margin:4px 0;font-weight:800}
.row{display:flex;align-items:center;gap:12px;justify-content:space-between}
.emoji{font-size:28px;width:46px;height:46px;border-radius:12px;background:var(--white);display:flex;align-items:center;justify-content:center;flex:none;overflow:hidden}
.emoji img{width:100%;height:100%;object-fit:cover}
.grow{flex:1;min-width:0}.sub{font-size:13.5px;color:var(--ink2)}.tag{display:inline-block;background:var(--red);color:var(--white);border-radius:10px;padding:2px 8px;font-size:12px;font-weight:700;white-space:nowrap;letter-spacing:normal}
.btn{background:var(--red);color:var(--white);border:0;border-radius:14px;padding:12px 18px;font-size:16px;font-weight:800;width:100%;cursor:pointer;font-family:inherit}
.btn.sm{width:auto;padding:7px 14px;font-size:14px;border-radius:10px}.btn.alt{background:var(--s3)}.btn.ghost{background:transparent;border:1px solid var(--s3);color:var(--white)}.btn:disabled{opacity:.4;cursor:default}
input[type=file]{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}
.filebtn{display:inline-flex;align-items:center;justify-content:center;gap:6px;background:var(--s3);color:var(--white);border-radius:12px;padding:9px 14px;font-size:14px;font-weight:700;cursor:pointer;white-space:nowrap;border:1px solid var(--div)}
.rxrow{display:flex;align-items:center;gap:10px;margin-top:10px;padding-top:10px;border-top:1px solid var(--creamb)}
.rxrow .grow{font-size:14px;line-height:1.5}
.rxblock{margin-top:4px}
.rxblock .hint{margin:8px 0 0}
.qty{display:flex;align-items:center;gap:10px}.qty button{width:34px;height:34px;border-radius:10px;border:0;background:var(--red);color:var(--white);font-size:18px;cursor:pointer}
.qty button.off{background:var(--creamb);color:var(--ink2)}
nav.tabs{position:fixed;bottom:0;left:0;right:0;max-width:520px;margin:auto;background:var(--s1);display:flex;border-top:1px solid var(--s3);z-index:20}
body.wide nav.tabs{position:static;max-width:none;flex-wrap:wrap;border:0;background:none;padding:0 16px;gap:8px}
nav.tabs a{flex:1 1 auto;text-align:center;padding:10px 6px 12px;color:var(--mut);text-decoration:none;font-size:12.5px;white-space:nowrap}nav.tabs a.on{color:var(--pink);font-weight:700}nav.tabs span{display:block;font-size:20px}
body.wide nav.tabs a{flex:none;background:var(--s2);border-radius:16px;padding:7px 14px}body.wide nav.tabs a.on{background:var(--red);color:var(--white)}
.chips{display:flex;gap:8px;overflow-x:auto;padding:0 16px 4px}.chip{background:var(--s2);border-radius:16px;padding:6px 12px;white-space:nowrap;font-size:14px;cursor:pointer;color:var(--white);border:0;font-family:inherit}.chip.on{background:var(--red)}
.tot{display:flex;justify-content:space-between;gap:8px;padding:4px 0}.tot.b{font-weight:800;font-size:18px;border-top:1px dashed var(--c50);margin-top:6px;padding-top:8px}.green{color:var(--cash);font-weight:700}   /* cashback and delivery saving: light mint, reads on the dark card */
input,select,textarea{width:100%;padding:12px;border-radius:12px;border:1px solid var(--creamb);background:var(--white);color:var(--ink);font-size:16px;margin:6px 0;font-family:inherit}
input[type=checkbox]{width:22px;height:22px;accent-color:var(--red);margin:0}
.search{margin:8px 16px;width:calc(100% - 32px);background:var(--s1);color:var(--white);border:1px solid var(--s3)}
label.sw{display:flex;gap:10px;align-items:center;font-weight:700}
table{width:100%;border-collapse:collapse;font-size:13px;table-layout:auto}td,th{padding:6px 4px;text-align:start;border-bottom:1px solid var(--creamb);word-break:break-word;overflow-wrap:anywhere}th{color:var(--ink2);font-size:12px;font-weight:700;padding-bottom:7px}
.card{overflow-x:auto}body.wide main{overflow-x:hidden}
.ok{color:var(--cash);font-weight:800}.bad{color:var(--c79);font-weight:800}.warn{color:var(--c70);font-weight:700}
.toast{position:fixed;top:12px;left:12px;right:12px;max-width:496px;margin:auto;background:linear-gradient(90deg,var(--red),var(--pink));padding:12px 14px;border-radius:14px;font-weight:700;z-index:99}
.cartbar{position:fixed;bottom:calc(86px + env(safe-area-inset-bottom,0px));left:12px;right:12px;max-width:496px;margin:auto;background:var(--red);border-radius:16px;padding:12px 16px;display:flex;justify-content:space-between;align-items:center;font-weight:800;cursor:pointer;z-index:19;box-shadow:0 6px 20px var(--shadow)}
.drawer-bg{position:fixed;inset:0;background:var(--scrim);z-index:30}.drawer{position:fixed;bottom:0;left:0;right:0;max-width:520px;margin:auto;background:var(--bg);border-radius:22px 22px 0 0;max-height:92vh;overflow:auto;z-index:31;padding-bottom:20px;border-top:2px solid var(--red)}
.drawer .card{margin:10px 12px}.grab{width:44px;height:5px;background:var(--div);border-radius:3px;margin:10px auto}
.admin-bar{display:flex;gap:8px;flex-wrap:wrap;align-items:end;padding:0 16px}.admin-bar label{font-size:12px;color:var(--mut);display:block}.admin-bar input,.admin-bar select{width:auto;margin:2px 0;padding:8px}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:0 12px}@media(max-width:600px){.grid2{grid-template-columns:1fr}}
.st-placed,.st-preparing{color:var(--c70)}.st-ready{color:var(--c49)}.st-delivered{color:var(--cash)}.st-cancelled{color:var(--c39)}
.hint{font-size:12.5px;color:var(--mut);margin:4px 16px}
@media print{body{background:var(--white);color:var(--black);max-width:none;padding:0}nav.tabs,header .pill,.admin-bar,.btn,.no-print,.cartbar{display:none!important}.card{border:1px solid var(--c38);margin:6px 0;background:var(--white);color:var(--black)}h2{color:var(--black)}.hero{background:var(--white);color:var(--black);border:1px solid var(--c38)}}

.tot>span:last-child{white-space:nowrap}
.tot>span:first-child{min-width:0}
.nm{display:block;line-height:1.45;font-weight:700;font-size:16px}
.nm-size{display:inline-block;font-size:12px;font-weight:600;color:var(--ink2);line-height:1.6;margin-top:1px}
.nm-en{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;font-size:12px;color:var(--ink2);direction:ltr;unicode-bidi:isolate;text-align:start;margin-top:2px;line-height:1.4;overflow-wrap:anywhere;text-overflow:ellipsis}

.tot{font-weight:400}
.tot.b,.tot b{font-weight:800}
.tot.green>span:last-child{font-weight:900}
.tot>span:last-child{font-weight:700}
.tot.b>span:last-child,.tot.green>span:last-child{font-weight:inherit}
/* the price is the second thing a customer looks for after the photo, so it carries its own weight */
.sub b,.sub strong{font-weight:700;font-size:15px;white-space:nowrap}
.chat-msg{line-height:1.7}
.logo{letter-spacing:-.2px}

.aicard{margin-bottom:10px}
.aitext{font-size:15px;font-weight:600;line-height:1.7;margin:6px 0 8px}
.desc{font-size:12px;color:var(--c30);margin-top:2px}
.storemeta{margin:2px 6px 8px;line-height:1.7;word-break:break-word}
.readback{border:1px solid var(--c22)}
.sectstrip{overflow-x:auto;flex-wrap:nowrap;-webkit-overflow-scrolling:touch}
.sectstrip .chip{white-space:nowrap}
.note{color:var(--c52)}
/* invoice line: name on the right, price on the left, cashback under the name */
.itrow{display:flex;align-items:flex-start;gap:10px;padding:6px 0;border-bottom:1px solid var(--c84)}
.itrow:last-of-type{border-bottom:0}
.itrow .grow{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.iname{font-size:13.5px;line-height:1.45}
.iprice{font-size:15px;font-weight:700;white-space:nowrap;font-feature-settings:"tnum"}
.cbline{font-size:11.5px;color:var(--cash-ink);font-weight:600;white-space:nowrap}
/* never let a price or a tag be squeezed out of its card: the label shrinks, the number keeps its width */
.row>b,.row>.grow{min-width:0}
.row>span,.row>.p-tag,.row>.tag{flex:none}
.iprice,.itrow .iprice{flex:none}
/* Money digits must be readable at card size: ٥ is an open circle and ٠ a small dot, and at 12px the
   two collapse into the same shape. Every amount is set in a font that keeps them apart, one size up,
   and tabular so a column of prices lines up. */
.iprice,.tot>span:last-child,.tot b,.p-bal,.hero b,.cbline{
  font-family:"Plex Arabic",system-ui,"Segoe UI",Tahoma,"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif;
  font-variant-numeric:tabular-nums;font-feature-settings:"tnum";
}
.iprice{font-size:15px}
.tot>span:last-child{font-size:14px;font-weight:700}
.cbline{font-size:12.5px}
/* colours and sizes must not look like the same control: a colour is a pill with a swatch, a size is a
   square chip, and a size with no stock is visibly dead and cannot be picked. */
.chiprow{display:flex;align-items:flex-start;gap:6px;flex-wrap:nowrap;padding:6px 2px}
.chiplabel{font-size:11px;color:var(--ink2);flex:0 0 auto;min-width:34px;padding-top:6px;white-space:nowrap}
.chiprow .sizes{display:flex;gap:6px;flex-wrap:wrap;flex:1 1 auto;min-width:0}
.chip.col{border-radius:999px;padding:5px 10px;display:inline-flex;align-items:center;gap:6px;font-size:12px}
.chip.sz{border-radius:9px;min-width:42px;padding:6px 8px;font-size:12.5px;font-weight:600;justify-content:center}
.chip.sz.off{opacity:.38;text-decoration:line-through;cursor:not-allowed}
.chip.col .swatch{width:13px;height:13px;border-radius:50%;border:1px solid var(--c86);display:inline-block;background:var(--c29)}
.chip.col .swatch[data-c="أسود"]{background:var(--c1)}
.chip.col .swatch[data-c="أبيض"]{background:var(--c71)}
.chip.col .swatch[data-c="بيج"]{background:var(--c67)}
.chip.col .swatch[data-c="بني"]{background:var(--c23)}
.chip.col .swatch[data-c="بني فاتح"]{background:var(--c41)}
.chip.col .swatch[data-c="رمادي"]{background:var(--c31)}
.chip.col .swatch[data-c="انثراسايت"]{background:var(--c18)}
.chip.col .swatch[data-c="كحلي"]{background:var(--c11)}
.chip.col .swatch[data-c="أزرق"]{background:var(--c14)}
.chip.col .swatch[data-c="أزرق فاتح"]{background:var(--c27)}
.chip.col .swatch[data-c="أحمر"]{background:var(--c48)}
.chip.col .swatch[data-c="أخضر"]{background:var(--c15)}
.chip.col .swatch[data-c="أصفر"]{background:var(--c66)}
.chip.col .swatch[data-c="وردي"]{background:var(--c65)}
.chip.col .swatch[data-c="بنفسجي"]{background:var(--c24)}
.chip.col .swatch[data-c="ذهبي"]{background:var(--c53)}
.chip.col .swatch[data-c="فضي"]{background:var(--c51)}

/* Merchant portal tables on a phone: eight columns squeezed into 390px used to break every
   header and cell into one letter per line. Keep the cells whole and let the card scroll. */
@media (max-width:640px){
  body.wide #app .card{overflow-x:auto;-webkit-overflow-scrolling:touch}
  body.wide #app table{min-width:600px}
  body.wide #app th,body.wide #app td{white-space:nowrap;vertical-align:middle}
  body.wide #app td:nth-child(2),body.wide #app th:nth-child(2){white-space:normal;min-width:150px}
}
@media (max-width:640px){
  /* the sections table only carries five narrow columns; it fits without a sideways scroll,
     so its checkbox and reorder arrows stay visible instead of hiding off-screen. */
  body.wide #app table.secs{min-width:0;width:100%}
  body.wide #app table.secs td:first-child{min-width:0}
  body.wide #app table.secs input[type=text],
  body.wide #app table.secs td:first-child input{max-width:104px;width:100%}
}
@media (max-width:640px){
  body.wide #app table.secs th,
  body.wide #app table.secs td{white-space:normal;padding:6px 4px}
  body.wide #app table.secs td:first-child input{max-width:96px;width:100%}
  body.wide #app table.secs .btn.sm{padding:4px 6px;font-size:12px}
}
@media (max-width:640px){
  body.wide #app table.secs{font-size:12px;table-layout:fixed}
  body.wide #app table.secs th{font-size:11px;white-space:nowrap;padding:6px 2px}
  body.wide #app table.secs td{padding:6px 2px}
  body.wide #app table.secs td:first-child input{max-width:112px;width:100%;padding:6px 6px}
  body.wide #app table.secs th:nth-child(1),body.wide #app table.secs td:nth-child(1){width:34%}
  body.wide #app table.secs th:nth-child(2),body.wide #app table.secs td:nth-child(2){width:20%}
  body.wide #app table.secs th:nth-child(3),body.wide #app table.secs td:nth-child(3){width:14%}
  body.wide #app table.secs th:nth-child(4),body.wide #app table.secs td:nth-child(4){width:18%}
  body.wide #app table.secs th:nth-child(5),body.wide #app table.secs td:nth-child(5){width:14%}
}
@media (max-width:640px){
  body.wide #app table.secs th{white-space:normal;font-size:10.5px;line-height:1.2;overflow-wrap:break-word}
}
@media (max-width:640px){
  /* the master catalog browser: drop the category column so the add button lands on screen,
     and keep every product name to two lines so rows stay scannable */
  body.wide #app table.cat{min-width:0;width:100%}
  body.wide #app table.cat th:nth-child(3),body.wide #app table.cat td:nth-child(3){display:none}
  body.wide #app table.cat td:nth-child(2){min-width:0}
  body.wide #app td .nm{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
  body.wide #app td .nm-en{-webkit-line-clamp:1}
}
/* money on an order card: a label must never be split from its amount, so each figure is one unit
   and the row wraps between figures instead of inside them. */
.tot{display:flex;flex-wrap:wrap;gap:4px 12px}
.tot span{white-space:nowrap}

/* The consultation entry on the home screen: one line, a door, not another dashboard. */
.p-consult{display:flex;gap:12px;align-items:center;background:var(--cream);color:var(--ink);border-radius:16px;padding:12px 14px;margin:12px 0;text-decoration:none}
.p-consult>div:first-child{font-size:26px;line-height:1}
.p-consult b{display:block;font-size:15.5px}
.p-consult span{display:block;font-size:12.5px;color:var(--ink2);margin-top:2px;line-height:1.5}

/* three small summary cards above the doctor's desk, and the number inside them */
.cards3{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:10px;margin:10px 0}
.cards3 .card{margin:0;text-align:center}
.big{font-size:26px;font-weight:700;color:var(--maroon,var(--c22));letter-spacing:.3px;margin:2px 0}

/* a basket from more than one store: each store keeps its own heading and subtotal inside the one invoice */
.storegroup{border-bottom:1px dashed var(--line,var(--c68));padding-bottom:6px;margin-bottom:6px}
.storegroup:last-child{border-bottom:0;margin-bottom:0;padding-bottom:0}
.storehead{display:flex;justify-content:space-between;align-items:center;gap:8px;font-weight:600;font-size:13.5px;color:var(--maroon,var(--c22));padding:4px 0}
.storehead .sub{font-weight:400;font-size:12px}
/* A lab sells a test: a booking button, and a price the lab itself calls approximate. */
.card.srv .btn.book{width:auto;padding:9px 16px;border-radius:12px;flex:none}
.card.srv .btn.book.on{background:var(--s3);color:var(--ink)}
.appr{font-size:11.5px;color:var(--ink2);border:1px solid var(--s3);border-radius:8px;padding:1px 6px;margin-inline-start:4px}
.card.labbook .chiprow{margin-top:6px}
/* A long shelf paints only what is on screen: the cards below stay unrendered until they are scrolled
   into view, which keeps the first frame on a phone from stalling on a hundred cards at once. */
.card.prodvar{content-visibility:auto;contain-intrinsic-size:auto 112px}
.ltrgrp{display:inline-block;direction:ltr;unicode-bidi:isolate;white-space:nowrap}

/* ---- offers ---- */
.p-banner.offers{background:linear-gradient(135deg,var(--c25),var(--c44))}
.card.off .offtop{display:flex;gap:10px;align-items:flex-start}
.card.off .offdisc{background:var(--c73);color:var(--c44);border-radius:12px;padding:6px 10px;font-weight:800;white-space:nowrap}
.card.off .terms{font-size:12px;opacity:.75}
.codecard{text-align:center}
.codecard .barcode{margin:10px 0 4px;background:var(--white);border-radius:12px;padding:10px}
.codecard .codebig{font-size:30px;font-weight:800;letter-spacing:4px;direction:ltr;font-family:ui-monospace,Menlo,Consolas,monospace}

/* admin/merchant tables: numbers keep their decimals and separators whole; the card scrolls sideways instead */
#app .card:has(table.nt){overflow-x:auto;-webkit-overflow-scrolling:touch}
#app table.nt td,#app table.nt th{white-space:nowrap;overflow-wrap:normal;word-break:normal;padding:8px 12px;vertical-align:middle}
#app table.nt td:first-child,#app table.nt th:first-child{white-space:normal;min-width:110px}
details.card>summary::-webkit-details-marker{display:none}
body.wide .card .hint{color:var(--c21);margin:6px 0;font-size:13px;opacity:1}
body.wide .card .bad{color:var(--c46)}
body.wide .card .ok{color:var(--c6)}
body.wide .card .warn{color:var(--c42)}

/* أرقام المحل أول ما يفتح: كارت غامق، تلات أرقام، وبعدهم التفصيل */
.card.hl{background:linear-gradient(135deg,var(--deep),var(--deep2));color:var(--cream);border:0}
.card.hl h3{color:var(--white)}
.card.hl .sub,.card.hl .hint{color:var(--tint)}
.card.hl .tot{border-color:var(--white-22)}
.card.hl .ok{color:var(--c35)}.card.hl .warn{color:var(--c80)}
.hlgrid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:10px 0}
.hlgrid>div{background:var(--white-12);border-radius:12px;padding:8px 10px}
.hlgrid .sub{font-size:11px;line-height:1.35;margin:0}
.hlv{font-size:20px;font-weight:800;margin:2px 0}
@media(max-width:430px){.hlgrid{grid-template-columns:1fr 1fr}}

.noph{display:flex;align-items:center;justify-content:center;width:100%;height:100%;border-radius:12px;background:var(--c20);color:var(--c69)}
.noph svg{display:block}

/* sign-up card: lighter navy than the page, so it reads as a card */
#app .card.authcard{background:#1f3556;color:#fff;border:1px solid #34507a;box-shadow:0 8px 28px rgba(0,0,0,.35)}
#app .card.authcard .sub{color:#c3d0e4}

/* The store's tiles: three across, a photo on each, his order. A tap filters the shelf to that tile. */
.tilegrid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:10px 0 6px}
.tile{display:flex;flex-direction:column;align-items:center;gap:4px;padding:8px 4px;border:0;border-radius:14px;background:var(--card,#141a22);color:inherit;cursor:pointer;font:inherit}
.tileimg{width:100%;aspect-ratio:1/1;border-radius:10px;overflow:hidden;display:flex;align-items:center;justify-content:center;background:#0d1218}
.tileimg img{width:100%;height:100%;object-fit:cover}
.tileimg em{font-size:30px;font-style:normal}
.tilelabel{font-size:11.5px;line-height:1.25;text-align:center;min-height:2.5em;display:flex;align-items:center;justify-content:center}
.tilecount{font-size:10px;opacity:.6}
.gridback{margin:6px 0}
