/* ============================================================
   Qafso — Design System (RTL / Arabic)
   ============================================================ */
:root {
  --brand-900: #06322c;
  --brand-800: #0a4a40;
  --brand-700: #0d6255;
  --brand-600: #0f766e;
  --brand-500: #14b8a6;
  --brand-400: #2dd4bf;
  --brand-100: #ccfbf1;
  --brand-50: #f0fdfa;

  --amber-600: #d97706;
  --amber-500: #f59e0b;
  --amber-100: #fef3c7;

  --ink-900: #0b1220;
  --ink-800: #16233a;
  --ink-700: #2b3a55;
  --ink-500: #64748b;
  --ink-400: #94a3b8;
  --ink-200: #e2e8f0;
  --ink-100: #f1f5f9;
  --ink-50: #f8fafc;

  --ok-600: #059669;
  --ok-100: #d1fae5;
  --warn-600: #b45309;
  --warn-100: #fef3c7;
  --err-600: #dc2626;
  --err-100: #fee2e2;
  --info-600: #0369a1;
  --info-100: #e0f2fe;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(11, 18, 32, .06), 0 1px 3px rgba(11, 18, 32, .08);
  --shadow: 0 4px 14px rgba(11, 18, 32, .08);
  --shadow-lg: 0 18px 40px -12px rgba(11, 18, 32, .22);
  --sidebar: 258px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Tajawal", "Cairo", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--ink-50);
  color: var(--ink-800);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  direction: rtl;
}
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: 1rem; }
[hidden] { display: none !important; }

/* ---------------- layout helpers ---------------- */
.wrap { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 20px; }
.wrap-sm { max-width: 640px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; }
.center { text-align: center; }
.muted { color: var(--ink-500); }
.small { font-size: .85rem; }
.xsmall { font-size: .78rem; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; direction: ltr; }
.nowrap { white-space: nowrap; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; } .mb-4 { margin-bottom: 32px; }
.gap-sm { gap: 6px; } .gap-lg { gap: 20px; }

/* ---------------- typography ---------------- */
h1, h2, h3, h4 { line-height: 1.35; font-weight: 800; color: var(--ink-900); }
h1 { font-size: clamp(1.9rem, 4.2vw, 3.1rem); letter-spacing: -.5px; }
h2 { font-size: clamp(1.4rem, 2.6vw, 2rem); }
h3 { font-size: 1.2rem; }
.page-title { font-size: 1.6rem; font-weight: 800; }
.section-title { font-size: 1.15rem; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--brand-50); color: var(--brand-700);
  border: 1px solid var(--brand-100);
  padding: 6px 14px; border-radius: 999px;
  font-size: .82rem; font-weight: 700;
}

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 700; font-size: .95rem; cursor: pointer; transition: .16s;
  background: var(--ink-100); color: var(--ink-800); white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand-600); color: #fff; box-shadow: 0 6px 16px -6px rgba(15,118,110,.6); }
.btn-primary:hover { background: var(--brand-700); }
.btn-accent { background: var(--amber-500); color: #3a2500; }
.btn-accent:hover { background: var(--amber-600); color: #fff; }
.btn-outline { background: #fff; border-color: var(--ink-200); color: var(--ink-700); }
.btn-outline:hover { border-color: var(--brand-500); color: var(--brand-700); background: var(--brand-50); }
.btn-ghost { background: transparent; color: var(--ink-600); }
.btn-ghost:hover { background: var(--ink-100); }
.btn-danger { background: var(--err-100); color: var(--err-600); }
.btn-danger:hover { background: var(--err-600); color: #fff; }
.btn-ok { background: var(--ok-100); color: var(--ok-600); }
.btn-ok:hover { background: var(--ok-600); color: #fff; }
.btn-sm { padding: 7px 13px; font-size: .84rem; border-radius: 9px; }
.btn-lg { padding: 15px 30px; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* ---------------- forms ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: .88rem; font-weight: 700; color: var(--ink-700); }
.field > label .req { color: var(--err-600); }
.input, .select, .textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm); background: #fff; color: var(--ink-900);
  transition: .16s; font-size: .95rem;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 4px rgba(20,184,166,.14);
}
.textarea { min-height: 88px; resize: vertical; line-height: 1.6; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M6 8 0 0h12z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 13px center; padding-left: 34px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 860px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.help { font-size: .78rem; color: var(--ink-500); }
.error-text { font-size: .84rem; color: var(--err-600); font-weight: 700; }

.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: .9rem; }
.check input { width: 18px; height: 18px; accent-color: var(--brand-600); margin-top: 3px; flex: none; }

/* ---------------- cards ---------------- */
.card { background: #fff; border: 1px solid var(--ink-200); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-hd { padding: 16px 20px; border-bottom: 1px solid var(--ink-200); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-hd h3 { font-size: 1.02rem; }
.card-bd { padding: 20px; }

/* ---------------- stat tiles ---------------- */
.stat {
  background: #fff; border: 1px solid var(--ink-200); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat::after { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px; background: var(--brand-500); }
.stat.amber::after { background: var(--amber-500); }
.stat.info::after { background: var(--info-600); }
.stat.err::after { background: var(--err-600); }
.stat .lbl { font-size: .8rem; color: var(--ink-500); font-weight: 700; }
.stat .val { font-size: 1.65rem; font-weight: 800; color: var(--ink-900); line-height: 1.25; }
.stat .sub { font-size: .75rem; color: var(--ink-400); }

/* ---------------- badges ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 800;
  background: var(--ink-100); color: var(--ink-600); white-space: nowrap;
}
.badge-ok { background: var(--ok-100); color: var(--ok-600); }
.badge-warn { background: var(--warn-100); color: var(--warn-600); }
.badge-err { background: var(--err-100); color: var(--err-600); }
.badge-info { background: var(--info-100); color: var(--info-600); }
.badge-brand { background: var(--brand-100); color: var(--brand-700); }

/* ---------------- tables ---------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; background: #fff; font-size: .9rem; }
table.tbl th {
  text-align: start; padding: 12px 14px; background: var(--ink-100); color: var(--ink-700);
  font-size: .8rem; font-weight: 800; white-space: nowrap; border-bottom: 1px solid var(--ink-200);
}
table.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--ink-100); vertical-align: middle; }
table.tbl tbody tr:hover { background: var(--brand-50); }
table.tbl tbody tr:last-child td { border-bottom: none; }
.tbl-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------------- empty state ---------------- */
.empty { padding: 44px 20px; text-align: center; color: var(--ink-500); }
.empty .ico { font-size: 2.6rem; color: var(--ink-200); margin-bottom: 12px; }
.empty h3 { color: var(--ink-700); margin-bottom: 6px; }

/* ---------------- toast ---------------- */
#toasts { position: fixed; top: 16px; inset-inline-start: 50%; transform: translateX(50%); z-index: 9000; display: flex; flex-direction: column; gap: 9px; width: min(92vw, 400px); }
.toast {
  background: #fff; border: 1px solid var(--ink-200); border-inline-start: 4px solid var(--brand-500);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 13px 15px;
  display: flex; gap: 11px; align-items: flex-start; animation: slideIn .25s ease;
}
.toast.ok { border-inline-start-color: var(--ok-600); }
.toast.err { border-inline-start-color: var(--err-600); }
.toast.warn { border-inline-start-color: var(--amber-500); }
.toast .ti { flex: none; font-size: 1.05rem; }
.toast .tx { flex: 1; font-size: .89rem; font-weight: 600; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }

/* ---------------- modal ---------------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(11,18,32,.55); backdrop-filter: blur(3px);
  z-index: 8000; display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal {
  background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; animation: pop .2s ease;
}
.modal.wide { max-width: 880px; }
.modal-hd { padding: 18px 22px; border-bottom: 1px solid var(--ink-200); display: flex; align-items: center; justify-content: space-between; }
.modal-hd h3 { font-size: 1.1rem; }
.modal-bd { padding: 22px; }
.modal-ft { padding: 16px 22px; border-top: 1px solid var(--ink-200); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.x-btn { background: none; border: none; font-size: 1.5rem; line-height: 1; color: var(--ink-400); cursor: pointer; padding: 0 4px; }
.x-btn:hover { color: var(--err-600); }

/* ---------------- splash / loader ---------------- */
.loader { display: flex; align-items: center; justify-content: center; padding: 50px; }
.spin {
  width: 34px; height: 34px; border: 3px solid var(--brand-100);
  border-top-color: var(--brand-600); border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--ink-100) 25%, var(--ink-50) 50%, var(--ink-100) 75%); background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: 8px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ============================================================
   LANDING
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 500; background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--ink-200);
}
.topbar .inner { display: flex; align-items: center; justify-content: space-between; gap: 14px; height: 68px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; color: var(--brand-800); }
.logo .mark {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-800));
  color: #fff; display: grid; place-items: center; font-size: 1.15rem; font-weight: 800;
  box-shadow: 0 6px 16px -6px rgba(15,118,110,.7);
}
.logo .tag { font-size: .66rem; color: var(--ink-500); font-weight: 600; display: block; margin-top: -4px; }
.nav-links { display: flex; gap: 22px; font-size: .92rem; font-weight: 700; }
.nav-links a { color: var(--ink-700); }
.nav-links a:hover { color: var(--brand-600); }
@media (max-width: 900px) { .nav-links { display: none; } }

.hero { position: relative; padding: 72px 0 60px; overflow: hidden; background: linear-gradient(160deg, var(--brand-50), #fff 55%); }
.hero::before {
  content: ""; position: absolute; width: 620px; height: 620px; border-radius: 50%;
  background: radial-gradient(circle, rgba(45,212,191,.20), transparent 66%);
  top: -240px; inset-inline-start: -160px;
}
.hero .grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 44px; align-items: center; position: relative; }
@media (max-width: 940px) { .hero .grid { grid-template-columns: 1fr; } }
.hero p.lede { font-size: 1.1rem; color: var(--ink-600); max-width: 56ch; margin-top: 16px; }
.hero .cta { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.hero .trust { display: flex; gap: 26px; margin-top: 32px; flex-wrap: wrap; }
.hero .trust b { font-size: 1.5rem; color: var(--brand-700); display: block; }
.hero .trust span { font-size: .82rem; color: var(--ink-500); }
.panel-visual {
  background: #fff; border: 1px solid var(--ink-200); border-radius: 20px;
  box-shadow: var(--shadow-lg); padding: 16px; transform: rotate(-1.2deg);
}
.panel-visual .bar { display: flex; gap: 6px; margin-bottom: 12px; }
.panel-visual .bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-200); display: block; }
.pv-row { display: flex; align-items: center; gap: 11px; padding: 10px; border-radius: 11px; background: var(--ink-50); margin-bottom: 8px; }
.pv-row .ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-100); color: var(--brand-700); flex: none; }

.features { padding: 68px 0; }
.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 34px; }
@media (max-width: 900px) { .feat-grid { grid-template-columns: 1fr; } }
.feat { background: #fff; border: 1px solid var(--ink-200); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); transition: .2s; }
.feat:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand-100); }
.feat .ic {
  width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand-600); font-size: 1.35rem; margin-bottom: 14px;
}
.feat h3 { font-size: 1.05rem; margin-bottom: 7px; }
.feat p { font-size: .9rem; color: var(--ink-500); }

.steps { padding: 62px 0; background: var(--ink-100); }
.step-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 34px; }
@media (max-width: 900px) { .step-list { grid-template-columns: 1fr; } }
.step { background: #fff; border-radius: var(--radius); padding: 24px; position: relative; border: 1px solid var(--ink-200); }
.step .n {
  width: 38px; height: 38px; border-radius: 11px; background: var(--brand-600); color: #fff;
  display: grid; place-items: center; font-weight: 800; margin-bottom: 13px;
}
.step h3 { font-size: 1.02rem; margin-bottom: 7px; }
.step p { font-size: .89rem; color: var(--ink-500); }

.roles { padding: 68px 0; }
.role-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 34px; }
@media (max-width: 900px) { .role-cards { grid-template-columns: 1fr; } }
.role-card { border: 2px solid var(--ink-200); border-radius: var(--radius); padding: 26px; background: #fff; transition: .2s; display: flex; flex-direction: column; gap: 12px; }
.role-card:hover { border-color: var(--brand-500); box-shadow: var(--shadow); }
.role-card .ic { width: 54px; height: 54px; border-radius: 15px; display: grid; place-items: center; font-size: 1.5rem; }
.role-card.a .ic { background: var(--brand-100); color: var(--brand-700); }
.role-card.b .ic { background: var(--amber-100); color: var(--amber-600); }
.role-card.c .ic { background: var(--info-100); color: var(--info-600); }
.role-card ul { list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: .89rem; color: var(--ink-600); }
.role-card ul li::before { content: "✓"; color: var(--ok-600); font-weight: 800; margin-inline-end: 8px; }

.faq { padding: 62px 0; background: var(--ink-100); }
details.qa { background: #fff; border: 1px solid var(--ink-200); border-radius: var(--radius-sm); padding: 15px 18px; margin-bottom: 10px; }
details.qa summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
details.qa summary::-webkit-details-marker { display: none; }
details.qa summary::after { content: "+"; color: var(--brand-600); font-weight: 800; font-size: 1.2rem; }
details.qa[open] summary::after { content: "−"; }
details.qa p { margin-top: 10px; font-size: .92rem; color: var(--ink-600); }

footer.site { background: var(--brand-900); color: #cbd5e1; padding: 48px 0 26px; }
footer.site h4 { color: #fff; font-size: .95rem; margin-bottom: 11px; }
footer.site a { color: #a7f3d0; font-size: .89rem; display: block; margin-bottom: 7px; }
footer.site .cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 30px; }
@media (max-width: 800px) { footer.site .cols { grid-template-columns: 1fr; } }
footer.site .btm { border-top: 1px solid rgba(255,255,255,.12); margin-top: 30px; padding-top: 18px; font-size: .82rem; text-align: center; color: #94a3b8; }

/* ============================================================
   APP SHELL (portals)
   ============================================================ */
#app-loading { position: fixed; inset: 0; background: #fff; z-index: 9999; display: grid; place-items: center; }

.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
@media (max-width: 1000px) { .app { grid-template-columns: 1fr; } }

aside.side {
  background: var(--brand-900); color: #e2e8f0; padding: 18px 14px;
  display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
@media (max-width: 1000px) {
  aside.side { position: fixed; inset-inline-start: 0; top: 0; z-index: 600; transform: translateX(105%); transition: .24s; box-shadow: var(--shadow-lg); }
  aside.side.open { transform: none; }
  .side-backdrop { position: fixed; inset: 0; background: rgba(11,18,32,.5); z-index: 590; }
}
aside.side .brand { display: flex; align-items: center; gap: 10px; padding: 8px 8px 18px; color: #fff; }
aside.side .brand .mark { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, var(--brand-400), var(--brand-700)); display: grid; place-items: center; font-weight: 800; }
aside.side .brand small { display: block; font-size: .68rem; color: #7dd3fc; font-weight: 600; }
aside.side .grp { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #64748b; padding: 14px 10px 5px; font-weight: 800; }
aside.side a.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: #cbd5e1; font-size: .92rem; font-weight: 600; transition: .15s;
}
aside.side a.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
aside.side a.nav-item.active { background: var(--brand-600); color: #fff; }
aside.side a.nav-item .ic { width: 20px; text-align: center; flex: none; }
aside.side a.nav-item .cnt { margin-inline-start: auto; background: var(--amber-500); color: #3a2500; border-radius: 999px; font-size: .7rem; font-weight: 800; padding: 1px 7px; }
aside.side .side-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding-top: 12px; }
aside.side .who { display: flex; align-items: center; gap: 10px; padding: 8px; }
aside.side .who .av { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-500); color: #04302a; display: grid; place-items: center; font-weight: 800; flex: none; }
aside.side .who .nm { font-size: .86rem; font-weight: 700; color: #fff; }
aside.side .who .rl { font-size: .72rem; color: #94a3b8; }

main.main { min-width: 0; display: flex; flex-direction: column; }
.main-head {
  background: #fff; border-bottom: 1px solid var(--ink-200); padding: 14px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; position: sticky; top: 0; z-index: 400;
}
.main-head h1 { font-size: 1.2rem; }
.main-head .sub { font-size: .8rem; color: var(--ink-500); }
.main-body { padding: 22px; flex: 1; }
@media (max-width: 700px) { .main-body { padding: 14px; } .main-head { padding: 12px 14px; } }
.burger { display: none; }
@media (max-width: 1000px) { .burger { display: inline-flex; } }

.avatar-chip { display: inline-flex; align-items: center; gap: 8px; }
.avatar-chip .av { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-100); color: var(--brand-700); display: grid; place-items: center; font-weight: 800; font-size: .9rem; }
.bell { position: relative; }
.bell .dot { position: absolute; top: 2px; inset-inline-end: 2px; width: 9px; height: 9px; background: var(--err-600); border-radius: 50%; border: 2px solid #fff; }

/* ---------- banner / alert ---------- */
.alert { border-radius: var(--radius); padding: 15px 18px; display: flex; gap: 12px; align-items: flex-start; border: 1px solid; font-size: .92rem; }
.alert .ic { font-size: 1.25rem; flex: none; }
.alert.warn { background: var(--warn-100); border-color: #fcd34d; color: #78350f; }
.alert.err { background: var(--err-100); border-color: #fca5a5; color: #7f1d1d; }
.alert.ok { background: var(--ok-100); border-color: #6ee7b7; color: #064e3b; }
.alert.info { background: var(--info-100); border-color: #7dd3fc; color: #075985; }
.alert h4 { font-size: .98rem; margin-bottom: 3px; color: inherit; }

/* ---------- product grid ---------- */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 15px; }
.prod {
  background: #fff; border: 1px solid var(--ink-200); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: .18s;
}
.prod:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--brand-100); }
.prod .thumb { height: 128px; background: linear-gradient(135deg, var(--brand-50), var(--ink-100)); display: grid; place-items: center; color: var(--brand-400); font-size: 2.1rem; position: relative; overflow: hidden; }
.prod .thumb img { width: 100%; height: 100%; object-fit: cover; }
.prod .thumb .stock-tag { position: absolute; top: 8px; inset-inline-end: 8px; }
.prod .body { padding: 13px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.prod .nm { font-size: .95rem; font-weight: 700; color: var(--ink-900); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prod .sup { font-size: .76rem; color: var(--ink-500); }
.prod .pr { font-size: 1.16rem; font-weight: 800; color: var(--brand-700); }
.prod .pr small { font-size: .7rem; color: var(--ink-500); font-weight: 600; }
.prod .foot { margin-top: auto; display: flex; gap: 7px; align-items: center; }
.qty-box { display: inline-flex; align-items: center; border: 1px solid var(--ink-200); border-radius: 9px; overflow: hidden; flex: none; }
.qty-box button { width: 30px; height: 32px; background: var(--ink-50); border: none; cursor: pointer; font-weight: 800; color: var(--ink-600); }
.qty-box button:hover { background: var(--brand-100); color: var(--brand-700); }
.qty-box input { width: 42px; height: 32px; border: none; text-align: center; font-weight: 700; }

/* ---------- cart drawer ---------- */
.drawer-bg { position: fixed; inset: 0; background: rgba(11,18,32,.5); z-index: 7000; }
.drawer {
  position: fixed; inset-inline-end: 0; top: 0; bottom: 0; width: min(94vw, 420px);
  background: #fff; z-index: 7100; display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.drawer-hd { padding: 16px 18px; border-bottom: 1px solid var(--ink-200); display: flex; justify-content: space-between; align-items: center; }
.drawer-bd { flex: 1; overflow-y: auto; padding: 16px 18px; }
.drawer-ft { padding: 16px 18px; border-top: 1px solid var(--ink-200); background: var(--ink-50); }
.cart-line { display: flex; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--ink-100); }
.cart-line .nm { font-size: .89rem; font-weight: 700; }
.cart-line .meta { font-size: .78rem; color: var(--ink-500); }
.sum-row { display: flex; justify-content: space-between; font-size: .9rem; padding: 5px 0; }
.sum-row.total { font-size: 1.12rem; font-weight: 800; color: var(--brand-700); border-top: 1px dashed var(--ink-200); margin-top: 7px; padding-top: 11px; }

/* ---------- timeline ---------- */
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: flex; gap: 13px; padding-bottom: 20px; position: relative; }
.tl-item:not(:last-child)::before { content: ""; position: absolute; inset-inline-start: 15px; top: 32px; bottom: 0; width: 2px; background: var(--ink-200); }
.tl-item .dot { width: 32px; height: 32px; border-radius: 50%; background: var(--ink-100); color: var(--ink-500); display: grid; place-items: center; flex: none; z-index: 1; font-size: .85rem; }
.tl-item.done .dot { background: var(--ok-100); color: var(--ok-600); }
.tl-item.now .dot { background: var(--brand-600); color: #fff; }
.tl-item .tx b { font-size: .93rem; }
.tl-item .tx p { font-size: .8rem; color: var(--ink-500); }

/* ---------- misc ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--ink-200); }
.tab {
  padding: 10px 16px; background: none; border: none; border-bottom: 3px solid transparent;
  font-weight: 700; font-size: .9rem; color: var(--ink-500); cursor: pointer;
}
.tab.active { color: var(--brand-700); border-bottom-color: var(--brand-600); }
.tab:hover { color: var(--brand-600); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--ink-200); background: #fff;
  font-size: .84rem; font-weight: 700; color: var(--ink-600); cursor: pointer;
}
.chip.active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 150px; }
.divider { height: 1px; background: var(--ink-200); margin: 16px 0; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--ink-100); font-size: .89rem; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--ink-500); font-weight: 600; }
.kv .v { font-weight: 700; color: var(--ink-800); text-align: end; }
.pill-note { background: var(--brand-50); border: 1px dashed var(--brand-100); color: var(--brand-700); padding: 11px 14px; border-radius: var(--radius-sm); font-size: .85rem; }
.load-more { text-align: center; padding: 18px; }
.copy-box { display: flex; gap: 8px; align-items: center; background: var(--ink-50); border: 1px solid var(--ink-200); border-radius: 9px; padding: 8px 11px; }
.copy-box code { flex: 1; font-size: .85rem; direction: ltr; text-align: left; }
.file-drop { border: 2px dashed var(--ink-200); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--ink-500); font-size: .88rem; cursor: pointer; }
.file-drop:hover { border-color: var(--brand-500); background: var(--brand-50); color: var(--brand-700); }
@media print { aside.side, .main-head, .btn { display: none !important; } .app { grid-template-columns: 1fr; } }

/* ============================================================
   PWA — شريط التثبيت العائم + نافذة تعليمات التثبيت
   ============================================================ */

.install-bar {
  position: fixed;
  inset-inline: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #0e766e, #06322c);
  color: #f0fdfa;
  border-radius: 16px;
  box-shadow: 0 12px 34px rgba(6, 50, 44, .34);
  animation: installBarIn .42s cubic-bezier(.2, .9, .3, 1.1) both;
  max-width: 620px;
  margin-inline: auto;
}
@keyframes installBarIn {
  from { opacity: 0; transform: translateY(26px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.install-bar-icon {
  flex: none;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: rgba(255, 255, 255, .17);
  font-size: 1rem;
}
.install-bar-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.install-bar-text b { font-size: .9rem; font-weight: 800; }
.install-bar-text small { font-size: .73rem; opacity: .82; }
.install-bar .btn { flex: none; padding: 8px 14px; font-size: .8rem; }
.install-bar-x {
  flex: none;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 0; border-radius: 9px;
  background: transparent; color: rgba(255, 255, 255, .72);
  cursor: pointer; font-size: .9rem;
}
.install-bar-x:hover { background: rgba(255, 255, 255, .14); color: #fff; }

/* نافذة التعليمات */
.install-help { display: flex; flex-direction: column; gap: 14px; }
.install-help-share {
  align-self: center;
  width: 58px; height: 58px;
  display: grid; place-items: center;
  border-radius: 15px;
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  color: var(--brand-700);
  font-size: 1.5rem;
  animation: sharePulse 1.9s ease-in-out infinite;
}
@keyframes sharePulse {
  0%, 100% { transform: translateY(0); box-shadow: 0 0 0 0 rgba(20, 184, 166, .30); }
  50%      { transform: translateY(-5px); box-shadow: 0 0 0 12px rgba(20, 184, 166, 0); }
}
.install-steps { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 11px; }
.install-steps li { font-size: .92rem; line-height: 1.75; color: var(--ink-700); }
.install-steps li b { color: var(--ink-900); font-weight: 800; }
.install-note {
  display: flex; gap: 9px; align-items: flex-start;
  background: var(--brand-50);
  border: 1px dashed var(--brand-100);
  color: var(--brand-700);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: .84rem; line-height: 1.65;
}
.install-note i { margin-top: 3px; }

/* عند التثبيت: نُبعد الشريط عن أزرار النظام */
@media (display-mode: standalone) { .install-bar { display: none !important; } }
@media (max-width: 420px) {
  .install-bar-text small { display: none; }
  .install-bar .btn { padding: 8px 11px; }
}
