/* ═══════════════════════════════════════════════════════════════
   كتالوج سند — مخبر ابن سينا
   نظام تصميم عصري: زجاج شفاف، تدرّجات ناعمة، حركات 200ms.
   ألوان شعار مخبر ابن سينا: الأزرق #299ccb والرمادي #636977 والأبيض.
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* ألوان العلامة — من شعار المخبر (ibnsina_mark.svg) */
  --lab-blue: #299ccb;      /* خط المثلث */
  --lab-deep: #1b6f94;      /* أزرق أغمق للنص فوق الأبيض */
  --lab-grey: #636977;      /* تعبئة المثلث */
  --lab-dark: #3f4552;      /* رمادي غامق من نفس درجة الشعار */
  --lab-sky: #9fd3ea;       /* أزرق فاتح */

  /* محايدات باردة من رمادي الشعار */
  --bg: #f3f6f8;
  --card: rgba(255, 255, 255, .72);
  --card-solid: #ffffff;
  --ink: #1d222b;
  --ink-2: #4a505c;
  --ink-3: #767d8a;
  --line: rgba(29, 34, 43, .09);
  --line-strong: rgba(29, 34, 43, .16);
  --tile: rgba(29, 34, 43, .045);

  /* حالات */
  --ok: #0f6136; --ok-bg: rgba(16, 97, 54, .07); --ok-line: rgba(16, 97, 54, .22);
  --err: #a80000; --err-bg: rgba(221, 0, 0, .06); --err-line: rgba(221, 0, 0, .22);

  /* سلّم الخطوط — الأساسي 14، الأزرار 16 */
  --fs-xs: 13px;
  --fs-base: 14px;
  --fs-md: 15px;
  --fs-btn: 16px;
  --fs-h2: 19px;
  --fs-lg: 20px;
  --fs-display: 26px;

  /* مسافات */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px;
  --s5: 22px; --s6: 30px; --s7: 42px; --s8: 60px;

  /* زوايا */
  --r: 20px; --r-sm: 14px; --r-tile: 15px; --r-pill: 999px;

  /* ظلال ناعمة */
  --sh-1: 0 1px 2px rgba(29,34,43,.03), 0 2px 8px rgba(29,34,43,.035);
  --sh-2: 0 2px 5px rgba(29,34,43,.035), 0 12px 30px rgba(29,34,43,.06);
  --sh-3: 0 6px 12px rgba(29,34,43,.05), 0 22px 48px rgba(29,34,43,.09);

  --glass: blur(16px) saturate(1.5);
  --t: 200ms cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--ink);
  /* خط النظام فوراً، وIBM Plex بيحل محله لما ينزل (fonts.css بعد ما تبين الصفحة) */
  font-family: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", "Geeza Pro", Roboto, sans-serif;
  font-size: var(--fs-base);
  line-height: 1.85;
  letter-spacing: -.003em;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  /* تدرّجات ناعمة من ألوان العلامة — خافتة كتير حتى يبان الزجاج */
  background:
    radial-gradient(1100px 620px at 108% -12%, rgba(41, 156, 203, .13), transparent 62%),
    radial-gradient(880px 520px at -14% 16%, rgba(99, 105, 119, .08), transparent 60%),
    radial-gradient(760px 700px at 50% 118%, rgba(27, 111, 148, .05), transparent 64%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}

.wrap { max-width: 600px; margin: 0 auto; padding: 0 var(--s4) var(--s8); }

/* ─────────── شاشة الافتتاح ─────────── */
#splash {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-items: center;
  background:
    radial-gradient(900px 700px at 50% 42%, #1c2e3a 0%, #122029 58%, #0b151c 100%);
  transition: opacity 420ms ease, visibility 420ms;
}
#splash.gone { opacity: 0; visibility: hidden; pointer-events: none; }
#splash canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#splash .sp-inner { position: relative; text-align: center; z-index: 2; padding: var(--s6) var(--s5); }
#splash .sp-inner::before {
  content: ""; position: absolute; inset: -18% -32%;
  background: radial-gradient(closest-side, rgba(11,21,28,.92), rgba(11,21,28,.55) 58%, transparent 100%);
  z-index: -1;
}
#splash .sp-logo {
  width: 230px; max-width: 64vw; height: auto;
  filter: brightness(0) invert(1);
  opacity: 0; animation: spIn 700ms 120ms cubic-bezier(.2,.8,.2,1) forwards;
}
#splash .sp-tag {
  margin-top: var(--s3); color: rgba(255,255,255,.62);
  font-size: var(--fs-base); letter-spacing: .12em;
  opacity: 0; animation: spIn 700ms 340ms cubic-bezier(.2,.8,.2,1) forwards;
}
#splash .sp-bar {
  width: 120px; height: 3px; margin: var(--s5) auto 0; border-radius: 2px;
  background: linear-gradient(90deg, var(--lab-grey), var(--lab-blue), var(--lab-sky));
  transform-origin: right center; transform: scaleX(0);
  animation: spBar 1900ms 200ms linear forwards;
}
#splash .sp-skip {
  position: absolute; bottom: max(28px, env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  background: rgba(255,255,255,.1); color: rgba(255,255,255,.85);
  border: 1px solid rgba(255,255,255,.2); border-radius: var(--r-pill);
  padding: 9px 22px; font-family: inherit; font-size: var(--fs-base);
  cursor: pointer; backdrop-filter: blur(8px);
  transition: background var(--t), transform var(--t);
  z-index: 3;
}
#splash .sp-skip:hover { background: rgba(255,255,255,.2); }
#splash .sp-skip:active { transform: translateX(-50%) scale(.96); }
@keyframes spIn { to { opacity: 1; } }
@keyframes spBar { to { transform: scaleX(1); } }

/* ─────────── الترويسة ─────────── */
/* طبقة بيضا شفافة خفيفة فوق الصفحة (بلا خطوط وبلا blur) */
.brandbar {
  height: 14px; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.85), rgba(255,255,255,0));
}

header.top { text-align: center; padding: var(--s7) 0 var(--s5); }
header.top img.logo { display: block; margin: 0 auto; width: 244px; max-width: 72%; height: auto; }
header.top .sub {
  display: inline-block; margin-top: var(--s4);
  padding: 6px var(--s5);
  background: var(--card); backdrop-filter: var(--glass);
  border: 1px solid rgba(255,255,255,.65);
  border-radius: var(--r-pill);
  color: var(--ink-2); font-size: var(--fs-xs); font-weight: 500;
  letter-spacing: .1em; box-shadow: var(--sh-1);
}

/* ─────────── ظهور عند التمرير ─────────── */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity var(--t), transform var(--t); }
.reveal.in { opacity: 1; transform: none; }

/* ─────────── الأزرار الكبيرة ─────────── */
.big-btn {
  display: flex; align-items: center; gap: var(--s4); width: 100%;
  background: var(--card); backdrop-filter: var(--glass);
  color: var(--ink);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: var(--r);
  padding: var(--s5); margin: 0 0 var(--s3);
  text-align: right; font-family: inherit;
  font-size: var(--fs-lg); font-weight: 600; line-height: 1.45;
  box-shadow: var(--sh-1); cursor: pointer;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.big-btn:hover { box-shadow: var(--sh-2); transform: translateY(-2px); }
.big-btn:active { transform: scale(.985); box-shadow: var(--sh-1); }
.big-btn:focus-visible { outline: 2px solid var(--lab-blue); outline-offset: 3px; }
.big-btn[disabled] { opacity: .5; pointer-events: none; }

.big-btn .ico {
  flex: 0 0 52px; width: 52px; height: 52px; border-radius: var(--r-tile);
  display: grid; place-items: center; background: var(--tile);
  transition: background var(--t);
}
.big-btn .ico svg { width: 24px; height: 24px; color: var(--ink); }

/* درجات ألوان المخبر: رمادي الشعار ← أزرق الشعار ← أزرق فاتح.
   ألوان هادية بشفافية خفيفة ولمسة زجاجية، مو فاقعة (أسماء الأصناف قديمة، الألوان جديدة). */
.big-btn.t-black  { border-color: rgba(99, 105, 119, .24); background: rgba(99, 105, 119, .06); }
.big-btn.t-maroon { border-color: rgba(41, 156, 203, .24); background: rgba(41, 156, 203, .065); }
.big-btn.t-gold   { border-color: rgba(95, 175, 212, .30); background: rgba(159, 211, 234, .14); }

.big-btn.t-black .ico {
  background: linear-gradient(150deg, rgba(122,129,144,.94), rgba(76,82,96,.96));
  box-shadow: 0 4px 14px rgba(63,69,82,.22), inset 0 1px 0 rgba(255,255,255,.14);
}
.big-btn.t-maroon .ico {
  background: linear-gradient(150deg, rgba(56,170,215,.92), rgba(27,111,148,.95));
  box-shadow: 0 4px 14px rgba(27,111,148,.24), inset 0 1px 0 rgba(255,255,255,.14);
}
.big-btn.t-gold .ico {
  background: linear-gradient(150deg, rgba(190,228,244,.95), rgba(122,192,224,.96));
  box-shadow: 0 4px 14px rgba(90,160,195,.24), inset 0 1px 0 rgba(255,255,255,.4);
}
.big-btn.t-black .ico svg, .big-btn.t-maroon .ico svg { color: #fff; }
.big-btn.t-gold .ico svg { color: #0f3d52; }
.big-btn.t-black:hover  { border-color: rgba(99,105,119,.38); }
.big-btn.t-maroon:hover { border-color: rgba(41,156,203,.40); }
.big-btn.t-gold:hover   { border-color: rgba(95,175,212,.48); }

.big-btn .txt { flex: 1; min-width: 0; }
.big-btn .hint {
  display: block; margin-top: 2px;
  font-size: var(--fs-base); font-weight: 400; color: var(--ink-2); line-height: 1.65;
}
.big-btn .chev { flex: 0 0 auto; display: grid; place-items: center; color: var(--ink-3); }
.big-btn .chev svg { width: 18px; height: 18px; }

/* ─────────── الشاشات والبطاقات ─────────── */
.screen { display: none; }
.screen.on { display: block; animation: rise var(--t) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .screen.on, .bubble, .msg { animation: none; }
  .reveal { opacity: 1; transform: none; }
  * { transition-duration: 1ms !important; }
}

.card {
  background: var(--card); backdrop-filter: var(--glass);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: var(--r); padding: var(--s5); margin: 0 0 var(--s4);
  box-shadow: var(--sh-1);
}
.card h2 {
  margin: 0 0 var(--s2);
  font-size: var(--fs-h2); font-weight: 600; line-height: 1.45; letter-spacing: -.012em;
}
.card h2::after {
  content: ""; display: block; width: 30px; height: 2.5px; margin-top: var(--s3);
  background: linear-gradient(90deg, var(--lab-blue), rgba(41,156,203,.2));
  border-radius: 2px;
}
.card p.lead { margin: 0 0 var(--s4); color: var(--ink-2); font-size: var(--fs-md); }

/* ─────────── زر الرجوع ─────────── */
.back {
  display: inline-flex; align-items: center; gap: var(--s2);
  margin: 0 0 var(--s4);
  padding: 7px var(--s3) 7px var(--s4);
  background: var(--card); backdrop-filter: var(--glass);
  border: 1px solid rgba(255,255,255,.7); border-radius: var(--r-pill);
  color: var(--ink); font: inherit; font-size: var(--fs-base); font-weight: 500;
  cursor: pointer; box-shadow: var(--sh-1);
  transition: transform var(--t), box-shadow var(--t);
}
.back:hover { box-shadow: var(--sh-2); }
.back:active { transform: scale(.97); }
.back:focus-visible { outline: 2px solid var(--lab-blue); outline-offset: 2px; }
.back svg { width: 17px; height: 17px; color: var(--ink-2); transition: transform var(--t); }
.back:hover svg { transform: translateX(3px); }

/* ─────────── الأزرار ─────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  width: 100%; min-height: 52px;
  padding: var(--s3) var(--s5); border-radius: var(--r-sm);
  font-family: inherit; font-size: var(--fs-btn); font-weight: 600; letter-spacing: -.008em;
  border: 1px solid var(--lab-dark);
  background: linear-gradient(160deg, #4b5261, var(--lab-dark)); color: #fff;
  cursor: pointer; box-shadow: var(--sh-1);
  transition: transform var(--t), box-shadow var(--t), filter var(--t);
}
.btn:hover { box-shadow: var(--sh-2); filter: brightness(1.12); }
.btn:active { transform: scale(.985); box-shadow: none; }
.btn:focus-visible { outline: 2px solid var(--lab-blue); outline-offset: 3px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; }

.btn.ghost {
  background: rgba(255,255,255,.6); backdrop-filter: var(--glass);
  color: var(--ink); border-color: var(--line-strong);
}
.btn.danger { background: linear-gradient(160deg, #38aad7, var(--lab-blue)); border-color: var(--lab-blue); }  /* زر «ابدأ المكالمة» */

.row { display: flex; gap: var(--s3); }
.row .btn { width: auto; flex: 1; }

/* ─────────── الحقول ─────────── */
input[type="text"], input[type="email"], input[type="tel"], textarea, select {
  width: 100%; font-family: inherit; font-size: var(--fs-btn);
  padding: var(--s3) var(--s4);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: rgba(255,255,255,.72); backdrop-filter: blur(8px); color: var(--ink);
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--ink); background: #fff;
  box-shadow: 0 0 0 3px rgba(29,34,43,.07);
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
label { display: block; margin: 0 0 var(--s2); font-size: var(--fs-base); font-weight: 600; }

/* ─────────── تنويهات ورسائل ─────────── */
.note {
  background: rgba(255,255,255,.5); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-right: 2.5px solid var(--lab-blue);
  border-radius: var(--r-sm); padding: var(--s3) var(--s4); margin: var(--s4) 0 0;
  font-size: var(--fs-base); color: var(--ink-2); line-height: 1.75;
}
.note.red { border-right-color: var(--lab-deep); }

.msg {
  border-radius: var(--r-sm); padding: var(--s3) var(--s4); margin: var(--s3) 0;
  font-size: var(--fs-base); line-height: 1.7; animation: rise var(--t) both;
  backdrop-filter: blur(8px);
}
.msg.err { background: var(--err-bg); border: 1px solid var(--err-line); color: var(--err); }
.msg.ok  { background: var(--ok-bg);  border: 1px solid var(--ok-line);  color: var(--ok); }
.msg[hidden] { display: none; }

/* ─────────── المكالمة ─────────── */
.dial { text-align: center; padding: var(--s4) 0 var(--s2); }
.pulse {
  width: 104px; height: 104px; margin: 0 auto var(--s4); border-radius: 50%;
  background: rgba(255,255,255,.62); backdrop-filter: var(--glass);
  border: 1px solid rgba(255,255,255,.8);
  display: grid; place-items: center; box-shadow: var(--sh-2);
  transition: background var(--t), border-color var(--t);
}
.pulse svg { width: 38px; height: 38px; color: var(--ink); transition: color var(--t); }
.pulse.live { background: linear-gradient(150deg, #38aad7, var(--lab-blue)); border-color: var(--lab-blue); animation: ring 1.8s ease-out infinite; }
.pulse.live svg { color: #fff; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(41,156,203,.34); } 100% { box-shadow: 0 0 0 24px rgba(41,156,203,0); } }
.timer { font-size: 34px; font-weight: 600; letter-spacing: .02em; font-variant-numeric: tabular-nums; line-height: 1.25; }
.state { font-size: var(--fs-base); color: var(--ink-2); min-height: 26px; margin-bottom: var(--s4); }

/* ─────────── المحادثة ─────────── */
.chat { display: flex; flex-direction: column; gap: var(--s2); max-height: 54vh; overflow-y: auto; padding: var(--s1) 2px; }
.bubble {
  max-width: 86%; padding: var(--s3) var(--s4); border-radius: 16px;
  font-size: var(--fs-md); line-height: 1.75; white-space: pre-wrap; word-wrap: break-word;
  animation: rise var(--t) both;
}
.bubble.me { align-self: flex-start; background: linear-gradient(160deg, #4b5261, var(--lab-dark)); color: #fff; border-bottom-left-radius: 5px; }
.bubble.bot { align-self: flex-end; background: rgba(255,255,255,.78); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.8); box-shadow: var(--sh-1); border-bottom-right-radius: 5px; }
.bubble.typing { color: var(--ink-3); }

.composer { display: flex; gap: var(--s2); margin-top: var(--s4); align-items: flex-end; }
.composer textarea { resize: none; height: 52px; }
.icon-btn {
  flex: 0 0 52px; width: 52px; height: 52px; border-radius: var(--r-sm);
  border: 1px solid var(--lab-dark); background: linear-gradient(160deg, #4b5261, var(--lab-dark)); color: #fff;
  display: grid; place-items: center; cursor: pointer; box-shadow: var(--sh-1);
  transition: transform var(--t), box-shadow var(--t), filter var(--t);
}
.icon-btn:hover { box-shadow: var(--sh-2); filter: brightness(1.12); }
.icon-btn:active { transform: scale(.95); }
.icon-btn:focus-visible { outline: 2px solid var(--lab-blue); outline-offset: 3px; }
.icon-btn.rec { background: rgba(255,255,255,.62); backdrop-filter: var(--glass); border-color: var(--line-strong); color: var(--ink); }
.icon-btn.rec.on { background: linear-gradient(150deg, #38aad7, var(--lab-blue)); border-color: var(--lab-blue); color: #fff; animation: ring 1.4s infinite; }
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn:disabled { opacity: .45; }

/* ─────────── النتيجة ─────────── */
.code-input { font-size: 30px; text-align: center; letter-spacing: .22em; font-weight: 600; font-variant-numeric: tabular-nums; padding: var(--s4); }
.receipt-img { width: 100%; border-radius: var(--r-sm); border: 1px solid var(--line); display: block; height: auto; box-shadow: var(--sh-1); }
details.receipt { margin: 0 0 var(--s5); }
details.receipt summary {
  display: flex; align-items: center; gap: var(--s2); cursor: pointer; list-style: none;
  font-size: var(--fs-base); font-weight: 600; color: var(--ink); padding: var(--s2) 0;
  transition: color var(--t);
}
details.receipt summary::-webkit-details-marker { display: none; }
details.receipt summary:hover { color: var(--lab-blue); }
details.receipt summary svg { width: 16px; height: 16px; color: var(--ink-3); transition: transform var(--t); }
details.receipt[open] summary svg { transform: rotate(-90deg); }
details.receipt[open] .receipt-img { animation: rise var(--t) both; }

hr.sep { border: none; border-top: 1px solid var(--line); margin: var(--s6) 0 var(--s5); }

/* ─────────── التذييل ─────────── */
footer.bottom { text-align: center; padding: var(--s7) 0 var(--s4); color: var(--ink-3); }
footer.bottom .by { font-size: var(--fs-base); font-weight: 600; color: var(--ink-2); letter-spacing: .02em; }
footer.bottom img { width: 76px; height: auto; display: block; margin: var(--s3) auto var(--s2); opacity: .95; }
footer.bottom .tiny { font-size: var(--fs-xs); color: var(--ink-3); }

/* ─────────── التثبيت ─────────── */
.install { display: none; margin-top: var(--s4); background: rgba(255,255,255,.6); backdrop-filter: var(--glass); color: var(--ink); border-color: var(--line-strong); }
.install.show { display: inline-flex; }
.install svg { color: var(--ink-2); }

.spin { display: inline-block; width: 17px; height: 17px; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ─────────── انتهاء الفترة ─────────── */
#expired .card { border-color: var(--err-line); text-align: center; }
#expired .card h2::after { margin-inline: auto; background: var(--lab-blue); }
#expired .glyph {
  width: 64px; height: 64px; margin: 0 auto var(--s4); border-radius: 50%;
  background: var(--err-bg); border: 1px solid var(--err-line); display: grid; place-items: center;
}
#expired .glyph svg { width: 28px; height: 28px; color: var(--lab-blue); }

/* ─────────── شاشات صغيرة ─────────── */
@media (max-width: 380px) {
  :root { --fs-lg: 18px; --fs-h2: 18px; --s5: 18px; }
  .big-btn { padding: var(--s4); gap: var(--s3); }
  .big-btn .ico { flex-basis: 46px; width: 46px; height: 46px; }
  header.top img.logo { width: 210px; }
}

/* متصفحات بلا دعم backdrop-filter */
@supports not (backdrop-filter: blur(4px)) {
  .card, .big-btn, .back, .pulse, .bubble.bot, header.top .sub { background: rgba(255,255,255,.93); }
}

/* ─────────── مؤشرات الحالة (متل الواتساب) ─────────── */
.state { display: flex; align-items: center; justify-content: center; gap: var(--s2); }
.dot {
  width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; display: inline-block;
}
.dot.rec { background: var(--lab-blue); animation: blink 1s ease-in-out infinite; }
.dot.work { background: var(--lab-sky); animation: blink 1.1s ease-in-out infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.bubble.typing { display: flex; align-items: center; gap: var(--s2); }

/* ─────────── زر تشغيل الرد الصوتي ─────────── */
.play-btn {
  display: inline-flex; align-items: center; gap: var(--s2);
  margin-top: var(--s3); padding: 7px var(--s4);
  background: linear-gradient(160deg, #4b5261, var(--lab-dark)); color: #fff;
  border: none; border-radius: var(--r-pill);
  font-family: inherit; font-size: var(--fs-xs); font-weight: 600;
  cursor: pointer; transition: transform var(--t), filter var(--t);
}
.play-btn:hover { filter: brightness(1.15); }
.play-btn:active { transform: scale(.96); }
.play-btn svg { width: 14px; height: 14px; }
.play-btn.on { background: linear-gradient(150deg, #38aad7, var(--lab-blue)); }
.play-btn.on svg { animation: blink 1s infinite; }

/* ─────────── شعار المخبر ─────────── */
header.top img.mark {
  display: block; margin: 0 auto var(--s3);
  width: 62px; height: auto;
}

/* ─────────── شعار شاشة الافتتاح (يرسم حالو) ─────────── */
#splash .sp-plate {
  width: 132px; height: 132px; margin: 0 auto var(--s5);
  background: #fff; border-radius: 26px;
  display: grid; place-items: center;
  box-shadow: 0 14px 44px rgba(0, 0, 0, .45);
  opacity: 0; transform: scale(.82);
  animation: plateIn 620ms 80ms cubic-bezier(.2, .9, .25, 1) forwards;
}
#splash .sp-mark { width: 74%; height: 74%; overflow: visible; }
/* 1) المثلث الأزرق يرسم حالو */
#splash .m-line {
  stroke-dasharray: 2600; stroke-dashoffset: 2600;
  animation: drawLine 1000ms 380ms cubic-bezier(.4, 0, .2, 1) forwards;
}
/* 2) بعدها المثلث الرمادي وحرفَي A و M بيطلعوا */
#splash .m-fill {
  opacity: 0; transform-origin: 50% 70%; transform: scale(.9);
  animation: fillIn 620ms 1080ms cubic-bezier(.2, .9, .25, 1) forwards;
}
@keyframes plateIn { to { opacity: 1; transform: none; } }
@keyframes drawLine { to { stroke-dashoffset: 0; } }
@keyframes fillIn { to { opacity: 1; transform: none; } }

#splash .sp-logo { animation-delay: 1250ms; }
#splash .sp-tag { animation-delay: 1450ms; }

@media (prefers-reduced-motion: reduce) {
  #splash .sp-plate, #splash .m-fill, #splash .sp-logo, #splash .sp-tag {
    animation: none; opacity: 1; transform: none;
  }
  #splash .m-line { animation: none; stroke-dashoffset: 0; }
}

/* ─────────── صفحة النتيجة المباشرة ─────────── */
.kv { display: grid; gap: var(--s2); margin: var(--s4) 0 0; }
.kv > div {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3);
  padding: var(--s2) var(--s3);
  background: rgba(255,255,255,.55); border: 1px solid var(--line);
  border-radius: var(--r-sm); font-size: var(--fs-base);
}
.kv span { color: var(--ink-3); }
.kv b { font-weight: 600; }

/* ─────────── رسائل السكرتيرة داخل المحادثة ─────────── */
.bubble.sec-join {
  align-self: center; max-width: 92%;
  background: rgba(41,156,203,.08); border: 1px dashed rgba(41,156,203,.4);
  color: #1b6f94; font-size: var(--fs-xs); font-weight: 600; text-align: center;
  border-radius: var(--r-pill); padding: 6px var(--s4);
}
.bubble.sec {
  background: rgba(41,156,203,.07); border: 1px solid rgba(41,156,203,.26);
}
.bubble.sec::before {
  content: "السكرتيرة"; display: block;
  font-size: var(--fs-xs); font-weight: 700; color: #1b6f94; margin-bottom: 2px;
}


/* ─────────── عرض تقرير النتيجة جوّا الصفحة ─────────── */
#resultBox { margin-top: var(--s4); animation: rise var(--t) both; }
.rep-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2);
  font-size: var(--fs-base); font-weight: 600; margin-bottom: var(--s2);
}
.rep-badge {
  font-size: var(--fs-xs); font-weight: 600; color: var(--lab-deep);
  background: rgba(41,156,203,.08); border: 1px solid rgba(41,156,203,.26);
  border-radius: var(--r-pill); padding: 3px 10px;
}
.rep-pages {
  display: flex; gap: var(--s3); overflow-x: auto; padding-bottom: var(--s2);
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
}
.rep-img {
  flex: 0 0 86%; scroll-snap-align: center;
  width: 86%; height: auto; display: block;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  box-shadow: var(--sh-2); background: #fff;
}
@media (min-width: 620px) { .rep-img { flex-basis: 48%; width: 48%; } }

/* ─────────── شاشة واحدة (2026-09-26): زر اتصال كبير ← محادثة بترتيب واتساب ← النتيجة ─────────── */
.callcard { text-align: center; padding-top: var(--s5); }
.callbig { border: 0; background: none; font: inherit; color: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: var(--s3); margin: 0 auto; padding: 0;
  -webkit-tap-highlight-color: transparent; }
.callbig .pulse { width: 136px; height: 136px; margin: 0; border: 0;
  background: linear-gradient(150deg, #38aad7, var(--lab-blue)); animation: ring 2.6s ease-out infinite;
  box-shadow: 0 10px 30px rgba(41,156,203,.35); transition: background var(--t), transform var(--t); }
.callbig .pulse svg { width: 58px; height: 58px; color: #fff; transition: transform var(--t); }
.callbig:active .pulse { transform: scale(.95); }
.callbig:focus-visible .pulse { outline: 3px solid var(--lab-deep); outline-offset: 5px; }
.callbig .cb-label { font-size: 22px; font-weight: 700; color: var(--ink); line-height: 1.4; }
.callbig.live .pulse { background: linear-gradient(150deg, #e2574c, #c0392b); animation: ringRed 1.8s ease-out infinite;
  box-shadow: 0 10px 30px rgba(192,57,43,.3); }
.callbig.live .pulse svg { transform: rotate(135deg); }          /* سماعة مقلوبة = إنهاء */
.callbig.live .cb-label { color: #a93226; }
.callbig:disabled { cursor: wait; opacity: .75; }
@keyframes ringRed { 0% { box-shadow: 0 0 0 0 rgba(192,57,43,.35); } 100% { box-shadow: 0 0 0 26px rgba(192,57,43,0); } }
.callcard .timer { margin-top: var(--s3); }
.callcard .state { margin: var(--s2) 0 0; font-size: var(--fs-md); }
.note.small { font-size: var(--fs-xs); }

.chatcard .chat { min-height: 80px; max-height: 52vh; }
.chatcard .bubble { font-size: 16px; }
.bubble.hint { color: var(--ink-2); }
.bubble.sys { align-self: center; max-width: 94%; text-align: center; font-size: var(--fs-base);
  background: var(--ok-bg); border: 1px solid var(--ok-line); color: var(--ok); }
.composer.wa { align-items: flex-end; margin-top: var(--s3); }
.composer.wa textarea { flex: 1; min-height: 56px; height: 56px; max-height: 140px; border-radius: 28px;
  padding: 14px 18px; font-size: 17px; line-height: 1.6;
  /* بلا شريط تمرير: كان يطلع خط رمادي عمودي جنب الخانة عالموبايل (المحتوى أعلى من الخانة بـ 2px) */
  overflow-y: hidden; scrollbar-width: none; }
.composer.wa textarea::-webkit-scrollbar { display: none; width: 0; }
.composer.wa textarea.tall { overflow-y: auto; }
.icon-btn.round { flex: 0 0 56px; width: 56px; height: 56px; border-radius: 50%; }
.icon-btn.round svg { width: 25px; height: 25px; }
.composer.wa .icon-btn.rec { background: linear-gradient(150deg, #38aad7, var(--lab-blue)); border-color: var(--lab-blue); color: #fff; }
.composer.wa .icon-btn.rec.on { background: linear-gradient(150deg, #e2574c, #c0392b); border-color: #c0392b; animation: ringRed 1.4s infinite; }
.icon-btn[hidden] { display: none; }
.resultcard { margin-top: var(--s4); }
@media (prefers-reduced-motion: reduce) { .callbig .pulse, .callbig.live .pulse { animation: none; } }
/* رأس مختصر للشاشة الواحدة حتى يبان زر الاتصال وخانة الكتابة من أول نظرة */
header.top.compact { padding: var(--s4) 0 var(--s3); }
header.top.compact img.logo { width: 150px; }
header.top.compact .sub { margin-top: var(--s2); padding: 2px 14px; }
body.one .callcard { padding-top: var(--s4); padding-bottom: var(--s4); }
body.one .callbig .pulse { width: 116px; height: 116px; }
body.one .callbig .pulse svg { width: 50px; height: 50px; }
body.one .chatcard h2 { margin-bottom: var(--s2); }
.tiny-note { margin: var(--s2) 0 0; font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.6; }
html[data-design="b"] body.one .lab-scene .tube { top: 14px; height: 130px; }
.chatcard .state:empty { display: none; }
.chatcard .chat { min-height: 60px; }

/* الوضع الخفيف: شاشة الافتتاح بس على نت سريع (4G) — غير هيك الصفحة بتبان فوراً */
html.nosplash #splash { display: none !important; }

/* رأس الصفحة: شعار المخبر وتحته الاسم الكامل */
header.top img.mark { width: 56px; margin-bottom: var(--s2); }
header.top.compact img.mark { width: 50px; }
.labname { margin: 0; font-size: 19px; font-weight: 600; color: var(--lab-dark); line-height: 1.5; letter-spacing: 0; }
.labname::after { content: ""; display: block; width: 46px; height: 3px; margin: 8px auto 0; border-radius: 3px;
  background: linear-gradient(90deg, var(--lab-sky), var(--lab-blue)); }
header.top.compact .labname { font-size: 18px; }

/* تثبيت على الآيفون: ورقة صغيرة بخطوتين */
.ios-sheet { position: fixed; inset: 0; z-index: 50; background: rgba(29,34,43,.45); display: flex; align-items: flex-end; justify-content: center; padding: var(--s4); }
.ios-sheet[hidden] { display: none; }
.ios-card { width: 100%; max-width: 440px; background: #fff; border-radius: var(--r); padding: var(--s5) var(--s4) var(--s4); box-shadow: var(--sh-3); text-align: center; }
.ios-card h2 { font-size: var(--fs-h2); margin: 0 0 var(--s4); }
.ios-steps { display: flex; align-items: center; justify-content: center; gap: var(--s3); }
.ios-step { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 120px; font-size: var(--fs-base); line-height: 1.4; }
.ios-ico { width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; background: rgba(41,156,203,.1); color: #0a84ff; border: 1px solid rgba(41,156,203,.25); }
.ios-ico svg { width: 30px; height: 30px; }
.ios-arrow { font-size: 26px; color: var(--lab-blue); margin-bottom: 30px; }
.ios-text { text-align: right; font-size: var(--fs-md); line-height: 1.8; margin: var(--s4) 0; padding-inline-start: 22px; color: var(--ink-2); }

/* شعار المخبر كـ«توقيع» أفقي: الشعار يمين، خط سماوي رفيع، والاسم على سطرين */
header.top .lockup { display: inline-flex; align-items: center; gap: 14px; margin: 0; text-align: right; }
header.top .lockup img.mark { width: auto; height: 76px; margin: 0; flex: 0 0 auto; }
.lk-text { margin: 0; line-height: 1.3; font-weight: 400; }
.lk-text b { display: block; font-size: 26px; font-weight: 700; color: var(--lab-dark); letter-spacing: -.01em; }
.lk-text span { display: block; margin-top: 4px; font-size: 17px; font-weight: 500; color: var(--lab-deep); letter-spacing: .02em; }
header.top.compact { padding-top: var(--s3); }
header.top .lockup + .sub { display: table; margin: var(--s3) auto 0; }
@media (max-width: 350px) { header.top .lockup img.mark { height: 62px; } .lk-text b { font-size: 22px; } .lk-text span { font-size: 15px; } }

/* جاد مو متاح: رسالة ورقم المخبر */
.jadoff { text-align: center; }
.jadoff .lead { font-size: var(--fs-md); margin-bottom: var(--s4); }
.jadoff-tel { font-size: 19px; min-height: 60px; text-decoration: none; }
.card[hidden] { display: none; }
.order { margin: var(--s3) 0 0; text-align: right; }
.order label { display: block; font-size: var(--fs-base); font-weight: 600; margin-bottom: 4px; }

/* ═══════════════ الوضع الليلي: فضي وأزرق بألوان المخبر (مو أسود) ═══════════════
   بيتفعّل بزر #themeBtn ← html[data-theme="dark"] (localStorage sanad_theme). CSS بس، بلا أي ملف زيادة. */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #2a4254;
  --card: rgba(214, 226, 236, .11);
  --card-solid: #36505f;
  --ink: #eef3f7;
  --ink-2: #c9d4de;
  --ink-3: #9fb0bf;
  --line: rgba(214, 226, 236, .16);
  --line-strong: rgba(214, 226, 236, .28);
  --tile: rgba(214, 226, 236, .07);
  --lab-deep: #7cc6e6;
  --ok: #8fe0b0; --ok-bg: rgba(143, 224, 176, .1); --ok-line: rgba(143, 224, 176, .3);
  --err: #ffb3ad; --err-bg: rgba(255, 120, 110, .12); --err-line: rgba(255, 150, 140, .35);
  --sh-1: 0 1px 2px rgba(10,25,35,.14), 0 2px 8px rgba(10,25,35,.16);
  --sh-2: 0 2px 5px rgba(10,25,35,.16), 0 12px 30px rgba(10,25,35,.22);
  --sh-3: 0 6px 12px rgba(10,25,35,.2), 0 22px 48px rgba(10,25,35,.28);
}
html[data-theme="dark"] body {
  background:
    radial-gradient(1100px 620px at 108% -12%, rgba(41, 156, 203, .38), transparent 62%),
    radial-gradient(880px 520px at -14% 16%, rgba(190, 203, 214, .16), transparent 60%),
    radial-gradient(760px 700px at 50% 118%, rgba(41, 156, 203, .22), transparent 64%),
    linear-gradient(180deg, #2f4a5d, #28404f 55%, #2d4351);
  background-color: var(--bg);
  background-attachment: fixed;
}
html[data-theme="dark"] { background: var(--bg); }
html[data-theme="dark"] .brandbar { background: linear-gradient(180deg, rgba(214,226,236,.14), rgba(214,226,236,0)); }
html[data-theme="dark"] .card,
html[data-theme="dark"] .big-btn,
html[data-theme="dark"] .back,
html[data-theme="dark"] header.top .sub,
html[data-theme="dark"] .install,
html[data-theme="dark"] .note,
html[data-theme="dark"] .kv > div,
html[data-theme="dark"] .btn.ghost { background: rgba(214, 226, 236, .1); border-color: rgba(214, 226, 236, .22); }
html[data-theme="dark"] .card { background: linear-gradient(165deg, rgba(214,226,236,.15), rgba(214,226,236,.07)); }
html[data-theme="dark"] input[type="text"], html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="tel"], html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] textarea, html[data-theme="dark"] select {
  background: rgba(20, 42, 56, .35); border-color: rgba(214, 226, 236, .28); color: var(--ink);
}
html[data-theme="dark"] .bubble.bot { background: rgba(214, 226, 236, .14); border-color: rgba(214, 226, 236, .2); color: var(--ink); }
html[data-theme="dark"] .bubble.me { background: linear-gradient(160deg, #3aa6d3, #1f7fa8); }
html[data-theme="dark"] .icon-btn.rec { background: rgba(214, 226, 236, .14); color: var(--ink); }
html[data-theme="dark"] .btn:not(.ghost):not(.danger) { background: linear-gradient(160deg, #3aa6d3, #1f7fa8); border-color: #3aa6d3; color: #fff; }
html[data-theme="dark"] .lk-text span, html[data-theme="dark"] a { color: #9fd3ea; }
html[data-theme="dark"] .lk-text b { color: var(--ink); }
html[data-theme="dark"] .lab-scene .glass { fill: rgba(214, 226, 236, .12); stroke: rgba(214, 226, 236, .6); }
/* الشعار: المثلث الرمادي بيضيع عالخلفية الزرقا ← صفيحة فضية خفيفة وراه */
html[data-theme="dark"] .lockup .mark { background: rgba(236, 242, 247, .92); border-radius: 14px; padding: 6px 7px; box-sizing: content-box; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html[data-theme="dark"] .card, html[data-theme="dark"] .big-btn, html[data-theme="dark"] .bubble.bot { background: #36505f; }
}

/* زر التبديل بين الفاتح والليلي */
.theme-btn {
  position: absolute; top: max(12px, env(safe-area-inset-top)); left: 12px; z-index: 5;
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: var(--card); border: 1px solid var(--line-strong); color: var(--ink-2);
  backdrop-filter: var(--glass); -webkit-backdrop-filter: var(--glass); box-shadow: var(--sh-1);
}
.theme-btn svg { width: 20px; height: 20px; }
.theme-btn .sun, html[data-theme="dark"] .theme-btn .moon { display: none; }
html[data-theme="dark"] .theme-btn .sun { display: block; }
.theme-btn:focus-visible { outline: 2px solid var(--lab-blue); outline-offset: 2px; }
header.top { position: relative; }

/* ═══════════════ شاشة الافتتاح الخفيفة (SVG + CSS بس، 2.5 ث، بكل فتح) ═══════════════
   الشعار بيرسم حالو: المثلث الأزرق ← المثلث الرمادي ← حرف A ← حرف M ← الشعار الأصلي بالضبط.
   بتختفي لحالها بالـCSS حتى لو السكربت تأخر؛ الصفحة عم تحمّل تحتها. لمسة = تخطّي. */
#splash.lite {
  background: radial-gradient(120% 90% at 50% 38%, #ffffff 0%, #eef4f8 55%, #dde9f1 100%);
  animation: spOut 320ms 2180ms ease forwards;
}
html[data-theme="dark"] #splash.lite { background: radial-gradient(120% 90% at 50% 38%, #3b5a6e 0%, #2d4658 60%, #263c4b 100%); }
#splash.lite .sp-plate { box-shadow: 0 14px 40px rgba(27, 111, 148, .18); animation-duration: 400ms; animation-delay: 0ms; }
#splash.lite .m-line { animation: drawLine 800ms 150ms cubic-bezier(.4, 0, .2, 1) forwards; }
#splash.lite .m-tri { opacity: 0; transform-origin: 50% 70%; transform: scale(.94);
  animation: fillIn 400ms 850ms cubic-bezier(.2, .9, .25, 1) forwards, spFade 150ms 2050ms linear forwards; }
#splash.lite .m-pen path { stroke-dasharray: 1 1; stroke-dashoffset: 1; }
#splash.lite .m-a { animation: penDraw 400ms 1200ms cubic-bezier(.45, 0, .3, 1) forwards; }
#splash.lite .m-a2 { animation: penDraw 160ms 1560ms ease-out forwards; }
#splash.lite .m-m { animation: penDraw 450ms 1650ms cubic-bezier(.45, 0, .3, 1) forwards; }
#splash.lite .m-pen { animation: spFade 150ms 2050ms linear forwards; }
#splash.lite .m-exact { opacity: 0; animation: fillIn 150ms 2050ms linear forwards; }
#splash.lite .sp-name { font-size: 22px; font-weight: 700; color: var(--ink); line-height: 1.4;
  opacity: 0; transform: translateY(6px); animation: nameIn 380ms 1850ms cubic-bezier(.2,.8,.2,1) forwards; }
#splash.lite .sp-sub { font-size: 14px; color: var(--lab-deep); opacity: 0; animation: nameIn 380ms 1950ms cubic-bezier(.2,.8,.2,1) forwards; }
@keyframes penDraw { to { stroke-dashoffset: 0; } }
@keyframes spFade { to { opacity: 0; } }
@keyframes nameIn { to { opacity: 1; transform: none; } }
@keyframes spOut { to { opacity: 0; visibility: hidden; pointer-events: none; } }
@media (prefers-reduced-motion: reduce) {
  #splash.lite .sp-name, #splash.lite .sp-sub, #splash.lite .m-exact { animation: none; opacity: 1; transform: none; }
  #splash.lite .m-tri, #splash.lite .m-pen { display: none; }
  #splash.lite { animation-delay: 700ms; }
}
#splash.lite .sp-inner::before { display: none; }
