/* صيدلية د. بكر علي حفني — Medical Light (موبايل) */
:root {
  --bg0: #f4fbfa;
  --bg1: #ffffff;
  --em: #0d9488;
  --em2: #0f766e;
  --mint: #0f8f84;
  --gold: #b7791f;
  --gold2: #e0a73a;
  --rose: #e11d48;
  --text: #0f2e35;
  --muted: #5f7d83;
  --glass: #f3faf9;
  --glass2: #e6f4f2;
  --line: rgba(13, 148, 136, .16);
  --shadow: 0 14px 34px -18px rgba(15, 80, 90, .35);
  --r: 22px;
  --font: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --head: 'Alexandria', 'IBM Plex Sans Arabic', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; width: 100%; overflow-x: hidden; overscroll-behavior: none; }
body {
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(120% 70% at 85% -10%, #d6f2ee 0%, #eefaf8 40%, #ffffff 80%);
  background-color: var(--bg0);
  overflow: hidden;
  font-size: 15.5px;
}
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ------------------------------------------------ الخلفية */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.aurora { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; }
.a1 { width: 60vmax; height: 60vmax; background: radial-gradient(circle, #99f6e4 0%, transparent 65%); top: -25vmax; right: -15vmax; animation: drift1 22s ease-in-out infinite alternate; }
.a2 { width: 50vmax; height: 50vmax; background: radial-gradient(circle, #bae6fd 0%, transparent 65%); bottom: -20vmax; left: -15vmax; animation: drift2 26s ease-in-out infinite alternate; }
.a3 { width: 30vmax; height: 30vmax; background: radial-gradient(circle, rgba(254, 215, 170, .55) 0%, transparent 65%); top: 35%; left: 40%; animation: drift3 30s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(-12vmax, 10vmax) scale(1.15); } }
@keyframes drift2 { to { transform: translate(14vmax, -8vmax) scale(1.1); } }
@keyframes drift3 { to { transform: translate(-20vmax, -12vmax) scale(.8); } }
.grid {
  position: absolute; inset: -50%;
  background-image:
    linear-gradient(rgba(13, 148, 136, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13, 148, 136, .06) 1px, transparent 1px);
  background-size: 46px 46px;
  transform: perspective(600px) rotateX(60deg) translateY(-10%);
  mask-image: radial-gradient(ellipse at center 30%, #000 10%, transparent 60%);
  animation: gridMove 18s linear infinite;
}
@keyframes gridMove { to { background-position: 0 460px, 0 0; } }
#particles { position: absolute; inset: 0; width: 100%; height: 100%; }

.capsule {
  position: absolute; width: 90px; height: 34px; border-radius: 40px;
  background: linear-gradient(90deg, #f8fafc 0 50%, var(--em) 50% 100%);
  box-shadow: inset 0 -6px 12px rgba(0, 0, 0, .25), inset 0 5px 8px rgba(255, 255, 255, .6), 0 20px 40px -10px rgba(16, 185, 129, .45);
  opacity: .22; filter: blur(.4px);
}
.capsule i { position: absolute; inset: 5px 12px auto 12px; height: 7px; border-radius: 10px; background: rgba(255, 255, 255, .55); }
.c1 { top: 14%; left: 6%; animation: float1 14s ease-in-out infinite; }
.c2 { bottom: 18%; right: 5%; width: 120px; height: 44px; animation: float2 18s ease-in-out infinite; background: linear-gradient(90deg, #fde7b0 0 50%, #f8fafc 50% 100%); }
.c3 { top: 55%; left: 12%; width: 60px; height: 24px; animation: float1 11s ease-in-out infinite reverse; }
@keyframes float1 { 0%, 100% { transform: translateY(0) rotate(-25deg); } 50% { transform: translateY(-40px) rotate(20deg); } }
@keyframes float2 { 0%, 100% { transform: translateY(0) rotate(35deg); } 50% { transform: translateY(30px) rotate(-10deg); } }

/* ------------------------------------------------ شاشة البداية */
#splash {
  position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 14px;
  text-align: center; padding: 24px;
  transition: opacity .8s ease, transform .9s cubic-bezier(.7, 0, .2, 1), filter .8s;
}
#splash.out { opacity: 0; transform: scale(1.08) translateY(-30px); filter: blur(10px); pointer-events: none; }
.emblem { position: relative; display: grid; place-items: center; }
.emblem.big { width: 150px; height: 150px; }
.emblem.big::before {
  content: ''; position: absolute; inset: -30px; border-radius: 50%;
  background: radial-gradient(circle, rgba(20, 184, 166, .25), transparent 65%);
  animation: breathe 2.6s ease-in-out infinite;
}
.emblem-svg { width: 100%; height: 100%; overflow: visible; }
.emblem-svg .ring { stroke-dasharray: 340; stroke-dashoffset: 340; animation: draw 1.4s .1s cubic-bezier(.6, 0, .2, 1) forwards; transform-origin: center; }
.emblem-svg .ring2 { transform-origin: 60px 60px; animation: spin 14s linear infinite; opacity: 0; animation: spin 14s linear infinite, fadeIn .6s .8s forwards; }
.emblem-svg .cross { transform-origin: 60px 60px; transform: scale(0) rotate(-90deg); animation: pop .9s .55s cubic-bezier(.3, 1.6, .5, 1) forwards; }
.emblem-svg .ecg { stroke-dasharray: 160; stroke-dashoffset: 160; animation: draw 1.1s 1.2s ease forwards; filter: drop-shadow(0 0 4px rgba(14, 165, 233, .6)); }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { to { transform: scale(1) rotate(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes breathe { 0%, 100% { transform: scale(.85); opacity: .6; } 50% { transform: scale(1.1); opacity: 1; } }

.splash-title { font-family: var(--head); font-weight: 800; font-size: clamp(26px, 6vw, 44px); margin: 18px 0 0; line-height: 1.3; }
.splash-title span { color: var(--muted); font-weight: 600; }
.splash-title b {
  background: linear-gradient(90deg, #0f766e, #0ea5e9, #14b8a6, #0f766e);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 4s linear infinite;
}
.splash-title, .splash-sub { opacity: 0; transform: translateY(16px); animation: rise .9s 1.1s cubic-bezier(.2, .8, .2, 1) forwards; }
.splash-sub { margin: 0; color: var(--muted); font-size: 18px; animation-delay: 1.45s; }
.splash-bar { width: 160px; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 18px; opacity: 0; animation: fadeIn .4s 1.6s forwards; }
.splash-bar i { display: block; height: 100%; width: 40%; background: linear-gradient(90deg, transparent, var(--mint), transparent); animation: load 1.1s ease-in-out infinite; }
@keyframes load { from { transform: translateX(260%); } to { transform: translateX(-260%); } }
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes shine { to { background-position: -300% 0; } }

/* ------------------------------------------------ التطبيق */
#app {
  position: relative; z-index: 2; height: 100vh; height: 100dvh; height: var(--app-h, 100dvh); max-width: 480px; margin: 0 auto;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); width: 100%;
  animation: appIn .9s cubic-bezier(.2, .8, .2, 1);
}
@keyframes appIn { from { opacity: 0; transform: translateY(30px) scale(.98); } }

.top {
  min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 12px 14px 0; padding: 10px 12px; border-radius: var(--r);
  background: rgba(255, 255, 255, .82);
  border: 1px solid var(--line); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow);
}
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.emblem.small { width: 46px; height: 46px; flex: none; border-radius: 50%; background: #e6f6f4; padding: 6px; }
.emblem.small svg { width: 100%; height: 100%; }
.online { position: absolute; bottom: 1px; left: 1px; width: 12px; height: 12px; border-radius: 50%; background: #22c55e; border: 2px solid var(--bg1); }
.online::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #22c55e; animation: ping 1.8s ease-out infinite; }
@keyframes ping { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }
.who-text { display: grid; min-width: 0; }
.who-text strong { font-family: var(--head); font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-text small { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.who-text small .dot { width: 6px; height: 6px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.who-text small.typing { color: var(--mint); }
.top-actions { display: flex; gap: 8px; }
.icon-btn {
  position: relative; width: 42px; height: 42px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--glass); display: grid; place-items: center; transition: transform .2s, background .2s;
}
.icon-btn:hover { background: var(--glass2); transform: translateY(-1px); }
.icon-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#soundBtn.off .wave { opacity: 0; }
.cart-btn b {
  position: absolute; top: -6px; left: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: linear-gradient(135deg, #14b8a6, #0d9488); color: #fff; font-size: 11.5px; display: grid; place-items: center;
  transform: scale(0); transition: transform .3s cubic-bezier(.3, 1.6, .5, 1);
}
.cart-btn.has b { transform: scale(1); }
.cart-btn.bump { animation: bump .5s; }
@keyframes bump { 30% { transform: scale(1.25) rotate(-8deg); } 60% { transform: scale(.95) rotate(4deg); } }

/* ------------------------------------------------ المحادثة */
.chat {
  overflow-y: auto; padding: 18px 14px 12px; display: flex; flex-direction: column; gap: 10px;
  scroll-behavior: smooth; overscroll-behavior: contain;
  mask-image: linear-gradient(to bottom, transparent 0, #000 22px, #000 calc(100% - 10px), transparent);
}
.chat::-webkit-scrollbar { width: 6px; }
.chat::-webkit-scrollbar-thumb { background: rgba(13, 148, 136, .2); border-radius: 6px; }

.row { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.row.bot { justify-content: flex-start; }
.row.user { justify-content: flex-end; }
.row .av { width: 30px; height: 30px; flex: none; border-radius: 50%; background: #e6f6f4; border: 1px solid rgba(13, 148, 136, .25); display: grid; place-items: center; }
.row .av svg { width: 18px; height: 18px; }
.row.cont .av { visibility: hidden; }

.bubble {
  position: relative; max-width: min(78%, 560px); padding: 11px 15px; border-radius: 20px; line-height: 1.75;
  word-wrap: break-word; white-space: pre-wrap;
  animation: bubbleIn .5s cubic-bezier(.2, .9, .3, 1.2) both;
}
.bot .bubble {
  background: #fff;
  border: 1px solid var(--line); border-bottom-right-radius: 6px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px -16px rgba(15, 80, 90, .4);
}
.user .bubble {
  background: linear-gradient(135deg, #14b8a6, #0d9488);
  border-bottom-left-radius: 6px; color: #fff;
  box-shadow: 0 10px 24px -14px rgba(13, 148, 136, .7);
}
.bot .bubble.emergency { border-color: rgba(225, 29, 72, .4); background: #fff1f3; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(14px) scale(.92); filter: blur(4px); } }
.bubble .w { display: inline; opacity: 0; filter: blur(6px); animation: wordIn .45s ease forwards; }
@keyframes wordIn { to { opacity: 1; filter: none; } }
.bubble .speak {
  position: absolute; bottom: -10px; left: -6px; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; display: grid; place-items: center; opacity: 0; transition: opacity .2s;
}
.bubble:hover .speak, .bubble .speak.on { opacity: 1; }
.bubble .speak svg { width: 13px; height: 13px; fill: none; stroke: var(--mint); stroke-width: 2; }
.bubble img.rx-img { display: block; width: 210px; max-width: 100%; border-radius: 14px; }
.bubble.img { padding: 6px; }
.scan { position: relative; overflow: hidden; border-radius: 14px; }
.scan::after {
  content: ''; position: absolute; left: 0; right: 0; height: 40%; top: -40%;
  background: linear-gradient(to bottom, transparent, rgba(20, 184, 166, .35) 85%, #14b8a6 100%);
  animation: scanY 1.6s ease-in-out infinite;
}
.scan.done::after { display: none; }
@keyframes scanY { to { top: 100%; } }

/* الكتابة */
.typing-b { display: flex; gap: 6px; padding: 14px 16px; }
.typing-b i {
  width: 18px; height: 8px; border-radius: 6px; background: linear-gradient(90deg, #cbd5e1 50%, var(--em) 50%);
  animation: hop 1.1s ease-in-out infinite;
}
.typing-b i:nth-child(2) { animation-delay: .15s; }
.typing-b i:nth-child(3) { animation-delay: .3s; }
@keyframes hop { 0%, 60%, 100% { transform: translateY(0) rotate(0); opacity: .5; } 30% { transform: translateY(-7px) rotate(-20deg); opacity: 1; } }

/* اختيارات البداية */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 4px 38px 4px 0; max-width: 620px; }
.tile {
  position: relative; text-align: right; padding: 14px; border-radius: 18px; border: 1px solid var(--line);
  background: linear-gradient(160deg, #ffffff, #f1faf8);
  overflow: hidden; box-shadow: 0 8px 22px -16px rgba(15, 80, 90, .35); transition: transform .25s, border-color .25s, box-shadow .25s;
  animation: bubbleIn .6s cubic-bezier(.2, .9, .3, 1.2) both;
}
.tile:nth-child(2) { animation-delay: .1s; }
.tile:nth-child(3) { animation-delay: .2s; }
.tile:hover { transform: translateY(-4px); border-color: rgba(13, 148, 136, .45); box-shadow: 0 16px 34px -20px rgba(13, 148, 136, .6); }
.tile::before {
  content: ''; position: absolute; inset: 0; background: linear-gradient(120deg, transparent 30%, rgba(13, 148, 136, .08), transparent 70%);
  transform: translateX(120%); transition: transform .8s;
}
.tile:hover::before { transform: translateX(-120%); }
.tile .ti { font-size: 26px; display: block; margin-bottom: 6px; }
.tile b { display: block; font-family: var(--head); font-weight: 600; font-size: 14.5px; }
.tile small { color: var(--muted); font-size: 12.5px; line-height: 1.5; display: block; margin-top: 3px; }
.tile.hero { border-color: rgba(14, 165, 233, .35); background: linear-gradient(160deg, #e0f2fe, #ffffff); }

/* كروت الأدوية */
.cards { display: flex; gap: 10px; overflow-x: auto; padding: 4px 38px 10px 4px; scroll-snap-type: x mandatory; margin-inline-end: -14px; }
.cards::-webkit-scrollbar { height: 0; }
.dcard {
  flex: 0 0 232px; scroll-snap-align: start; position: relative; border-radius: 20px; padding: 14px;
  border: 1px solid var(--line); background: #fff; box-shadow: 0 10px 26px -18px rgba(15, 80, 90, .45);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  display: flex; flex-direction: column; gap: 8px;
  animation: cardIn .6s cubic-bezier(.2, .9, .3, 1.2) both; transition: transform .25s, border-color .25s;
}
.dcard:hover { transform: translateY(-3px); border-color: rgba(13, 148, 136, .45); }
@keyframes cardIn { from { opacity: 0; transform: translateX(-30px) rotateY(20deg); } }
.dcard .dtop { display: flex; gap: 10px; align-items: center; }
.dicon {
  width: 44px; height: 44px; flex: none; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, #ccfbf1, #e0f2fe); border: 1px solid rgba(13, 148, 136, .2);
}
.dicon svg { width: 24px; height: 24px; fill: none; stroke: var(--mint); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dname { min-width: 0; }
.dname b { display: block; font-size: 13.5px; direction: ltr; text-align: right; line-height: 1.35; font-weight: 600; }
.dname small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dsci { font-size: 11.5px; color: #7b979b; direction: ltr; text-align: right; line-height: 1.4; max-height: 3em; overflow: hidden; }
.dmeta { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }
.price { font-family: var(--head); font-weight: 800; font-size: 19px; color: var(--gold); }
.price small { font-size: 12px; font-weight: 400; color: var(--muted); }
.badge { font-size: 11.5px; padding: 3px 9px; border-radius: 20px; display: inline-flex; align-items: center; gap: 5px; }
.badge.ok { background: #dcfce7; color: #15803d; }
.badge.no { background: #ffe4e6; color: #be123c; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.dact { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dact button {
  border: 1px solid var(--line); background: var(--glass); border-radius: 12px; padding: 7px 4px; font-size: 12.5px; transition: background .2s, transform .15s;
}
.dact button:hover { background: var(--glass2); }
.dact button:active { transform: scale(.95); }
.dact .add { background: linear-gradient(135deg, var(--em), #0d9488); border-color: transparent; color: #fff; font-weight: 600; }
.dact .add.added { background: #dcfce7; color: #15803d; }
.dact .alt { grid-column: 1 / -1; color: #0369a1; background: #f0f9ff; border-color: rgba(14, 165, 233, .3); }

/* خطوات قراءة الروشتة */
.steps { display: grid; gap: 8px; min-width: 230px; }
.step { display: flex; align-items: center; gap: 10px; opacity: .35; transition: opacity .4s; }
.step.on, .step.done { opacity: 1; }
.step .sp { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; flex: none; }
.step.on .sp { border-color: var(--mint); border-top-color: transparent; animation: spin .8s linear infinite; }
.step.done .sp { border-color: var(--em); background: var(--em); }
.step.done .sp::after { content: '✓'; font-size: 12px; color: #fff; }

/* فاتورة الروشتة */
.rx {
  width: min(100%, 560px); margin-right: 38px; border-radius: 24px; overflow: hidden; position: relative;
  border: 1px solid rgba(13, 148, 136, .2);
  background: #fff;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 20px 44px -26px rgba(15, 80, 90, .5);
  animation: bubbleIn .7s cubic-bezier(.2, .9, .3, 1.1) both;
}
.rx-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: linear-gradient(90deg, #e0f2fe, #ccfbf1); border-bottom: 1px dashed rgba(13, 148, 136, .3); }
.rx-head b { font-family: var(--head); font-weight: 600; }
.rx-head small { color: var(--muted); }
.rx-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; padding: 12px 16px; border-bottom: 1px solid rgba(13, 148, 136, .08); animation: itemIn .5s both; }
@keyframes itemIn { from { opacity: 0; transform: translateX(-20px); } }
.rx-num { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; background: #ccfbf1; color: var(--em2); font-size: 14px; }
.rx-main b { display: block; direction: ltr; text-align: right; font-size: 14px; font-weight: 600; }
.rx-main .ar { color: var(--muted); font-size: 12.5px; }
.rx-main .note { font-size: 13.5px; margin-top: 4px; line-height: 1.6; }
.rx-main .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag { font-size: 11.5px; padding: 3px 9px; border-radius: 20px; background: #f1f5f9; color: #475569; }
.tag.dose { background: #ccfbf1; color: var(--em2); }
.tag.written { direction: ltr; }
.rx-alt { margin-top: 6px; font-size: 12.5px; color: #0369a1; }
.rx-price { text-align: left; white-space: nowrap; }
.rx-price .price { font-size: 16px; }
.rx-price s { color: var(--muted); font-size: 12px; display: block; }
.rx-sum { padding: 14px 16px; display: grid; gap: 6px; background: #f3faf9; }
.rx-sum .line { display: flex; justify-content: space-between; color: var(--muted); }
.rx-sum .line.disc { color: #15803d; }
.rx-sum .line.total { color: var(--text); font-family: var(--head); font-weight: 800; font-size: 20px; margin-top: 4px; }
.rx-sum .line.total span:last-child { color: var(--gold); }
.tier { margin-top: 6px; font-size: 13px; color: var(--muted); }
.tier .bar { height: 7px; border-radius: 7px; background: #e2f0ee; overflow: hidden; margin-top: 6px; }
.tier .bar i { display: block; height: 100%; width: 0; border-radius: 7px; background: linear-gradient(90deg, #14b8a6, #0ea5e9); transition: width 1.4s cubic-bezier(.2, .8, .2, 1); }
.rx-actions { display: flex; gap: 8px; padding: 12px 16px 16px; flex-wrap: wrap; }
.btn {
  border: 0; border-radius: 14px; padding: 11px 16px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  background: linear-gradient(135deg, #14b8a6, #0d9488); color: #fff; box-shadow: 0 12px 26px -12px rgba(13, 148, 136, .7);
  transition: transform .2s, filter .2s;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn.ghost { background: var(--glass); color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn.green { background: linear-gradient(135deg, var(--em), #0d9488); color: #fff; box-shadow: 0 12px 26px -12px rgba(16, 185, 129, .8); }
.btn.wa { background: linear-gradient(135deg, #25d366, #128c7e); color: #fff; }
.btn.full { width: 100%; }
.stamp {
  position: absolute; top: 54px; left: 14px; transform: rotate(-14deg); border: 2px solid rgba(22, 163, 74, .6); color: #16a34a;
  border-radius: 10px; padding: 2px 10px; font-family: var(--head); font-weight: 800; font-size: 13px; opacity: 0; animation: stampIn .5s 1.2s cubic-bezier(.3, 1.8, .5, 1) forwards;
}
@keyframes stampIn { from { opacity: 0; transform: rotate(-14deg) scale(2.2); } to { opacity: .9; transform: rotate(-14deg) scale(1); } }

/* ------------------------------------------------ الكتابة */
.composer-wrap { min-width: 0; padding: 6px 14px calc(10px + env(safe-area-inset-bottom)); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; }
.chips::-webkit-scrollbar { height: 0; }
.chip {
  flex: none; padding: 8px 14px; border-radius: 30px; border: 1px solid rgba(13, 148, 136, .3); background: #fff;
  color: var(--em2); box-shadow: 0 6px 16px -12px rgba(15, 80, 90, .5); font-size: 13.5px; white-space: nowrap; position: relative; overflow: hidden;
  animation: chipIn .45s cubic-bezier(.2, .9, .3, 1.3) both; transition: background .2s, transform .15s;
}
.chip:hover { background: #e6f6f4; }
.chip:active { transform: scale(.95); }
.chip::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, rgba(13, 148, 136, .12), transparent 65%); transform: translateX(110%); animation: shimmer 3s 1s infinite; }
@keyframes chipIn { from { opacity: 0; transform: translateY(12px) scale(.85); } }
@keyframes shimmer { 40%, 100% { transform: translateX(-110%); } }
.composer {
  display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 26px;
  background: #fff;
  border: 1px solid var(--line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow); transition: border-color .25s, box-shadow .25s;
}
.composer:focus-within { border-color: rgba(13, 148, 136, .5); box-shadow: 0 0 0 4px rgba(13, 148, 136, .12), var(--shadow); }
.composer input[type=text] {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 16px; padding: 10px 6px;
}
.composer input::placeholder { color: #8aa7ab; }
.c-btn { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; display: grid; place-items: center; background: transparent; transition: background .2s, transform .15s; }
.c-btn:hover { background: var(--glass2); }
.c-btn:active { transform: scale(.9); }
.c-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.c-btn.cam { background: #e0f2fe; color: #0284c7; }
.c-btn.cam.pulse { animation: camPulse 1.6s ease-in-out infinite; }
@keyframes camPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(14, 165, 233, .5); } 50% { box-shadow: 0 0 0 10px rgba(14, 165, 233, 0); } }
.c-btn.send { background: linear-gradient(135deg, var(--em), #0d9488); color: #fff; box-shadow: 0 8px 20px -8px rgba(13, 148, 136, .8); }
.c-btn.send svg { transform: scaleX(-1); }
.c-btn.mic.rec { background: var(--rose); color: #fff; animation: camPulse 1.2s infinite; }
.disclaimer { text-align: center; font-size: 11.5px; color: #7a979b; margin: 8px 0 0; }

/* ------------------------------------------------ الطلب */
.sheet { position: fixed; inset: 0; z-index: 30; pointer-events: none; overflow: hidden; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(15, 46, 53, .35); backdrop-filter: blur(4px); opacity: 0; transition: opacity .35s; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; width: min(100%, 560px); max-height: 88dvh; overflow: auto;
  transform: translateY(105%); transition: transform .5s cubic-bezier(.2, .9, .2, 1);
  background: #fff; border: 1px solid var(--line); border-bottom: 0;
  border-radius: 28px 28px 0 0; padding: 8px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -20px 50px -20px rgba(15, 80, 90, .45);
}
.sheet.open { pointer-events: auto; }
.sheet.open .sheet-backdrop { opacity: 1; }
.sheet.open .sheet-panel { transform: none; }
.sheet-handle { width: 44px; height: 5px; border-radius: 5px; background: #cfe3e1; margin: 4px auto 10px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h3 { margin: 0; font-family: var(--head); font-weight: 600; }
.ci { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid rgba(13, 148, 136, .1); }
.ci b { display: block; direction: ltr; text-align: right; font-size: 13.5px; font-weight: 600; }
.ci small { color: var(--muted); }
.qty { display: flex; align-items: center; gap: 4px; background: var(--glass); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.qty button { width: 28px; height: 28px; border: 0; border-radius: 9px; background: var(--glass2); }
.qty span { min-width: 22px; text-align: center; font-weight: 700; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.empty .big { font-size: 46px; display: block; margin-bottom: 8px; }
.field { display: grid; gap: 6px; margin-top: 12px; }
.field label { font-size: 13px; color: var(--muted); }
.field input, .field textarea {
  background: #f5fbfa; border: 1px solid var(--line); border-radius: 14px; padding: 12px; color: var(--text); font: inherit; font-size: 16px; outline: 0;
}
.field input:focus, .field textarea:focus { border-color: rgba(13, 148, 136, .55); background: #fff; }
.done-box { text-align: center; padding: 16px 6px; }
.done-box .check { width: 84px; height: 84px; margin: 0 auto 10px; }
.done-box .check circle { stroke-dasharray: 260; stroke-dashoffset: 260; animation: draw .8s forwards; }
.done-box .check path { stroke-dasharray: 80; stroke-dashoffset: 80; animation: draw .5s .6s forwards; }
.done-box .code { font-family: var(--head); font-weight: 800; font-size: 26px; color: var(--gold); letter-spacing: 1px; direction: ltr; }

.toast {
  position: fixed; z-index: 60; left: 16px; right: 16px; width: fit-content; margin: 0 auto; top: 18px; transform: translateY(calc(-100% - 40px)); transition: transform .45s cubic-bezier(.2, .9, .3, 1.3);
  background: #0f766e; color: #fff; border: 1px solid rgba(13, 148, 136, .35); padding: 10px 16px; border-radius: 16px; box-shadow: var(--shadow); font-size: 14px; max-width: calc(100% - 32px);
}
.toast.show { transform: none; }

.fly { position: fixed; z-index: 70; width: 30px; height: 12px; border-radius: 8px; background: linear-gradient(90deg, #e2e8f0 50%, var(--em) 50%); pointer-events: none; transition: transform .75s cubic-bezier(.5, -0.3, .7, 1), opacity .75s; }

.link { background: none; border: 0; color: var(--mint); text-decoration: underline; padding: 0; font-size: 12.5px; }

/* التطبيق مصمم للموبايل: نفس التخطيط على كل الشاشات */
@media (min-width: 0) {
  body { font-size: 15px; }
  .tiles { grid-template-columns: 1fr; margin-right: 38px; }
  .tile { display: grid; grid-template-columns: 40px 1fr; align-items: center; column-gap: 10px; padding: 12px; }
  .tile .ti { grid-row: span 2; margin: 0; font-size: 28px; }
  .bubble { max-width: 84%; }
  .top { margin: 10px 10px 0; }
  .chat { padding: 14px 10px 10px; }
  .composer-wrap { padding-inline: 10px; }
  .rx { margin-right: 0; }
  .cards { padding-right: 38px; }
  .capsule { opacity: .1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* على شاشة كبيرة: إطار موبايل في النص */
@media (min-width: 560px) {
  #app { border-inline: 1px solid var(--line); background: rgba(255, 255, 255, .45); box-shadow: 0 0 80px -30px rgba(15, 80, 90, .35); }
}

/* ------------------------------------------------ تنبيهات الأمان */
.rx-warn { margin: 12px 16px 2px; padding: 12px 14px; border-radius: 16px; background: #fffbeb; border: 1px solid #fde68a; animation: bubbleIn .6s .9s both; }
.rx-warn b { display: block; color: #92400e; font-family: var(--head); font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.rx-warn p { margin: 4px 0 0; font-size: 13.5px; line-height: 1.65; color: #78350f; padding-right: 14px; position: relative; }
.rx-warn p::before { content: ''; position: absolute; right: 2px; top: .65em; width: 5px; height: 5px; border-radius: 50%; background: #f59e0b; }

/* ------------------------------------------------ مواعيد الدوا */
.meds { padding-top: 6px; }
.meds-intro { margin: 6px 0 12px; color: var(--muted); line-height: 1.7; }
.meds-start { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 16px; background: linear-gradient(90deg, #e0f2fe, #ccfbf1); font-weight: 600; }
.meds-start input { font: inherit; font-size: 17px; font-weight: 700; color: var(--em2); border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 6px 10px; direction: ltr; }
#medList { display: grid; gap: 10px; margin: 14px 0; }
.med { border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px; background: #fff; box-shadow: 0 8px 20px -16px rgba(15, 80, 90, .4); animation: itemIn .45s both; }
.med-h b { display: block; font-size: 14.5px; }
.med-h small { color: var(--muted); font-size: 12.5px; }
.med-t { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.med-t span { font-size: 13px; font-weight: 600; padding: 5px 11px; border-radius: 20px; }
.med-t .day { background: #fef9c3; color: #854d0e; }
.med-t .night { background: #e0e7ff; color: #3730a3; }
.meds-note { text-align: center; font-size: 12.5px; color: var(--muted); margin: 10px 0 0; line-height: 1.6; }

/* ================================================================
   VIVID — طبقة التصميم الزاهي (فوق الثيم الطبي)
   ================================================================ */
:root {
  --g-main: linear-gradient(135deg, #00c6a7 0%, #0ea5e9 55%, #6366f1 100%);
  --g-teal: linear-gradient(135deg, #10d9b0, #06b6d4);
  --g-blue: linear-gradient(135deg, #38bdf8, #6366f1);
  --g-sun: linear-gradient(135deg, #fb923c, #f43f5e);
  --g-rose: linear-gradient(135deg, #f472b6, #a855f7);
  --g-price: linear-gradient(90deg, #f97316, #e11d48);
  --text: #0b2540;
  --muted: #5b7290;
  --line: rgba(14, 165, 233, .16);
}
body {
  background:
    radial-gradient(60% 40% at 100% 0%, rgba(0, 198, 167, .22), transparent 70%),
    radial-gradient(50% 40% at 0% 30%, rgba(99, 102, 241, .14), transparent 70%),
    radial-gradient(60% 40% at 100% 100%, rgba(244, 114, 182, .14), transparent 70%),
    #f6fbff;
}
.a1 { background: radial-gradient(circle, #5eead4 0%, transparent 65%); opacity: .5; }
.a2 { background: radial-gradient(circle, #a5b4fc 0%, transparent 65%); opacity: .45; }
.a3 { background: radial-gradient(circle, rgba(251, 182, 206, .9) 0%, transparent 65%); opacity: .4; }

/* ---------- شاشة البداية */
#splash { background: var(--g-main); color: #fff; overflow: hidden; }
#splash::before, #splash::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .1); }
#splash::before { width: 70vmax; height: 70vmax; top: -35vmax; right: -25vmax; animation: breathe 6s ease-in-out infinite; }
#splash::after { width: 50vmax; height: 50vmax; bottom: -25vmax; left: -20vmax; animation: breathe 7s 1s ease-in-out infinite; }
.emblem.big { width: 132px; height: 132px; }
.emblem.big::before { display: none; }
.splash-icon { position: relative; z-index: 2; width: 100%; height: 100%; border-radius: 32px; box-shadow: 0 24px 50px -12px rgba(15, 23, 80, .55), 0 0 0 6px rgba(255, 255, 255, .25);
  transform: scale(0) rotate(-20deg); animation: pop .9s .2s cubic-bezier(.3, 1.6, .5, 1) forwards, floaty 3.2s 1.2s ease-in-out infinite; }
@keyframes floaty { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
.ring-pulse { position: absolute; inset: 0; border-radius: 36px; border: 2px solid rgba(255, 255, 255, .7); animation: ringOut 2.4s 1s ease-out infinite; opacity: 0; }
.ring-pulse.r2 { animation-delay: 2.2s; }
@keyframes ringOut { from { transform: scale(1); opacity: .9; } to { transform: scale(1.9); opacity: 0; } }
.splash-title { color: #fff; position: relative; text-shadow: 0 6px 24px rgba(15, 23, 80, .3); }
.splash-title span { color: rgba(255, 255, 255, .85); }
.splash-title b { background: linear-gradient(90deg, #fff, #d1fae5, #fff, #e0e7ff, #fff); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; }
.splash-sub { color: rgba(255, 255, 255, .9); position: relative; }
.splash-bar { background: rgba(255, 255, 255, .25); position: relative; }
.splash-bar i { background: linear-gradient(90deg, transparent, #fff, transparent); }

/* ---------- الهيدر */
.top {
  position: relative; overflow: hidden; border: 0; color: #fff;
  background: var(--g-main); background-size: 160% 160%; animation: hue 10s ease-in-out infinite;
  box-shadow: 0 16px 34px -16px rgba(14, 116, 233, .65);
}
@keyframes hue { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.top::before { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .28) 50%, transparent 70%); transform: translateX(120%); animation: sweep 5s 2s ease-in-out infinite; pointer-events: none; }
@keyframes sweep { 0% { transform: translateX(120%); } 35%, 100% { transform: translateX(-120%); } }
.top::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 4px; height: 18px; opacity: .35; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 18'%3E%3Cpath d='M0 9h60l6-7 8 14 7-14 5 7h114' fill='none' stroke='%23fff' stroke-width='1.6'/%3E%3C/svg%3E") repeat-x 0 0 / 200px 18px;
  animation: ecgMove 4s linear infinite;
}
@keyframes ecgMove { to { background-position: -200px 0; } }
.emblem.small { background: none; padding: 0; width: 46px; height: 46px; }
.emblem.small img { width: 100%; height: 100%; border-radius: 14px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .6), 0 8px 18px -6px rgba(15, 23, 80, .5); }
.online { border-color: #fff; }
.who-text strong { color: #fff; font-weight: 700; }
.who-text small { color: rgba(255, 255, 255, .88); }
.who-text small.typing { color: #fff; }
.who-text small .dot { background: #4ade80; box-shadow: 0 0 10px #4ade80; }
.top .icon-btn { background: rgba(255, 255, 255, .2); border-color: rgba(255, 255, 255, .35); color: #fff; backdrop-filter: blur(6px); }
.top .icon-btn:hover { background: rgba(255, 255, 255, .32); }
.cart-btn b { background: var(--g-sun); color: #fff; box-shadow: 0 0 0 2px #fff; }

/* ---------- الفقاعات */
.row .av { background: #fff; border: 0; box-shadow: 0 4px 12px -4px rgba(14, 165, 233, .5); }
.row .av svg path, .row .av svg circle { stroke: #0ea5e9; }
.bot .bubble { background: #fff; border: 1px solid rgba(14, 165, 233, .12); box-shadow: 0 10px 28px -16px rgba(14, 116, 233, .45); }
.user .bubble { background: linear-gradient(135deg, #00c6a7, #0ea5e9); box-shadow: 0 12px 26px -12px rgba(14, 165, 233, .7); }

/* ---------- البلاطات */
.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
.tile {
  display: flex !important; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 128px;
  border: 0; color: #fff; padding: 14px !important; border-radius: 22px;
  background: var(--g-teal); box-shadow: 0 16px 30px -16px rgba(6, 182, 212, .8);
}
.tile.hero { background: var(--g-blue); box-shadow: 0 16px 30px -16px rgba(99, 102, 241, .8); }
.tile.box { background: var(--g-sun); box-shadow: 0 16px 30px -16px rgba(244, 63, 94, .75); }
.tile[data-t=sym] { background: var(--g-rose); box-shadow: 0 16px 30px -16px rgba(168, 85, 247, .75); }
.tile::before { background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .35), transparent 70%); animation: sweep 4.5s ease-in-out infinite; }
.tile:nth-child(2)::before { animation-delay: .6s; } .tile:nth-child(3)::before { animation-delay: 1.2s; } .tile:nth-child(4)::before { animation-delay: 1.8s; }
.tile::after { content: ''; position: absolute; width: 90px; height: 90px; border-radius: 50%; background: rgba(255, 255, 255, .14); left: -24px; bottom: -30px; }
.tile .ti { width: 46px; height: 46px; border-radius: 15px; display: grid !important; place-items: center; font-size: 25px !important; margin: 0 0 8px !important;
  background: rgba(255, 255, 255, .25); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5); grid-row: auto !important; }
.tile b { font-size: 15px; font-weight: 700; color: #fff; }
.tile small { color: rgba(255, 255, 255, .9); font-size: 12px; }
.tile:hover { transform: translateY(-4px) scale(1.02); border: 0; }
.tile:active { transform: scale(.96); }

/* ---------- الأزرار */
.btn { position: relative; overflow: hidden; border-radius: 16px; background: var(--g-main); color: #fff; box-shadow: 0 12px 24px -12px rgba(14, 116, 233, .8), inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .4), transparent 65%); transform: translateX(120%); animation: sweep 3.8s 1s ease-in-out infinite; }
.btn:active { transform: scale(.96); }
.btn.green { background: var(--g-teal); box-shadow: 0 12px 24px -12px rgba(6, 182, 212, .8); }
.btn.ghost { background: #fff; color: #0369a1; border: 1px solid rgba(14, 165, 233, .3); box-shadow: 0 6px 16px -10px rgba(14, 116, 233, .5); }
.btn.ghost::after { display: none; }
.btn.wa { background: linear-gradient(135deg, #22c55e, #059669); }

/* ---------- كروت الأدوية */
.dcard { border: 0; border-radius: 22px; box-shadow: 0 16px 34px -20px rgba(14, 116, 233, .55); }
.dcard::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 5px; border-radius: 22px 22px 0 0; background: var(--g-main); }
.dicon { background: var(--g-main); border: 0; box-shadow: 0 8px 16px -8px rgba(14, 165, 233, .8); }
.dicon svg { stroke: #fff; }
.price { background: var(--g-price); -webkit-background-clip: text; background-clip: text; color: transparent; }
.price small { -webkit-text-fill-color: var(--muted); }
.dact .add { background: var(--g-teal); box-shadow: 0 8px 16px -8px rgba(6, 182, 212, .9); }
.dact .alt { background: #f5f3ff; color: #7c3aed; border-color: rgba(124, 58, 237, .25); }
.dact .info { background: #f0f9ff; color: #0369a1; border-color: rgba(14, 165, 233, .25); }

/* ---------- الروشتة */
.rx { border: 0; border-radius: 26px; box-shadow: 0 24px 48px -24px rgba(14, 116, 233, .55); }
.rx-head { background: var(--g-main); color: #fff; border-bottom: 0; }
.rx-head small { color: rgba(255, 255, 255, .85); }
.stamp { background: #fff; border-color: #22c55e; }
.rx-num { background: var(--g-main); color: #fff; box-shadow: 0 6px 14px -6px rgba(14, 165, 233, .8); }
.tag.dose { background: #e0f2fe; color: #0369a1; }
.rx-sum { background: linear-gradient(180deg, #f0f9ff, #fff); }
.tier .bar i { background: linear-gradient(90deg, #00c6a7, #0ea5e9, #6366f1); }

/* ---------- الشيبس والكتابة */
.chip { border: 1.5px solid transparent; color: #0369a1; font-weight: 600;
  background: linear-gradient(#fff, #fff) padding-box, var(--g-main) border-box; box-shadow: 0 6px 16px -10px rgba(14, 116, 233, .6); }
.chip:hover { background: linear-gradient(#f0f9ff, #f0f9ff) padding-box, var(--g-main) border-box; }
.composer { border: 1.5px solid rgba(14, 165, 233, .2); box-shadow: 0 14px 30px -18px rgba(14, 116, 233, .6); }
.composer:focus-within { border-color: #0ea5e9; box-shadow: 0 0 0 4px rgba(14, 165, 233, .15), 0 14px 30px -18px rgba(14, 116, 233, .6); }
.c-btn.send { background: var(--g-main); box-shadow: 0 8px 20px -6px rgba(14, 116, 233, .8); }
.c-btn.cam { background: var(--g-sun); color: #fff; box-shadow: 0 8px 18px -8px rgba(244, 63, 94, .7); }
.c-btn.cam.pulse { animation: camPulse2 1.8s ease-in-out infinite; }
@keyframes camPulse2 { 0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, .55); } 50% { box-shadow: 0 0 0 10px rgba(244, 63, 94, 0); } }
.c-btn.mic { color: #6366f1; }

/* ---------- الشيت والتوست */
.sheet-panel { border: 0; }
.sheet-head h3 { background: var(--g-main); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }
.meds-start { background: var(--g-main); color: #fff; }
.toast { background: var(--g-main); border: 0; box-shadow: 0 14px 30px -12px rgba(14, 116, 233, .7); }
.typing-b i { background: var(--g-main); }
/* هيدر الموبايل: الاسم كامل */
.top { padding: 9px 10px; gap: 8px; }
.who { gap: 9px; }
.emblem.small { width: 42px; height: 42px; }
.who-text strong { font-size: clamp(13.5px, 3.9vw, 16px); }
.top-actions { gap: 6px; }
.top .icon-btn { width: 38px; height: 38px; border-radius: 12px; }
.top .icon-btn svg { width: 19px; height: 19px; }
.top::after { bottom: 0; opacity: .22; }

/* ------------------------------------------------ اختيار الصورة */
.pick { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.pick-backdrop { position: absolute; inset: 0; background: rgba(11, 37, 64, .4); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); opacity: 0; transition: opacity .3s; }
.pick-panel {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; width: min(100%, 480px);
  background: #fff; border-radius: 30px 30px 0 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
  transform: translateY(105%); transition: transform .45s cubic-bezier(.2, .9, .2, 1.05);
  box-shadow: 0 -24px 50px -20px rgba(14, 116, 233, .45);
}
.pick.open { pointer-events: auto; }
.pick.open .pick-backdrop { opacity: 1; }
.pick.open .pick-panel { transform: none; }
.pick-title { margin: 2px 0 12px; text-align: center; font-family: var(--head); font-weight: 800; font-size: 19px;
  background: var(--g-main); -webkit-background-clip: text; background-clip: text; color: transparent; }
.seg { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 5px; border-radius: 18px; background: #eef6fd; }
.seg button { position: relative; z-index: 1; border: 0; background: none; padding: 11px 6px; border-radius: 14px; font-weight: 700; font-size: 15px; color: var(--muted); transition: color .3s; }
.seg button.on { color: #fff; }
.seg-pill { position: absolute; top: 5px; bottom: 5px; right: 5px; width: calc(50% - 5px); border-radius: 14px; background: var(--g-blue);
  box-shadow: 0 8px 18px -8px rgba(99, 102, 241, .8); transition: transform .4s cubic-bezier(.3, 1.4, .5, 1), background .3s; }
.seg[data-m=drug] .seg-pill { transform: translateX(-100%); background: var(--g-sun); box-shadow: 0 8px 18px -8px rgba(244, 63, 94, .8); }
.pick-hint { min-height: 3.2em; margin: 12px 4px; text-align: center; color: var(--muted); font-size: 13.5px; line-height: 1.65; }
.pick-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick-btn {
  position: relative; overflow: hidden; border: 0; border-radius: 22px; padding: 16px 10px; color: #fff;
  display: grid; justify-items: center; gap: 3px; transition: transform .15s;
}
.pick-btn span { width: 54px; height: 54px; border-radius: 18px; display: grid; place-items: center; font-size: 28px; margin-bottom: 6px;
  background: rgba(255, 255, 255, .25); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5); }
.pick-btn b { font-size: 15px; }
.pick-btn small { font-size: 12px; opacity: .9; }
.pick-btn.cam { background: var(--g-teal); box-shadow: 0 16px 30px -16px rgba(6, 182, 212, .9); }
.pick-btn.gal { background: var(--g-rose); box-shadow: 0 16px 30px -16px rgba(168, 85, 247, .9); }
.pick-btn::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .35), transparent 70%); transform: translateX(120%); animation: sweep 4s ease-in-out infinite; }
.pick-btn.gal::after { animation-delay: .7s; }
.pick-btn:active { transform: scale(.95); }
.pick-cancel { display: block; width: 100%; margin-top: 10px; border: 0; background: none; color: var(--muted); padding: 10px; font-weight: 600; }

/* ================================================================
   شاشة البداية — لوجو الصيدلية المتحرك
   ================================================================ */
#splash { background: radial-gradient(120% 80% at 50% 38%, #ffffff 0%, #f1f5ff 55%, #dfe8ff 100%) !important; color: #0b2540; gap: 0; padding: 20px; }
#splash::before, #splash::after { display: none; }
.sp-rays { position: absolute; left: 50%; top: 38%; width: 160vmax; height: 160vmax; translate: -50% -50%; pointer-events: none; opacity: 0;
  background: repeating-conic-gradient(from 0deg, rgba(242, 201, 76, .13) 0 6deg, transparent 6deg 18deg);
  mask-image: radial-gradient(circle, #000 0, transparent 45%); -webkit-mask-image: radial-gradient(circle, #000 0, transparent 45%);
  animation: fadeIn 1s 1.2s forwards, spin 40s linear infinite; }
.sp-orb { position: absolute; border-radius: 50%; filter: blur(50px); opacity: .55; pointer-events: none; }
.sp-orb.o1 { width: 60vmax; height: 60vmax; background: #c7d6ff; top: -30vmax; right: -25vmax; animation: drift1 14s ease-in-out infinite alternate; }
.sp-orb.o2 { width: 50vmax; height: 50vmax; background: #fff0c2; bottom: -25vmax; left: -20vmax; animation: drift2 16s ease-in-out infinite alternate; }

.sp-logo { position: relative; width: min(46vw, 190px); aspect-ratio: 340 / 440; margin-bottom: 14px; }
.logo-svg { position: relative; z-index: 2; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 18px 26px rgba(18, 56, 224, .22)); }
/* رسم حرف B */
.lb-B path { stroke: #1238e0; stroke-width: 2; stroke-dasharray: 1400; stroke-dashoffset: 1400; fill-opacity: 0;
  animation: lbDraw 1.1s cubic-bezier(.6, 0, .3, 1) forwards, lbFill .6s ease forwards; }
.lb-B .lb-serif { animation-delay: 0s, .75s; } .lb-B .lb-stem { animation-delay: .08s, .8s; }
.lb-B .lb-top { animation-delay: .2s, .9s; } .lb-B .lb-low { animation-delay: .3s, 1s; }
@keyframes lbDraw { to { stroke-dashoffset: 0; } }
@keyframes lbFill { to { fill-opacity: 1; stroke-width: 0; } }
/* الكاس */
.lb-cup { transform-box: fill-box; transform-origin: 50% 100%; transform: scale(0); animation: lbPop .7s 1.15s cubic-bezier(.3, 1.7, .5, 1) forwards; }
@keyframes lbPop { to { transform: scale(1); } }
/* الثعبان */
.lb-body { stroke-dasharray: 1; stroke-dashoffset: 1; animation: lbDraw 1s 1.45s ease-in-out forwards; }
.lb-tongue, .lb-head { opacity: 0; animation: fadeIn .3s 2.3s forwards; }
.lb-head { transform-box: fill-box; transform-origin: center; }
/* لمعة دهبي */
.sp-shine { position: absolute; inset: -6%; z-index: 3; pointer-events: none; border-radius: 30px; mix-blend-mode: soft-light;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .95) 50%, transparent 65%); background-size: 250% 100%; background-position: 150% 0;
  animation: spShine 1.2s 2.4s ease-in-out forwards; }
@keyframes spShine { to { background-position: -60% 0; } }
.sp-ring { position: absolute; z-index: 1; left: 50%; top: 58%; width: 120%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%;
  border: 2px solid rgba(18, 56, 224, .35); opacity: 0; animation: ringOut 2.6s 1.6s ease-out infinite; }
.sp-ring.r2 { border-color: rgba(212, 160, 23, .45); animation-delay: 2.9s; }

.sp-ar { position: relative; margin: 0; font-family: 'Lalezar', var(--head); font-weight: 400; font-size: clamp(30px, 9vw, 46px); line-height: 1.25;
  background: linear-gradient(90deg, #0a24b0, #2f5bff, #0a24b0); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  opacity: 0; transform: translateY(18px); filter: blur(6px); animation: spIn .8s 1.9s cubic-bezier(.2, .8, .2, 1) forwards, shine 5s 2.7s linear infinite; }
@keyframes spIn { to { opacity: 1; transform: none; filter: none; } }
.sp-en { position: relative; margin: 6px 0 0; font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: clamp(11px, 3.3vw, 14px); color: #22314d; direction: ltr; letter-spacing: .14em; }
.sp-en span { display: inline-block; opacity: 0; transform: translateY(8px); animation: spIn .4s calc(2.2s + var(--i) * 28ms) forwards; }
.sp-slogan { position: relative; margin: 12px 0 0; font-family: 'Aref Ruqaa', serif; font-weight: 700; font-size: clamp(30px, 9vw, 42px); color: #1238e0; line-height: 1.3;
  clip-path: inset(0 0 0 100%); animation: spWrite 1.1s 2.9s cubic-bezier(.6, 0, .3, 1) forwards; }
@keyframes spWrite { to { clip-path: inset(0 0 0 0); } }
.sp-info { position: relative; display: grid; gap: 6px; justify-items: center; margin-top: 16px; font-size: 12.5px; color: #4b5d7a; opacity: 0; animation: fadeIn .7s 3.4s forwards; }
.sp-info span { background: rgba(255, 255, 255, .8); border: 1px solid rgba(18, 56, 224, .12); padding: 5px 12px; border-radius: 20px; box-shadow: 0 6px 16px -12px rgba(18, 56, 224, .5); }
#splash .splash-bar { background: rgba(18, 56, 224, .12); margin-top: 18px; animation: fadeIn .4s 1s forwards; }
#splash .splash-bar i { background: linear-gradient(90deg, transparent, #1238e0, #f2c94c, transparent); }
#splash.out { transform: scale(1.06); filter: blur(8px); }

/* الأيقونة في الهيدر: بيضا فوق التدرّج */
.emblem.small img { background: #fff; }
.save-badge { align-self: flex-start; font-size: 12px; font-weight: 700; color: #fff; padding: 4px 10px; border-radius: 20px;
  background: linear-gradient(135deg, #22c55e, #059669); box-shadow: 0 6px 14px -6px rgba(5, 150, 105, .8); animation: chipIn .5s .3s both; }

/* تحاليل وأشعة جوه الروشتة */
.rx-item.nondrug { background: linear-gradient(90deg, rgba(168, 85, 247, .06), transparent 70%); }
.rx-item.nondrug .rx-num { background: #f3e8ff; color: #7c3aed; box-shadow: none; font-size: 16px; }
.rx-item.nondrug.scan { background: linear-gradient(90deg, rgba(14, 165, 233, .07), transparent 70%); }
.rx-item.nondrug.scan .rx-num { background: #e0f2fe; }
.rx-item.nondrug b { direction: ltr; }
.tag.kind-lab { background: #f3e8ff; color: #6d28d9; font-weight: 600; }
.tag.kind-scan { background: #e0f2fe; color: #0369a1; font-weight: 600; }
.tag.kind-oth { background: #f1f5f9; color: #475569; font-weight: 600; }
.lab-where { color: var(--muted); font-size: 11.5px; }
.rx.labs .rx-head { background: linear-gradient(135deg, #a855f7, #6366f1); }

/* ============================================================
   الفتح من ماسنجر/انستا/تطبيقات (html.embedded):
   نلغي البلور + الخلفية المتحركة + الكانفس + الماسك
   لأنها بتعمل فلاش/وميض متكرر في الـwebview. تصميم مسطّح ثابت.
   ============================================================ */
html.embedded body { background: linear-gradient(170deg, #eaf7f7 0%, #f4f9ff 45%, #eef3ff 100%); }
html.embedded .bg,
html.embedded .bg .aurora,
html.embedded .bg .grid,
html.embedded .bg .capsule,
html.embedded #particles { display: none !important; }
/* إلغاء كل البلور والشفافية اللي بتتقل على رسم الـwebview */
html.embedded .top,
html.embedded .bubble.bot,
html.embedded .card,
html.embedded .rx,
html.embedded .chips .chip,
html.embedded .sheet-panel,
html.embedded .pick-panel,
html.embedded .top .icon-btn,
html.embedded .sheet-backdrop,
html.embedded .pick-backdrop { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
/* خلفيات صريحة بدل الشفافية */
html.embedded .bubble.bot { background: #ffffff; }
html.embedded .composer-wrap { background: #f4f9ff; }
html.embedded .chat { mask-image: none !important; -webkit-mask-image: none !important; }
html.embedded .top .icon-btn { background: rgba(255,255,255,.22); }
html.embedded #app { animation: none; }           /* من غير أنيميشن دخول علشان مايبانش فلاش لو الصفحة اترسمت تاني */

/* ============================================================
   SALAMTAK_BRAND_V1 (2026-11-14) — «سلامتك»
   1) شاشة بداية جديدة: لوجو قلب + نبض + علامة صيدلية، بيتحرك مرة واحدة (transform/opacity/stroke بس)
   2) التطبيق هادي: من غير خلفية متحركة ولا بلور ولا لمعان متكرر (كان بيعمل مشاكل/وميض)،
      وفاضل أنيميشن بسيط للرسايل والأزرار.
   ============================================================ */

/* ---------- 1) Splash ---------- */
#splash {
  background: radial-gradient(120% 85% at 50% 35%, #ffffff 0%, #f0f8ff 55%, #e3efff 100%) !important;
  color: #0b2540; gap: 0 !important; padding: 24px; overflow: hidden;
}
#splash::before, #splash::after { display: none !important; }
#splash.out { opacity: 0 !important; transform: scale(1.04) !important; filter: none !important; transition: opacity .45s ease, transform .45s ease !important; }

.sl-stage { position: relative; width: min(52vw, 210px); aspect-ratio: 1; margin-bottom: 18px; }
.sl-stage::after { content: ''; position: absolute; left: 14%; right: 14%; bottom: -10%; height: 14%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(14, 116, 233, .28), transparent); opacity: 0; animation: slFade calc(.6s * var(--k, 1)) calc(.5s * var(--k, 1)) forwards; }
.sl-mark { position: relative; z-index: 2; width: 100%; height: 100%; overflow: visible; }
.sl-mark g, .sl-mark path { transform-box: fill-box; transform-origin: center; }

.sl-disc { transform: scale(0); animation: slPop calc(.8s * var(--k, 1)) calc(.1s * var(--k, 1)) cubic-bezier(.34, 1.56, .64, 1) forwards; }
.sl-heart { stroke-dasharray: 1; stroke-dashoffset: 1; animation: slDraw calc(.9s * var(--k, 1)) calc(.55s * var(--k, 1)) cubic-bezier(.65, 0, .35, 1) forwards; }
.sl-pulse { stroke-dasharray: 1; stroke-dashoffset: 1; animation: slDraw calc(.6s * var(--k, 1)) calc(1.3s * var(--k, 1)) ease-out forwards; }
.sl-badge { transform: scale(0) rotate(-120deg); animation: slBadge calc(.65s * var(--k, 1)) calc(1.65s * var(--k, 1)) cubic-bezier(.34, 1.7, .64, 1) forwards; }

.sl-ripple { position: absolute; z-index: 1; inset: 0; border-radius: 50%; border: 3px solid rgba(14, 165, 233, .45);
  opacity: 0; transform: scale(.92); animation: slRipple calc(1.3s * var(--k, 1)) calc(1.75s * var(--k, 1)) ease-out forwards; }
.sl-ripple.r2 { border-color: rgba(79, 70, 229, .35); animation-delay: 2s; }

.sl-word { margin: 0; line-height: 1.15; font-family: 'Lalezar', 'Alexandria', sans-serif; font-weight: 400; font-size: clamp(56px, 17vw, 88px); }
.sl-word span { display: inline-block; padding: 0 .08em;
  background: linear-gradient(100deg, #0d9488 0%, #0ea5e9 35%, #4f46e5 55%, #ffffff 62%, #4f46e5 70%, #0ea5e9 85%, #0d9488 100%);
  background-size: 260% 100%; background-position: 100% 0; -webkit-background-clip: text; background-clip: text; color: transparent;
  clip-path: inset(0 0 0 100%); transform: translateY(10px);
  animation: slReveal calc(.85s * var(--k, 1)) calc(1.8s * var(--k, 1)) cubic-bezier(.2, .8, .2, 1) forwards, slShine calc(1.1s * var(--k, 1)) calc(2.6s * var(--k, 1)) ease-in-out forwards; }

.sl-tag { margin: 4px 0 0; font-family: 'Alexandria', sans-serif; font-weight: 600; font-size: clamp(15px, 4.4vw, 19px); color: #31507a;
  opacity: 0; transform: translateY(8px); animation: slRise calc(.6s * var(--k, 1)) calc(2.35s * var(--k, 1)) ease forwards; }
#splash .sp-info { margin-top: 18px; animation: slFade calc(.6s * var(--k, 1)) calc(2.6s * var(--k, 1)) forwards !important; }
#splash .sp-info span { font-size: 12px; }
.sl-bar { position: relative; width: min(46vw, 180px); height: 4px; margin-top: 22px; border-radius: 4px; background: rgba(14, 165, 233, .15); overflow: hidden; }
.sl-bar i { position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(90deg, #2dd4bf, #0ea5e9, #4f46e5);
  transform-origin: right center; transform: scaleX(0); animation: slLoad calc(3s * var(--k, 1)) calc(.2s * var(--k, 1)) cubic-bezier(.4, 0, .2, 1) forwards; }

@keyframes slPop { 70% { transform: scale(1.06); } to { transform: scale(1); } }
@keyframes slDraw { to { stroke-dashoffset: 0; } }
@keyframes slBadge { to { transform: scale(1) rotate(0); } }
@keyframes slRipple { 0% { opacity: .9; transform: scale(.92); } 100% { opacity: 0; transform: scale(1.55); } }
@keyframes slReveal { to { clip-path: inset(0 0 0 0); transform: none; } }
@keyframes slShine { to { background-position: 0 0; } }
@keyframes slRise { to { opacity: 1; transform: none; } }
@keyframes slFade { to { opacity: 1; } }
@keyframes slLoad { to { transform: scaleX(1); } }

@media (prefers-reduced-motion: reduce) {
  .sl-disc, .sl-badge, .sl-word span, .sl-tag { animation: none !important; transform: none !important; clip-path: none !important; opacity: 1 !important; }
  .sl-heart, .sl-pulse { animation: none !important; stroke-dashoffset: 0 !important; }
  .sl-ripple { display: none; }
}

/* ---------- 2) Calm app ---------- */
body { background: linear-gradient(170deg, #eaf7f7 0%, #f4f9ff 45%, #eef3ff 100%) !important; }
.bg, .bg * , #particles { display: none !important; }
#app, #app *, .sheet, .sheet *, .pick, .pick * { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
.chat { mask-image: none !important; -webkit-mask-image: none !important; }
.bubble.bot { background: #ffffff; }
.composer-wrap { background: #f4f9ff; }
.top .icon-btn { background: rgba(255, 255, 255, .22); }

/* decorative loops off (functional ones stay: typing dots, steps spinner, scan line, mic recording) */
.top, .top::before, .tile::before, .btn::after, .pick-btn::after, .chip::after, .online::after,
.c-btn.cam.pulse, .emblem.big, .emblem-svg .ring2, .ecg, .top .ecg { animation: none !important; }
.top::before, .tile::before, .btn::after, .pick-btn::after, .chip::after { display: none !important; }

/* simple entrances: fade / slide only, no blur, no 3D */
#app { animation: slAppIn .35s ease both !important; }
@keyframes slAppIn { from { opacity: 0; } }
.bubble { animation: slBubble .28s ease both !important; filter: none !important; }
@keyframes slBubble { from { opacity: 0; transform: translateY(8px); } }
.bubble .w { filter: none !important; animation: slFade .25s ease forwards !important; }
.card, .rx, .item, .chip { animation: slBubble .3s ease both !important; }

/* SALAMTAK_BRAND_V1 step 2: chat avatar = app icon; no pharmacy numbers on the splash */
.row .av.sl-av { padding: 0; background: none !important; border: 0 !important; overflow: hidden; border-radius: 9px; box-shadow: 0 4px 10px -4px rgba(14, 165, 233, .55); }
.row .av.sl-av img { width: 100%; height: 100%; display: block; }

/* SALAMTAK_MULTI_V1 — اختيار الصيدلية في الطلب */
.ph-pick { margin-top: 12px; display: grid; gap: 8px; }
.ph-title { font-weight: 700; font-size: 14px; color: #0b2540; }
.ph { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: #fff; border: 1.5px solid #e2e8f0; cursor: pointer; transition: border-color .2s, background .2s; }
.ph input { width: 18px; height: 18px; accent-color: #0ea5e9; flex: none; }
.ph-txt { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ph-txt b { font-size: 14px; color: #0b2540; }
.ph-txt small { font-size: 12px; color: #64748b; }
.ph-off { flex: none; font-size: 11.5px; font-weight: 700; color: #b45309; background: #fef3c7; border-radius: 999px; padding: 3px 9px; }
.ph.on { border-color: #0ea5e9; background: #f0f9ff; }
.ph-one { margin-top: 12px; padding: 10px 12px; border-radius: 14px; background: #f0f9ff; color: #0b2540; font-size: 13.5px; }

/* ============================================================
   SALAMTAK_KEYBOARD_V1 + clean chat (2026-11-14)
   ============================================================ */
html, body { height: 100%; overflow: hidden; }
#app { transform: translateY(var(--vv-top, 0px)); }

/* keyboard open: the whole app fits above the keyboard */
html.kb-open .top { margin: 6px 8px 0; padding: 6px 8px; border-radius: 16px; }
html.kb-open .emblem.small { width: 32px; height: 32px; }
html.kb-open .emblem.small img { border-radius: 10px; }
html.kb-open .who-text small, html.kb-open .online { display: none; }
html.kb-open .top .icon-btn { width: 34px; height: 34px; border-radius: 10px; }
html.kb-open .chips, html.kb-open .disclaimer { display: none !important; }
html.kb-open .composer-wrap { padding: 6px 8px 6px; }
html.kb-open .chat { padding-top: 10px; }

/* clean, readable chat */
.chat { gap: 6px; padding: 14px 12px 10px; }
.row + .row.user, .row.user + .row.bot { margin-top: 8px; }   /* space between speakers, tight inside a group */
.bubble { font-size: 15.5px; line-height: 1.7; padding: 10px 14px; max-width: min(84%, 520px); border-radius: 18px; }
.bot .bubble { background: #fff; color: #0f1f33; border: 1px solid #e3ecf6; box-shadow: 0 2px 6px rgba(15, 40, 80, .06); border-bottom-right-radius: 6px; }
.user .bubble { background: linear-gradient(135deg, #0ea5e9, #2563eb); color: #fff; box-shadow: 0 2px 8px rgba(37, 99, 235, .25); border-bottom-left-radius: 6px; }
.row .av.sl-av { width: 28px; height: 28px; }
.composer { border-radius: 24px; box-shadow: 0 2px 10px rgba(15, 40, 80, .08); }
.composer input[type=text] { font-size: 16px; } /* 16px = iOS doesn't zoom on focus */
.chips { padding: 2px 2px 8px; }
.chip { font-size: 14px; padding: 8px 14px; }
.disclaimer { font-size: 11px; margin-top: 6px; }

/* compact, tidy start tiles (icon + title in one line, short hint under) */
.tiles { gap: 8px !important; margin: 4px 36px 4px 0 !important; }
.tile { min-height: 0 !important; padding: 10px 12px !important; border-radius: 16px !important; display: grid !important;
  grid-template-columns: 38px minmax(0, 1fr); column-gap: 9px; align-items: center; text-align: right; }
.tile::after { display: none; }
.tile .ti { grid-row: span 2; width: 38px !important; height: 38px !important; border-radius: 12px !important; font-size: 20px !important; margin: 0 !important; }
.tile b { font-size: 14px; line-height: 1.35; }
.tile small { font-size: 11.5px; line-height: 1.4; margin-top: 1px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
html.kb-open .tile small { display: none; }
html.kb-open .tile .ti { grid-row: auto; }
.tile small { display: none !important; }            /* title + icon only = clearer */
.tile .ti { grid-row: auto !important; }
.tile b { font-size: 14.5px; }
.tile { grid-template-columns: 34px minmax(0, 1fr) !important; column-gap: 8px !important; padding: 10px !important; }
.tile .ti { width: 34px !important; height: 34px !important; font-size: 18px !important; border-radius: 10px !important; }
.tile b { font-size: clamp(12.5px, 3.6vw, 14px) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
