/* ==========================================================================
   مراد فون — واجهة العميل
   فكرة التصميم: «طاولة الورشة» — أسود فحمي، أصفر إشارة، رمادي معدني بارد.
   الجرأة مركّزة في رأس الصفحة الرئيسية؛ الباقي هادئ ومنضبط.
   ========================================================================== */
:root {
  --ink: #0e0f11;
  --ink-2: #181a1e;
  --ink-3: #272a30;
  --brand: #ffc72c;
  --brand-d: #e3a600;
  --brand-soft: #fff4cf;
  --bg: #eceef1;
  --surface: #ffffff;
  --line: #dce0e6;
  --text: #14161a;
  --muted: #5b6270;
  --ok: #17803d;   --ok-bg: #e2f4e8;
  --warn: #8a5a00; --warn-bg: #fff1cc;
  --bad: #c62828;  --bad-bg: #fde8e6;
  --info: #1d5fa8; --info-bg: #e3eefb;
  --r-xl: 28px; --r-lg: 22px; --r-md: 16px; --r-sm: 12px;
  --radius: 18px;
  --sh-s: 0 1px 2px rgba(14, 15, 17, .07), 0 2px 8px rgba(14, 15, 17, .05);
  --sh-m: 0 1px 2px rgba(14, 15, 17, .06), 0 8px 22px rgba(14, 15, 17, .08);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --nav-space: calc(92px + var(--safe-b));
  --pcb: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='230' viewBox='0 0 360 230' fill='none' stroke='%23FFC72C' stroke-opacity='.17' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M0 36h74l26 26h64'/%3E%3Cpath d='M0 88h48l20 20h96l24-24h44'/%3E%3Cpath d='M0 142h96l22 22h76'/%3E%3Cpath d='M0 196h34l18-18h118l18 18h40'/%3E%3Cpath d='M210 0v28l18 18h48'/%3E%3Cpath d='M262 230v-30l-16-16h-52'/%3E%3Ccircle cx='168' cy='62' r='5'/%3E%3Ccircle cx='236' cy='84' r='5'/%3E%3Ccircle cx='198' cy='164' r='5'/%3E%3Ccircle cx='174' cy='178' r='5'/%3E%3Ccircle cx='282' cy='46' r='5'/%3E%3Ccircle cx='194' cy='184' r='5'/%3E%3Crect x='290' y='96' width='44' height='44' rx='6'/%3E%3Cpath d='M300 96v-10M312 96v-10M324 96v-10M300 140v10M312 140v10M324 140v10'/%3E%3C/svg%3E");
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: #cfd3da; color: var(--text);
  font: 15px/1.6 "Segoe UI", "Noto Sans Arabic", "Noto Naskh Arabic", Tahoma, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { margin: 0; line-height: 1.3; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--brand-d); outline-offset: 2px; }
.skip { position: fixed; inset-inline-start: 0; top: 0; background: var(--brand); color: var(--ink); padding: .5rem 1rem; z-index: 99; transform: translateY(-150%); }
.skip:focus { transform: none; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.ltr { direction: ltr; unicode-bidi: plaintext; }

/* ---------- الإطار: عمود بعرض التطبيق على الحاسوب ---------- */
.app {
  max-width: 760px; margin: 0 auto; min-height: 100vh; min-height: 100dvh;
  background: var(--bg); position: relative; display: flex; flex-direction: column;
  box-shadow: 0 0 48px rgba(14, 15, 17, .22);
}
.view { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.has-nav .view { padding-bottom: var(--nav-space); }

/* ---------- الشريط العلوي (صفحات داخلية: فاتح، عنوان كبير) ---------- */
.top {
  display: flex; align-items: center; gap: .65rem; padding: .75rem 1rem .6rem; position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 90%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.top h1 { flex: 1; text-align: start; font-size: 1.4rem; font-weight: 800; letter-spacing: -.01em; overflow-wrap: anywhere; }
.top .sp { flex: 1; }
.ibtn {
  position: relative; width: 44px; height: 44px; display: inline-grid; place-items: center; flex: none;
  background: #fff; border: 0; border-radius: 50%; color: var(--ink); box-shadow: var(--sh-s);
}
.ibtn:hover { background: var(--brand-soft); }
.ibtn svg { width: 22px; height: 22px; }
.dot {
  position: absolute; top: -3px; inset-inline-end: -3px; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 10px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center;
  border: 2px solid var(--bg); line-height: 1;
}

/* ---------- رأس الصفحة الرئيسية: الشيء الأجرأ في التصميم ---------- */
.top.hero {
  position: relative; z-index: 1; flex-wrap: wrap; align-items: center; background-color: var(--ink); color: #fff;
  background-image: var(--pcb); background-repeat: no-repeat; background-position: left -30px bottom -26px; background-size: 340px auto;
  padding: .95rem 1.1rem 4.1rem; border-radius: 0 0 var(--r-xl) var(--r-xl); -webkit-backdrop-filter: none; backdrop-filter: none;
}
.hero .logo { width: 42px; height: 42px; border-radius: 12px; object-fit: cover; background: #000; box-shadow: 0 0 0 2px rgba(255, 199, 44, .55); }
.hero .name { font-weight: 800; font-size: 1.08rem; color: #fff; }
.hero .ibtn { background: rgba(255, 255, 255, .1); color: #fff; box-shadow: none; }
.hero .ibtn:hover { background: rgba(255, 255, 255, .2); }
.hero .dot { border-color: var(--ink); }
.welcome { flex-basis: 100%; padding-top: .55rem; display: flex; flex-direction: column; gap: .05rem; min-width: 0; }
.welcome span { color: rgba(255, 255, 255, .62); font-size: .95rem; font-weight: 600; }
.welcome b { color: #fff; font-size: 1.65rem; font-weight: 800; line-height: 1.25; letter-spacing: -.01em; overflow-wrap: anywhere; }

/* البحث: يتدلّى من حافة الرأس */
.searchbar { padding: 0 1rem; margin-top: -2.9rem; position: relative; z-index: 2; }
.fake-input {
  display: flex; align-items: center; min-height: 58px; padding-inline: 66px 16px; border: 0; border-radius: 20px; background: #fff;
  color: var(--muted); font-weight: 600; text-decoration: none; box-shadow: 0 12px 28px rgba(14, 15, 17, .22);
}
.fake-input span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.field-ico { position: relative; }
.field-ico svg { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.field-ico input { padding-inline-start: 42px; }
.searchbar .fake-input svg { width: 42px; height: 42px; padding: 10px; border-radius: 14px; background: var(--brand); color: var(--ink); inset-inline-start: 8px; }
.top input.sinput {
  flex: 1; min-height: 50px; border: 2px solid var(--brand); border-radius: 18px; background: #fff; font-weight: 700; box-shadow: var(--sh-m);
}
.top input.sinput:focus { box-shadow: 0 0 0 4px rgba(255, 199, 44, .45); outline: none; border-color: var(--brand); }
.top input.sinput::placeholder { color: var(--muted); font-weight: 600; }

/* التبويب: شريحة مقسّمة */
.tabs2 { display: flex; gap: 4px; margin: 1rem 1rem .25rem; padding: 4px; background: #dde0e6; border-radius: 18px; }
.tabs2 button {
  flex: 1; border: 0; background: none; padding: .6rem; font-weight: 800; color: var(--muted); border-radius: 14px;
  display: flex; gap: .4rem; justify-content: center; align-items: center; min-height: 46px;
}
.tabs2 button[aria-selected="true"] { background: var(--ink); color: var(--brand); box-shadow: 0 2px 8px rgba(14, 15, 17, .28); }
.tabs2 svg { width: 19px; height: 19px; }

.pad { padding: 1rem; }
.stack > * + * { margin-top: .65rem; }

/* ---------- حقول ونماذج ---------- */
input, textarea, select {
  width: 100%; padding: .75rem 1rem; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; min-height: 52px;
}
input:focus, textarea:focus, select:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 4px rgba(255, 199, 44, .5); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--bad); }
textarea { resize: vertical; min-height: 110px; }
label.f { display: block; font-weight: 700; font-size: .92rem; }
label.f > input, label.f > textarea, label.f > select { margin-top: .35rem; font-weight: 400; }
.err { color: var(--bad); font-size: .85rem; font-weight: 700; margin-top: .25rem; }
.form > * + * { margin-top: .9rem; }

/* ---------- أزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 52px; padding: .6rem 1.2rem;
  border-radius: 16px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); font-weight: 800;
  transition: transform .08s, background-color .15s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--ink); box-shadow: 0 3px 0 var(--brand-d); }
.btn.primary:hover { background: #ffd04f; border-color: #ffd04f; }
.btn.primary:active { box-shadow: 0 1px 0 var(--brand-d); transform: translateY(2px); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--brand); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.sq { width: 48px; height: 48px; min-height: 48px; padding: 0; border-radius: 50%; background: var(--brand); border-color: var(--brand); box-shadow: 0 3px 0 var(--brand-d); }
.btn.sq.off { background: #e3e6eb; border-color: #e3e6eb; color: var(--muted); box-shadow: none; }
.btn.sm { min-height: 40px; padding: .3rem .9rem; font-size: .9rem; border-radius: 13px; }
.round {
  width: 38px; height: 38px; border-radius: 50%; border: 0; background: #fff; display: inline-grid; place-items: center; color: var(--ink);
  box-shadow: var(--sh-s);
}
.round svg { width: 18px; height: 18px; }
.round[disabled] { opacity: .4; cursor: default; }

/* ---------- بطاقات ---------- */
.panel { background: #fff; border: 0; border-radius: var(--radius); padding: 1rem; display: block; width: 100%; text-align: start; box-shadow: var(--sh-s); }
button.panel, a.panel { cursor: pointer; text-decoration: none; color: inherit; }
button.panel:hover, a.panel:hover { box-shadow: var(--sh-m); }
.panel.warn { background: var(--warn-bg); color: var(--warn); font-weight: 700; box-shadow: none; }
.panel.bad { background: var(--bad-bg); color: var(--bad); font-weight: 700; box-shadow: none; }
.panel.info { background: var(--info-bg); color: var(--info); font-weight: 700; box-shadow: none; }
.sec { font-size: 1.05rem; font-weight: 800; padding: 1.2rem .25rem .55rem; }
.row { display: flex; align-items: center; gap: .75rem; }
.row .grow { flex: 1; min-width: 0; }
.between { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.badge { display: inline-block; padding: .12rem .7rem; border-radius: 99px; font-size: .78rem; font-weight: 800; white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-bad { background: var(--bad-bg); color: var(--bad); }
.b-info { background: var(--info-bg); color: var(--info); }
.b-mute { background: #e3e6eb; color: var(--muted); }
.avatar { width: 46px; height: 46px; border-radius: 16px; background: var(--ink); color: var(--brand); display: grid; place-items: center; flex: none; }
.avatar svg { width: 22px; height: 22px; }
.avatar.y { background: var(--brand); color: var(--ink); }

/* ---------- الصور ---------- */
.img { background: #f1f2f5; border-radius: 14px; overflow: hidden; display: grid; place-items: center; color: #aab0bb; position: relative; }
.img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img.contain img { object-fit: contain; }
.img .ph { width: 40%; max-width: 44px; opacity: .8; }
.img.th { width: 88px; height: 88px; flex: none; border-radius: 16px; }
.img.sm { width: 60px; height: 60px; flex: none; }
.img .ph { height: auto; }

/* ---------- الأقسام: بلاطات بصور كبيرة ---------- */
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: .8rem 1rem 1.2rem; }
@media (min-width: 640px) { .grid2 { grid-template-columns: repeat(3, 1fr); } }
.gcard {
  position: relative; display: flex; flex-direction: column; padding: 8px; border: 1.3px solid #efd27a; overflow: hidden; aspect-ratio: 4 / 4.6; border-radius: var(--r-lg);
  background: #fff; color: var(--ink); text-align: start; box-shadow: var(--sh-s); transition: transform .12s, box-shadow .12s;
}
button.gcard:active { transform: scale(.985); }
@media (hover: hover) { button.gcard:hover { box-shadow: var(--sh-m); } }
.gcard .img { flex: 1; min-height: 0; width: 100%; border-radius: 16px; background: #f1f2f5; color: #b4bac4; }
.gcard .img .ph { width: 34%; max-width: 64px; opacity: 1; }
.gcard .t {
  display: flex; align-items: center; min-height: 3.1em; padding: .55rem .4rem .25rem;
  font-weight: 800; font-size: 1rem; line-height: 1.35; color: var(--ink); overflow-wrap: anywhere;
}

/* المجموعات الفرعية: صفوف عريضة سهلة القراءة */
.grid3 { display: flex; flex-direction: column; gap: .6rem; padding: .5rem 1rem 1.2rem; }
.gcard.sub {
  aspect-ratio: auto; display: flex; flex-direction: row; align-items: center; border: 0; gap: .9rem; padding: .65rem .8rem .65rem 1rem; border-radius: var(--r-lg); background: #fff; color: var(--text); box-shadow: var(--sh-s); width: 100%;
}
.gcard.sub .img { position: relative; inset: auto; width: 68px; height: 68px; border-radius: 16px; flex: none; background: #f1f2f5; color: #aab0bb; }
.gcard.sub .img .ph { width: 40%; max-width: 40px; }
.gcard.sub .t { padding: 0; min-height: 0; flex: 1; min-width: 0; color: var(--text); font-size: 1.02rem; }
.gcard.sub .go { width: 36px; height: 36px; border-radius: 50%; background: var(--bg); color: var(--ink); display: grid; place-items: center; flex: none; }
.gcard.sub .go svg { width: 18px; height: 18px; }

/* ---------- صف الصنف ---------- */
.items { padding: .6rem 1rem 1.2rem; }
.items > * + * { margin-top: .6rem; }
.panel.item { display: flex; align-items: center; gap: .85rem; padding: .7rem .8rem .7rem .7rem; cursor: pointer; border-radius: var(--r-lg); }
.item .nm { font-weight: 800; font-size: .98rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item .meta { display: flex; gap: .55rem; align-items: center; flex-wrap: wrap; margin-top: .3rem; }
.item .meta .badge { background: none; padding: 0; font-size: .8rem; display: inline-flex; align-items: center; gap: .35rem; }
.item .meta .badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.item .meta .badge.b-info { background: var(--ink); color: var(--brand); padding: .05rem .55rem; }
.item .meta .badge.b-info::before { content: none; }
.price { font-weight: 700; color: var(--muted); }

/* ---------- نافذة سفلية (Bottom sheet) ---------- */
.back { position: fixed; inset: 0; background: rgba(14, 15, 17, .6); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: #fff; width: 100%; max-width: 760px; max-height: 92vh; max-height: 92dvh; overflow-y: auto;
  border-radius: var(--r-xl) var(--r-xl) 0 0; padding: .6rem 1.1rem calc(1.3rem + var(--safe-b)); animation: up .2s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.sheet .grip { width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto .9rem; }
.dlg { align-items: center; padding: 1rem; }
.dlg .sheet { border-radius: var(--r-xl); max-width: 420px; padding-top: 1.3rem; }
.dlg h2 { font-size: 1.15rem; margin-bottom: .5rem; }
.actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.1rem; }

.pager { position: relative; aspect-ratio: 1.2; background: #f1f2f5; border-radius: var(--r-lg); overflow: hidden; }
.pager .track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; direction: ltr; }
.pager .track::-webkit-scrollbar { display: none; }
.pager .track > .img { flex: 0 0 100%; scroll-snap-align: center; border-radius: 0; height: 100%; }
.pager .dots { position: absolute; bottom: 10px; width: 100%; display: flex; justify-content: center; gap: 6px; }
.pager .dots i { width: 8px; height: 8px; border-radius: 50%; background: #0004; }
.pager .dots i.on { background: var(--ink); width: 20px; border-radius: 6px; }
.sheet h2 { font-size: 1.2rem; font-weight: 800; }
.qty { display: flex; align-items: center; gap: .5rem; background: var(--bg); border-radius: 18px; padding: .55rem .8rem; }
.qty .n { min-width: 42px; text-align: center; font-weight: 800; font-size: 1.2rem; }
.bar { background: var(--bg); border-radius: 18px; }
.bar > summary { padding: .9rem 1.1rem; font-weight: 800; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.bar > summary::-webkit-details-marker { display: none; }
.bar > summary::after { content: "‹"; font-size: 1.3rem; line-height: 1; transition: transform .15s; }
.bar[open] > summary::after { transform: rotate(-90deg); }
.bar .in { padding: 0 1.1rem 1rem; }
.kv { display: flex; gap: .75rem; padding: .25rem 0; }
.kv > span:first-child { width: 110px; flex: none; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #fff; border-radius: 99px; padding: .2rem .8rem; font-size: .85rem; font-weight: 600; box-shadow: var(--sh-s); }

/* ---------- السلة والطلبات ---------- */
.cart-foot {
  position: sticky; bottom: var(--nav-space); background: #fff; margin: 0 .6rem; border-radius: var(--r-lg); padding: .9rem 1rem; z-index: 10;
  box-shadow: 0 -4px 24px rgba(14, 15, 17, .12), var(--sh-m);
}
.cart-foot > * + * { margin-top: .55rem; }
.trash { background: none; border: 0; color: var(--bad); width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; }
.trash svg { width: 22px; height: 22px; }
.trash:hover { background: var(--bad-bg); }
.empty { text-align: center; padding: 3.2rem 1.5rem; color: var(--muted); }
.empty svg { width: 88px; height: 88px; padding: 24px; border-radius: 50%; background: #fff; color: #98a0ae; box-shadow: var(--sh-s); }
.empty p { margin: .9rem 0 1.1rem; font-size: 1.05rem; font-weight: 600; }
.spinner { width: 36px; height: 36px; margin: 3rem auto; border: 4px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: flex; gap: .7rem; padding: .35rem 0; }
.tl li::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--brand-d); margin-top: .5rem; flex: none; }
.method { border: 2px solid transparent; border-radius: var(--r-lg); padding: .9rem; background: #fff; width: 100%; text-align: start; display: block; box-shadow: var(--sh-s); }
.method[aria-checked="true"] { border-color: var(--ink); background: var(--brand-soft); }
.method .head { display: flex; align-items: center; gap: .6rem; font-weight: 800; }
.radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--muted); flex: none; }
.method[aria-checked="true"] .radio { border: 7px solid var(--ink); }
.method .det { margin-top: .6rem; }
.cart-body { flex: 1; display: flex; flex-direction: column; }
.cart-body > .items { flex: 1; }
.cart-foot { margin-top: auto; }

/* ---------- المحادثة ---------- */
.chat-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.msgs { flex: 1; overflow-y: auto; padding: .8rem 1rem; display: flex; flex-direction: column; gap: .5rem; }
.bubble { max-width: 82%; padding: .6rem .85rem; border-radius: 20px; background: #fff; box-shadow: var(--sh-s); overflow-wrap: anywhere; }
.bubble.me { background: var(--ink); color: #fff; align-self: flex-start; border-end-start-radius: 6px; }
.bubble.them { align-self: flex-end; border-end-end-radius: 6px; }
.bubble .who { color: var(--brand-d); font-weight: 800; font-size: .78rem; }
.bubble .tm { font-size: .68rem; opacity: .6; margin-top: .2rem; }
.bubble .img { width: 220px; max-width: 100%; height: 170px; margin: .2rem 0; cursor: zoom-in; }
.bubble button.file { background: none; border: 0; color: inherit; text-decoration: underline; padding: 0; text-align: start; }
.composer { display: flex; align-items: flex-end; gap: .4rem; padding: .6rem .8rem; background: #fff; border-top: 1px solid var(--line); padding-bottom: calc(.6rem + var(--safe-b)); position: sticky; bottom: 0; }
.composer textarea { min-height: 48px; max-height: 140px; resize: none; }
.composer .ibtn { color: var(--ink); box-shadow: none; background: var(--bg); }
.viewer { background: #000; }
.viewer img { max-width: 100vw; max-height: 100vh; }

/* ---------- الشريط السفلي: كبسولة سوداء عائمة ---------- */
.nav {
  position: fixed; bottom: calc(12px + var(--safe-b)); inset-inline: 14px; margin: 0 auto; max-width: 732px; z-index: 30;
  background: var(--ink); border-radius: 26px; display: flex; gap: 4px; padding: 6px; box-shadow: 0 14px 32px rgba(14, 15, 17, .38);
}
.nav a {
  flex: 1; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none;
  color: #a4abb7; font-size: .72rem; font-weight: 700; border-radius: 20px; position: relative; min-width: 0; transition: background-color .15s, color .15s;
}
.nav a svg { width: 23px; height: 23px; }
.nav a .pill { display: grid; place-items: center; position: relative; }
.nav a[aria-current="page"] { background: var(--brand); color: var(--ink); }
.nav .dot { top: -6px; inset-inline-end: -10px; border-color: var(--ink); }
.nav a[aria-current="page"] .dot { border-color: var(--brand); }

/* ---------- الدخول ---------- */
.login {
  background-color: var(--ink); background-image: var(--pcb); background-repeat: no-repeat; background-position: left -40px top -10px; background-size: 380px auto;
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem;
}
.login .logo { width: min(220px, 56vw); border-radius: 22px; box-shadow: 0 0 0 2px rgba(255, 199, 44, .5); }
.login form { width: 100%; max-width: 390px; background: #fff; border-radius: var(--r-xl); padding: 1.5rem 1.4rem; margin-top: 1.6rem; box-shadow: 0 20px 50px rgba(0, 0, 0, .45); }
.login h1 { font-size: 1.3rem; margin-bottom: 1rem; }
.pw { position: relative; }
.pw .ibtn { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 40px; height: 40px; background: transparent; box-shadow: none; }
.pw input { padding-inline-end: 48px; }
.pw .ibtn:hover { background: var(--bg); }

#toasts { position: fixed; top: 12px; inset-inline: 0; margin: 0 auto; width: min(92vw, 460px); z-index: 90; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: .75rem 1rem; border-radius: 16px; box-shadow: 0 10px 28px #0006; pointer-events: auto; border-inline-start: 5px solid var(--brand); font-weight: 600; }
.toast.bad { background: var(--bad); border-inline-start-color: #fff; }
.toast.ok { background: var(--ink); border-inline-start-color: #3ddc84; }

@media (max-width: 420px) { .grid2 { gap: 10px; padding-inline: .8rem; } }
@media (min-width: 761px) { body { padding: 0; } .app { border-inline: 1px solid #0002; } }

.big { width: 44px; height: 44px; }
/* حجم افتراضي للأيقونات داخل أي حاوية (يُتجاوز بقواعد أخص أعلاه) */
svg { width: 24px; height: 24px; flex: none; }
.item .nm, .panel b, .kv > span, .chip { overflow-wrap: anywhere; }
.panel { overflow-wrap: anywhere; }

/* ---------- المفضلة ---------- */
.fav { width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); display: inline-grid; place-items: center; flex: none; padding: 0; cursor: pointer; }
.fav svg { width: 22px; height: 22px; }
.fav:hover { background: var(--bg); }
.fav[aria-pressed="true"] { color: var(--bad); }
.fav[aria-pressed="true"] svg { fill: currentColor; }
.fav:disabled { opacity: .6; }
.item .grow { flex: 1; min-width: 0; }
.item .act { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: .4rem; }
/* الصنف في السلة: يتحوّل زر السلة إلى الأسود (علامة أنه مشمول) ويظهر تحته عدّاد الكمية */
.item .act .btn.sq.in { background: var(--ink); border-color: var(--ink); color: var(--brand); box-shadow: 0 3px 0 #000; }
.stepper { display: flex; align-items: center; background: var(--bg); border-radius: 99px; padding: 2px; }
.stepper[hidden] { display: none; }
.stepper .round { width: 34px; height: 34px; }
.stepper .round svg { width: 16px; height: 16px; }
.stepper .n { min-width: 26px; text-align: center; font-weight: 800; }
.thwrap { position: relative; flex: none; }
.fav.on-img { position: absolute; top: -6px; inset-inline-start: -6px; width: 32px; height: 32px; background: #fff; box-shadow: 0 1px 6px rgba(14, 15, 17, .28); }
.fav.on-img svg { width: 17px; height: 17px; }
.fav.on-img::after { content: ''; position: absolute; inset: -7px; }
.item .devline { margin-top: .3rem; font-size: .8rem; color: var(--info); font-weight: 700; overflow-wrap: anywhere; }

/* ---------- كشف الحساب ---------- */
.chips2 { display: flex; gap: .5rem; padding: .7rem 1rem 0; overflow-x: auto; scrollbar-width: none; }
.chip2 { flex: none; border: 0; background: #fff; border-radius: 999px; padding: .5rem 1rem; font-weight: 800; color: var(--muted); box-shadow: var(--sh-s); }
.chip2[aria-selected="true"] { background: var(--ink); color: var(--brand); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.stat { background: #fff; border-radius: var(--r-lg); padding: .85rem .95rem; display: flex; flex-direction: column; gap: .2rem; min-width: 0; box-shadow: var(--sh-s); }
.stat .k { color: var(--muted); font-size: .82rem; font-weight: 700; }
.stat .v { font-size: 1.1rem; font-weight: 800; overflow-wrap: anywhere; }
.stat.ok .v { color: var(--ok); }
.stat.bad .v { color: var(--bad); }
.inv { cursor: pointer; }
.kv3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.kv3 > div { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.kv3 .k { color: var(--muted); font-size: .78rem; }
.kv3 b { font-size: .92rem; overflow-wrap: anywhere; }
@media print {
  .nav, .noprint, .chips2, .top .ibtn, #toasts { display: none !important; }
  body { background: #fff; }
  .top { position: static; }
  .app { box-shadow: none; max-width: none; }
}

/* ---------- تعديل أسطر الطلب (قبل التأكيد) ---------- */
.eline { display: flex; align-items: center; gap: .6rem; padding: .65rem .8rem; }
.eline .grow { flex: 1; min-width: 0; }
.eline .nm { overflow-wrap: anywhere; }
.eline.gone .nm { text-decoration: line-through; color: var(--muted); }
.eline [hidden] { display: none; }

/* ---- شريط تقدم الطلب ---- */
.progress { list-style: none; display: flex; justify-content: space-between; gap: .2rem; margin: .4rem 0 .2rem; padding: 0; position: relative; }
.progress li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .3rem; text-align: center; position: relative; min-width: 0; }
.progress li::before { content: ''; position: absolute; top: 13px; inset-inline-start: 50%; width: 100%; height: 3px; background: var(--line); z-index: 0; }
.progress li:last-child::before { display: none; }
.progress li.done::before { background: var(--ink); }
.progress .pdot { z-index: 1; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 800; background: var(--line); color: var(--muted); }
.progress li.done .pdot { background: var(--ink); color: var(--brand); }
.progress li.now .pdot { background: var(--brand); color: var(--ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 32%, transparent); }
.progress .lbl { font-size: .68rem; color: var(--muted); line-height: 1.2; }
.progress li.now .lbl { color: var(--ink); font-weight: 800; }

/* ---- هياكل التحميل ---- */
.sk-card { background: #fff; border-radius: var(--r-lg); padding: .9rem; display: grid; gap: .6rem; box-shadow: var(--sh-s); }
.sk { height: .8rem; border-radius: 6px; background: linear-gradient(90deg, #e3e6eb 25%, #f3f4f6 50%, #e3e6eb 75%); background-size: 200% 100%; animation: sk-shine 1.2s linear infinite; }
.sk-l1 { width: 45%; height: 1rem; } .sk-l2 { width: 80%; } .sk-l3 { width: 60%; }
.sk-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: .8rem 1rem; }
.sk-tile { aspect-ratio: 4 / 4.6; border-radius: var(--r-lg); height: auto; }
.sk-rows { padding: .6rem 1rem; display: grid; gap: .6rem; }
.sk-row { display: flex; gap: .85rem; align-items: center; background: #fff; border-radius: var(--r-lg); padding: .7rem; box-shadow: var(--sh-s); }
.sk-thumb { width: 88px; height: 88px; border-radius: 16px; flex: none; height: 88px; }
.sk-row .col { flex: 1; display: grid; gap: .55rem; }
@keyframes sk-shine { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* ---------- السلة: صف الصنف ---------- */
.cline .stepper { display: inline-flex; margin-top: .45rem; }
.cline .lost { color: var(--bad); font-weight: 700; font-size: .85rem; margin-top: .2rem; }
.cline.gone { background: var(--bad-bg); }
.cart-foot .tot { font-weight: 800; font-size: 1.1rem; }
.cart-foot .tot.pending { color: var(--muted); font-size: .85rem; font-weight: 600; }

/* ---------- بطاقة الطلب: شريط جانبي بلون الحالة ---------- */
.ocard { --stripe: var(--muted); position: relative; padding-inline-start: 1.35rem; display: flex; flex-direction: column; gap: .65rem; cursor: pointer; }
.ocard::before { content: ''; position: absolute; inset-block: 14px; inset-inline-start: 7px; width: 5px; border-radius: 99px; background: var(--stripe); }
.ocard.tone-ok { --stripe: var(--ok); }
.ocard.tone-warn { --stripe: var(--brand); }
.ocard.tone-info { --stripe: var(--info); }
.ocard.tone-bad { --stripe: var(--bad); }
.ocard.tone-mute { --stripe: #aab0bb; }
.ohead { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.ocol { display: flex; flex-direction: column; min-width: 0; }
.onum { font-size: 1.12rem; font-weight: 800; letter-spacing: .01em; }
.otot { display: flex; justify-content: space-between; align-items: baseline; padding-top: .6rem; border-top: 1px dashed var(--line); }
.otot span { color: var(--muted); font-weight: 600; }
.otot b { font-size: 1.2rem; font-weight: 800; }

/* ---------- المزيد ---------- */
.me {
  display: flex; align-items: center; gap: .9rem; padding: 1.1rem; border-radius: var(--r-lg); color: #fff; background-color: var(--ink);
  background-image: var(--pcb); background-repeat: no-repeat; background-position: left -50px center; background-size: 300px auto;
}
.me .grow { min-width: 0; }
.me b { font-size: 1.15rem; font-weight: 800; overflow-wrap: anywhere; }
.me .small { color: rgba(255, 255, 255, .65); }
.mav { width: 54px; height: 54px; border-radius: 18px; background: var(--brand); color: var(--ink); display: grid; place-items: center; font-size: 1.5rem; font-weight: 800; flex: none; }
.lgroup { background: #fff; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--sh-s); margin-top: .9rem; }
.lgroup > .panel { border-radius: 0; box-shadow: none; padding: .8rem 1rem; }
.lgroup > .panel + .panel { border-top: 1px solid var(--bg); }
.lgroup > a.panel:hover { background: #fafbfc; }
.lgroup .avatar { width: 42px; height: 42px; border-radius: 14px; background: var(--bg); color: var(--ink); }
.lgroup .row > svg:last-child { color: #98a0ae; width: 20px; height: 20px; }

@media (max-width: 360px) {
  .img.th { width: 66px; height: 66px; border-radius: 14px; }
  .panel.item { gap: .6rem; padding: .6rem; }
  .stepper .round { width: 30px; height: 30px; }
  .stepper .n { min-width: 22px; }
  .item .act .btn.sq { width: 44px; height: 44px; min-height: 44px; }
  .welcome b { font-size: 1.45rem; }
}
.login form p { margin: 1rem 0 0; }

/* ---------- مفتاح التبديل (صوت الإشعارات) ---------- */
.switch { position: relative; width: 50px; height: 30px; border-radius: 99px; background: #c8ccd4; flex: none; transition: background-color .15s; }
.switch::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(14, 15, 17, .3); transition: inset-inline-start .15s; }
[aria-checked="true"] > .switch { background: var(--ink); }
[aria-checked="true"] > .switch::after { inset-inline-start: 23px; background: var(--brand); }
@media (prefers-reduced-motion: reduce) { .switch, .switch::after { transition: none; } }

/* اسم القسم الرئيسي في منتصف البطاقة بخط عريض */
.gcard:not(.sub) .t { justify-content: center; text-align: center; font-weight: 900; font-size: 1.06rem; }

/* بحث داخل المجموعة وداخل نتائج البحث */
.insearch { padding: 0 1rem .7rem; }
.insearch input {
  width: 100%; min-height: 46px; border: 2px solid var(--brand); border-radius: 16px; background: #fff; font-weight: 700; box-shadow: var(--sh-s);
}
.insearch input:focus { outline: none; box-shadow: 0 0 0 4px rgba(255, 199, 44, .45); }
.insearch input::placeholder { color: var(--muted); font-weight: 600; }
.rcount { padding: 0 1.1rem .4rem; color: var(--muted); font-weight: 700; font-size: .9rem; }
a.cartbtn { text-decoration: none; }
