/* ============================================================
   تطبيق المريض — تجربة جوال بالكامل (تعمل داخل المتصفح كأنها تطبيق)
   ============================================================ */
html, body { height: 100%; }
.patient-body { background: radial-gradient(1200px 600px at 50% -10%, #17457f 0%, var(--navy-800) 45%, var(--navy-900) 100%); overscroll-behavior: none; }
.app-frame { position: relative; width: 100%; min-height: 100vh; min-height: 100dvh; margin: 0 auto; background: var(--surface-sunken); display: flex; flex-direction: column; overflow: hidden; }
@media (min-width: 700px) {
  .patient-body { padding: 28px 0; }
  .app-frame { max-width: 440px; min-height: calc(100vh - 56px); min-height: calc(100dvh - 56px); border-radius: 36px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), 0 0 0 10px #0d1f3a, 0 0 0 12px #2a3f61; }
}
.view { flex: 1; display: flex; flex-direction: column; min-height: 0; animation: view-in var(--t-med) var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
[dir="ltr"] .view { animation-name: view-in-ltr; }
@keyframes view-in-ltr { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }

.net-banner { position: fixed; top: calc(var(--safe-top) + 10px); inset-inline: 0; margin: 0 auto; width: max-content; max-width: 90%; padding: 8px 16px; border-radius: 999px; background: var(--warn-800); color: #fff; font-size: var(--fs-sm); font-weight: 600; z-index: 1200; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px; }
.net-banner.ok { background: var(--ok-700); }

/* ---------- الترحيب ---------- */
.hero { position: relative; background: linear-gradient(170deg, var(--navy-700) 0%, var(--navy-800) 55%, var(--navy-900) 100%); color: #fff; padding: calc(var(--safe-top) + 22px) 22px 30px; border-radius: 0 0 38px 38px; overflow: hidden; }
.hero::before { content: ""; position: absolute; width: 360px; height: 360px; border-radius: 50%; border: 22px solid rgba(217, 165, 33, 0.14); top: -180px; inset-inline-end: -140px; }
.hero::after { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; border: 14px solid rgba(255, 255, 255, 0.05); bottom: -120px; inset-inline-start: -90px; }
.hero-top { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 1; }
.lang-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); color: #fff; font-size: var(--fs-sm); font-weight: 600; border: 1px solid rgba(255, 255, 255, 0.18); }
.hero-logo { position: relative; z-index: 1; width: 128px; height: 128px; margin: 14px auto 16px; border-radius: 34px; background: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35), 0 0 0 6px rgba(217, 165, 33, 0.25); overflow: hidden; }
.hero-logo img { width: 112px; height: 112px; object-fit: contain; }
.hero h1 { position: relative; z-index: 1; color: #fff; font-size: 1.55rem; text-align: center; letter-spacing: -0.01em; }
.hero .clinic-name { position: relative; z-index: 1; text-align: center; color: var(--gold-300); font-weight: 600; font-size: var(--fs-sm); margin-bottom: 8px; letter-spacing: 0.02em; }
.hero .hero-sub { position: relative; z-index: 1; text-align: center; color: rgba(255, 255, 255, 0.78); font-size: var(--fs-md); margin-top: 8px; padding: 0 8px; }
.doc-status { position: relative; z-index: 1; margin: 18px auto 0; width: max-content; max-width: 100%; display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.14); font-size: var(--fs-sm); font-weight: 600; }
.doc-status .dot-live { flex: none; }
.doc-status.busy .dot-live { background: var(--warn-600); animation: none; box-shadow: none; }
.doc-status.away .dot-live { background: var(--gold-400); animation: none; box-shadow: none; }
.doc-status.offline .dot-live { background: var(--ink-300); animation: none; box-shadow: none; }
.welcome-body { padding: 22px 20px calc(var(--safe-bottom) + 24px); display: flex; flex-direction: column; gap: 18px; flex: 1; }
.features { display: flex; flex-direction: column; gap: 10px; }
.feature { display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line-soft); box-shadow: var(--shadow-sm); font-weight: 500; color: var(--ink-700); font-size: var(--fs-sm); }
.feature .fi { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--navy-50); color: var(--navy-700); flex: none; }
.feature .fi.gold { background: var(--gold-100); color: var(--gold-700); }
.feature .fi.ok { background: var(--ok-50); color: var(--ok-700); }
.welcome-cta { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.welcome-cta .btn-lg { min-height: 58px; font-size: 1.05rem; }
.welcome-foot { text-align: center; font-size: var(--fs-xs); color: var(--ink-500); display: flex; align-items: center; justify-content: center; gap: 6px; }
.resume-card { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--radius); background: var(--gold-50); border: 1px solid var(--gold-200); }
.resume-card .ic { color: var(--gold-700); flex: none; }
.resume-card b { display: block; font-size: var(--fs-md); color: var(--ink-900); }
.resume-card span { font-size: var(--fs-xs); color: var(--ink-500); }

/* ---------- الخطوات ---------- */
.step-head { background: var(--surface); padding: calc(var(--safe-top) + 12px) 16px 12px; border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; z-index: 5; }
.step-nav { display: flex; align-items: center; gap: 12px; }
.step-nav .back { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-sunken); color: var(--ink-700); }
[dir="rtl"] .step-nav .back .ic { transform: scaleX(-1); }
.step-nav .step-label { font-size: var(--fs-xs); color: var(--ink-500); font-weight: 600; margin-inline-start: auto; }
.progress { display: flex; gap: 6px; margin-top: 12px; }
.progress i { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.progress i.on { background: var(--gold-500); }
.progress i.done { background: var(--navy-600); }
.step-title { flex: 1; min-width: 0; }
.step-title h2 { font-size: 1.25rem; }
.step-title p { color: var(--ink-500); font-size: var(--fs-sm); margin-top: 4px; }
.step-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 18px 16px 30px; display: flex; flex-direction: column; gap: 18px; }
.step-foot { position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(243, 246, 250, 0) 0%, var(--surface-sunken) 30%); padding: 10px 16px calc(var(--safe-bottom) + 14px); display: flex; gap: 10px; }
.step-foot .btn { flex: 1; }
.step-foot.col { flex-direction: column; gap: 8px; }
.step-foot.col .btn { width: 100%; min-height: 58px; font-size: 1.05rem; }
.consent-note { display: flex; align-items: flex-start; gap: 6px; font-size: 11px; line-height: 1.45; color: var(--ink-500); text-align: start; padding: 0 4px; }
.consent-note .ic { flex: none; margin-top: 2px; color: var(--ok-600); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
.section-lbl { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: var(--fs-md); color: var(--ink-900); }
.section-lbl .ic { color: var(--navy-500); }
.section-lbl small { font-weight: 500; color: var(--ink-500); font-size: var(--fs-xs); margin-inline-start: auto; text-align: end; }
.section-lbl .req { color: var(--danger-600); }
.group { display: flex; flex-direction: column; gap: 10px; }
.reason-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.reason { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 8px 12px; border-radius: 14px; border: 1.5px solid var(--line-strong); background: var(--surface); font-size: var(--fs-sm); font-weight: 600; color: var(--ink-700); text-align: start; transition: all var(--t-fast) var(--ease); -webkit-tap-highlight-color: transparent; }
.reason .ri { width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--navy-50); color: var(--navy-600); flex: none; }
.reason .ri .ic { width: 17px; height: 17px; }
.reason.on { border-color: var(--gold-500); background: var(--gold-50); color: var(--ink-900); box-shadow: 0 0 0 3px var(--gold-100); }
.reason.on .ri { background: var(--gold-500); color: #fff; }

/* شريط الألم */
.pain { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 14px 16px 10px; }
.pain-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.pain-val { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.pain-val b { font-size: 1.6rem; color: var(--navy-800); min-width: 28px; text-align: center; }
.pain-val span { font-size: var(--fs-sm); color: var(--ink-500); }
.pain-face { width: 34px; height: 34px; color: var(--ok-600); }
.pain-face.mid { color: var(--warn-600); } .pain-face.high { color: var(--danger-600); }
.pain input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 12px; border-radius: 6px; background: linear-gradient(90deg, #22c55e 0%, #facc15 45%, #f97316 70%, #dc2626 100%); outline: none; margin: 8px 0; direction: ltr; }
.pain input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 4px solid var(--navy-700); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); cursor: pointer; }
.pain input[type="range"]::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 4px solid var(--navy-700); cursor: pointer; }
.pain-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-500); direction: ltr; }

/* خريطة الفم */
.zm { display: flex; flex-direction: column; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 10px 8px 14px; }
.zm-svg { width: 100%; max-width: 320px; height: auto; }
.zm-path { fill: none; stroke: #F3E4DE; stroke-width: 44; stroke-linecap: butt; transition: stroke var(--t-fast); }
.zm-seg { cursor: pointer; }
.zm-hit { fill: none; stroke: transparent; stroke-width: 56; }
.zm-seg:hover .zm-path { stroke: #EBD2C8; }
.zm-seg.on .zm-path { stroke: var(--gold-400); }
.zm-lbl { font-size: 12px; font-weight: 700; fill: var(--ink-700); text-anchor: middle; pointer-events: none; }
.zm-seg.on .zm-lbl { fill: var(--navy-900); }
.zm-mid { stroke: var(--line-strong); stroke-dasharray: 4 5; }
.zm-jaw { font-size: 12px; font-weight: 600; fill: var(--ink-500); text-anchor: middle; }
.zm-side { font-size: 11px; fill: var(--ink-300); text-anchor: middle; }
.zm-unknown { align-self: center; }
.sym-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sym { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 12px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--surface); font-size: var(--fs-sm); font-weight: 600; color: var(--ink-700); }
.sym .ic { color: var(--ink-300); }
.sym.on { border-color: var(--danger-600); background: var(--danger-50); color: var(--danger-700); }
.sym.on .ic { color: var(--danger-600); }
.flag-grid { display: flex; flex-wrap: wrap; gap: 8px; }

/* الصور والتجهيز */
.photos { display: flex; flex-direction: column; gap: 10px; }
.photo-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo-actions .btn { min-height: 54px; flex-direction: column; gap: 4px; font-size: var(--fs-sm); }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--line-soft); border: 1px solid var(--line); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb .prog { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.6); }
.photo-thumb .ok { position: absolute; bottom: 6px; inset-inline-end: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--ok-600); color: #fff; display: flex; align-items: center; justify-content: center; }
.photo-thumb .ok .ic { width: 14px; height: 14px; }
.tip { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--gold-50); border: 1px solid var(--gold-200); color: var(--gold-700); font-size: var(--fs-xs); font-weight: 500; }
.tip .ic { flex: none; width: 18px; height: 18px; }
.device { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }
.device-preview { position: relative; aspect-ratio: 4 / 3; background: #0b1830; display: flex; align-items: center; justify-content: center; }
.device-preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.device-preview .ph { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: rgba(255, 255, 255, 0.7); font-size: var(--fs-sm); padding: 20px; text-align: center; }
.device-preview .ph .ic { width: 40px; height: 40px; }
.device-status { display: flex; align-items: center; gap: 10px; padding: 12px 14px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-700); }
.device-status .ic { flex: none; }
.device-status.ok { color: var(--ok-700); } .device-status.warn { color: var(--warn-800); }
.device-toggles { display: flex; gap: 8px; padding: 0 14px 14px; }
.device-toggles .btn { flex: 1; }
.device-toggles .btn.off { background: var(--danger-50); color: var(--danger-700); border-color: var(--danger-100); }
.consent-box { padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line-soft); }

/* ---------- غرفة الانتظار ---------- */
.wait { flex: 1; display: flex; flex-direction: column; background: linear-gradient(180deg, var(--navy-800) 0%, var(--navy-900) 100%); color: #fff; padding: calc(var(--safe-top) + 16px) 20px calc(var(--safe-bottom) + 20px); }
.wait-top { display: flex; align-items: center; justify-content: space-between; }
.wait-top .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: var(--fs-sm); }
.wait-top .brand img { width: 38px; height: 38px; border-radius: 10px; background: #fff; }
.wait-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; padding: 20px 0; }
.rings { position: relative; width: 190px; height: 190px; display: flex; align-items: center; justify-content: center; }
.rings i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(217, 165, 33, 0.55); animation: ring-out 2.8s var(--ease) infinite; }
.rings i:nth-child(2) { animation-delay: 0.9s; } .rings i:nth-child(3) { animation-delay: 1.8s; }
@keyframes ring-out { 0% { transform: scale(0.55); opacity: 0.9; } 100% { transform: scale(1.35); opacity: 0; } }
.rings .core { position: relative; width: 108px; height: 108px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.08), 0 20px 40px rgba(0, 0, 0, 0.35); overflow: hidden; }
.rings .core img { width: 92px; height: 92px; object-fit: contain; }
.wait h2 { color: #fff; font-size: 1.4rem; }
.wait .sub { color: rgba(255, 255, 255, 0.72); font-size: var(--fs-sm); max-width: 300px; }
.wait-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.wstat { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 14px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.wstat b { font-size: 1.25rem; color: var(--gold-300); }
.wstat b.small-b { font-size: 1rem; }
.wstat span { font-size: 11px; color: rgba(255, 255, 255, 0.65); }
.wait-doc { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.1); text-align: start; }
.wait-doc .avatar { background: var(--gold-500); color: var(--navy-900); }
.wait-doc b { display: block; font-size: var(--fs-md); }
.wait-doc span { font-size: var(--fs-xs); color: rgba(255, 255, 255, 0.7); display: flex; align-items: center; gap: 6px; }
.wait-tips { width: 100%; min-height: 64px; padding: 12px 14px; border-radius: 14px; background: rgba(217, 165, 33, 0.12); border: 1px solid rgba(217, 165, 33, 0.3); font-size: var(--fs-sm); color: var(--gold-100); display: flex; align-items: center; gap: 10px; text-align: start; }
.wait-tips .ic { flex: none; color: var(--gold-300); }
.wait-actions { display: flex; gap: 10px; }
.wait-actions .btn { flex: 1; }
.btn-glass { background: rgba(255, 255, 255, 0.12); color: #fff; border-color: rgba(255, 255, 255, 0.2); }
.btn-glass:hover { background: rgba(255, 255, 255, 0.2); }
.btn-glass .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--gold-500); color: var(--navy-900); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- الرنين ---------- */
.ring { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 18px; padding: 30px 24px calc(var(--safe-bottom) + 30px); background: radial-gradient(600px 400px at 50% 30%, #1d5aa0 0%, var(--navy-800) 50%, var(--navy-900) 100%); color: #fff; }
.ring .avatar-ring { position: relative; width: 150px; height: 150px; display: flex; align-items: center; justify-content: center; }
.ring .avatar-ring i { position: absolute; inset: 0; border-radius: 50%; border: 3px solid rgba(217, 165, 33, 0.6); animation: ring-out 1.6s var(--ease) infinite; }
.ring .avatar-ring i:nth-child(2) { animation-delay: 0.5s; } .ring .avatar-ring i:nth-child(3) { animation-delay: 1s; }
.ring .avatar-ring .avatar { width: 104px; height: 104px; font-size: 2rem; background: var(--gold-500); color: var(--navy-900); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4); }
.ring h2 { color: #fff; font-size: 1.5rem; }
.ring .doc-name { color: var(--gold-300); font-weight: 700; font-size: 1.1rem; }
.ring .sub { color: rgba(255, 255, 255, 0.75); }
.ring .btn-join { min-height: 64px; font-size: 1.15rem; width: 100%; border-radius: 32px; animation: glow-btn 1.6s var(--ease) infinite; }
@keyframes glow-btn { 0%, 100% { box-shadow: 0 8px 24px rgba(217, 165, 33, 0.35); } 50% { box-shadow: 0 8px 34px rgba(217, 165, 33, 0.75), 0 0 0 6px rgba(217, 165, 33, 0.18); } }

/* ---------- المكالمة ---------- */
.call { position: relative; flex: 1; background: #06101f; color: #fff; overflow: hidden; display: flex; flex-direction: column; }
.call-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #06101f; }
.call-remote-ph { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: radial-gradient(500px 400px at 50% 40%, #16406f 0%, #0a1e3a 60%, #06101f 100%); }
.call-remote-ph .avatar { width: 110px; height: 110px; font-size: 2.2rem; background: var(--gold-500); color: var(--navy-900); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4); }
.call-remote-ph .st { font-size: var(--fs-md); font-weight: 600; color: rgba(255, 255, 255, 0.85); }
.call-remote-ph .spinner { margin-top: 6px; }
.call-top { position: absolute; top: 0; inset-inline: 0; padding: calc(var(--safe-top) + 12px) 14px 30px; background: linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 100%); display: flex; align-items: center; justify-content: space-between; gap: 10px; z-index: 3; }
.call-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.call-who .avatar { width: 38px; height: 38px; background: var(--gold-500); color: var(--navy-900); font-size: var(--fs-sm); }
.call-who b { display: block; font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call-who span { font-size: var(--fs-xs); color: rgba(255, 255, 255, 0.75); display: flex; align-items: center; gap: 6px; }
.call-meta { display: flex; align-items: center; gap: 8px; flex: none; }
.call-timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: var(--fs-sm); background: rgba(0, 0, 0, 0.35); padding: 4px 10px; border-radius: 999px; }
.qbars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.qbars i { width: 3px; background: rgba(255, 255, 255, 0.3); border-radius: 1px; }
.qbars i:nth-child(1) { height: 5px; } .qbars i:nth-child(2) { height: 8px; } .qbars i:nth-child(3) { height: 11px; } .qbars i:nth-child(4) { height: 14px; }
.qbars.q1 i:nth-child(-n+1), .qbars.q2 i:nth-child(-n+2), .qbars.q3 i:nth-child(-n+3), .qbars.q4 i:nth-child(-n+4) { background: #4ade80; }
.qbars.q1 i:nth-child(-n+1) { background: #f87171; } .qbars.q2 i:nth-child(-n+2) { background: #fbbf24; }
.call-local { position: absolute; z-index: 4; width: 108px; aspect-ratio: 3 / 4; border-radius: 16px; overflow: hidden; background: #0b1830; border: 2px solid rgba(255, 255, 255, 0.35); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); top: calc(var(--safe-top) + 78px); inset-inline-end: 14px; touch-action: none; }
.call-local video { width: 100%; height: 100%; object-fit: cover; }
.call-local video.mirror { transform: scaleX(-1); }
.call-local .off { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: rgba(255, 255, 255, 0.6); background: #12233f; }
.call-bottom { position: absolute; bottom: 0; inset-inline: 0; padding: 40px 16px calc(var(--safe-bottom) + 14px); background: linear-gradient(0deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 100%); z-index: 3; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.call-hint { font-size: var(--fs-xs); background: rgba(0, 0, 0, 0.45); padding: 6px 12px; border-radius: 999px; color: rgba(255, 255, 255, 0.85); }
.call-controls { display: flex; align-items: flex-start; justify-content: center; gap: 14px; padding-bottom: 20px; }
.cbtn { position: relative; width: 56px; height: 56px; border-radius: 50%; background: rgba(255, 255, 255, 0.16); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: #fff; display: inline-flex; align-items: center; justify-content: center; border: 1px solid rgba(255, 255, 255, 0.18); transition: all var(--t-fast) var(--ease); -webkit-tap-highlight-color: transparent; }
.cbtn .ic { width: 24px; height: 24px; }
.cbtn small { position: absolute; top: calc(100% + 5px); inset-inline: -14px; text-align: center; font-size: 10.5px; font-weight: 600; color: rgba(255, 255, 255, 0.85); white-space: nowrap; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.cbtn:active { transform: scale(0.94); }
.cbtn.off { background: #fff; color: var(--ink-900); }
.cbtn.end { background: var(--danger-600); width: 60px; height: 60px; border-color: transparent; }
.cbtn.end .ic { width: 28px; height: 28px; }
.cbtn .count { position: absolute; top: -2px; inset-inline-end: -2px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--gold-500); color: var(--navy-900); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; border: 2px solid #06101f; }
.cbtn.on-gold { background: var(--gold-500); color: var(--navy-900); }
.call-tap { position: absolute; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; background: rgba(6, 16, 31, 0.7); }
.call-tap button { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px 28px; border-radius: 20px; background: rgba(255, 255, 255, 0.12); color: #fff; font-weight: 700; border: 1px solid rgba(255, 255, 255, 0.2); }
.call-tap button .ic { width: 36px; height: 36px; }
.call-banner { position: absolute; top: calc(var(--safe-top) + 74px); inset-inline-start: 14px; z-index: 3; max-width: calc(100% - 150px); padding: 8px 12px; border-radius: 12px; background: rgba(201, 123, 10, 0.92); font-size: var(--fs-xs); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.call-banner.ok { background: rgba(30, 142, 90, 0.92); }
.call-banner .ic { width: 16px; height: 16px; flex: none; }
.call-photo-req { position: absolute; inset-inline: 14px; bottom: calc(var(--safe-bottom) + 150px); z-index: 5; padding: 14px; border-radius: 16px; background: #fff; color: var(--ink-900); box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 12px; animation: sheet-in var(--t-slow) var(--ease-spring); }
.call-photo-req .ic-wrap { width: 44px; height: 44px; border-radius: 12px; background: var(--gold-100); color: var(--gold-700); display: flex; align-items: center; justify-content: center; flex: none; }
.call-photo-req b { display: block; font-size: var(--fs-md); }
.call-photo-req span { font-size: var(--fs-xs); color: var(--ink-500); }
.call-photo-req .btn { flex: none; }

/* محادثة المكالمة (ورقة) */
.chat-sheet { height: 92%; max-height: 92%; }
.chat-sheet .sheet-body { padding: 0; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-sheet .chat-compose { padding-bottom: 10px; }
.chat-sheet .chat { flex: 1; }
.chat-sheet .chat-list { background: var(--surface-sunken); }
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--ink-500); font-size: var(--fs-sm); gap: 8px; }
.chat-empty .ic { width: 36px; height: 36px; color: var(--line-strong); }

/* ---------- الملخص والانتهاء ---------- */
.done { flex: 1; display: flex; flex-direction: column; background: var(--surface-sunken); }
.done-hero { background: linear-gradient(170deg, var(--navy-700), var(--navy-900)); color: #fff; padding: calc(var(--safe-top) + 26px) 20px 30px; text-align: center; border-radius: 0 0 34px 34px; }
.done-hero .check { width: 72px; height: 72px; border-radius: 50%; background: var(--gold-500); color: var(--navy-900); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3); }
.done-hero .check .ic { width: 38px; height: 38px; }
.done-hero h2 { color: #fff; }
.done-hero p { color: rgba(255, 255, 255, 0.75); font-size: var(--fs-sm); margin-top: 6px; }
.done-body { flex: 1; padding: 18px 16px calc(var(--safe-bottom) + 24px); display: flex; flex-direction: column; gap: 14px; }
.sum-card { background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--line-soft); box-shadow: var(--shadow-sm); overflow: hidden; }
.sum-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--navy-50); border-bottom: 1px solid var(--line-soft); }
.sum-head h3 { font-size: var(--fs-lg); display: flex; align-items: center; gap: 8px; color: var(--navy-800); }
.sum-meta { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.sum-meta div { display: flex; flex-direction: column; gap: 2px; }
.sum-meta span { font-size: 11px; color: var(--ink-500); }
.sum-meta b { font-size: var(--fs-sm); }
.sum-sec { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.sum-sec:last-child { border-bottom: 0; }
.sum-sec h4 { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--navy-700); margin-bottom: 6px; }
.sum-sec h4 .ic { width: 16px; height: 16px; }
.sum-sec p { white-space: pre-wrap; font-size: var(--fs-md); color: var(--ink-900); }
.sum-sec ul { margin: 0; padding-inline-start: 18px; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-md); }
.med { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--surface-sunken); margin-bottom: 6px; }
.med b { font-size: var(--fs-md); }
.med span { font-size: var(--fs-xs); color: var(--ink-500); }
.teeth-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.teeth-chips span { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-sunken); font-size: var(--fs-xs); font-weight: 600; }
.teeth-chips i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.follow-box { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--gold-50); border: 1px solid var(--gold-200); }
.follow-box.urgent { background: var(--danger-50); border-color: var(--danger-100); }
.follow-box .ic { color: var(--gold-700); flex: none; }
.follow-box.urgent .ic { color: var(--danger-600); }
.follow-box b { display: block; font-size: var(--fs-md); }
.follow-box span { font-size: var(--fs-xs); color: var(--ink-500); }
.pending-box { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px dashed var(--line-strong); color: var(--ink-500); font-size: var(--fs-sm); }
.book { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.book .btn { min-height: 52px; }
.rate-card { text-align: center; padding: 18px 16px; }
.rate-card h3 { font-size: var(--fs-lg); }
.rate-card p { color: var(--ink-500); font-size: var(--fs-sm); margin: 4px 0 12px; }
.rate-card .stars { margin-bottom: 12px; }
.rate-card .textarea { min-height: 70px; margin-bottom: 10px; }
.rated { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--ok-700); font-weight: 600; padding: 10px; }

/* ---------- مغلق / معتذر ---------- */
.closed { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; padding: 40px 24px calc(var(--safe-bottom) + 30px); }
.closed .big { width: 84px; height: 84px; border-radius: 50%; background: var(--warn-100); color: var(--warn-800); display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.closed .big .ic { width: 40px; height: 40px; }
.closed p { color: var(--ink-500); max-width: 320px; }
.closed .book { width: 100%; margin-top: 10px; }
.closed .btn-lg { width: 100%; margin-top: 8px; }

@media print {
  .patient-body { background: #fff; padding: 0; }
  .app-frame { box-shadow: none; border-radius: 0; max-width: none; min-height: 0; }
  .done-hero { background: #0B2E5C !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; border-radius: 0; }
  .rate-card, .book, .done-actions, .net-banner { display: none !important; }
}

/* ---------- إضافات الرحلة المبسطة ---------- */
.steps-list { display: flex; flex-direction: column; gap: 8px; }
.step-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line-soft); box-shadow: var(--shadow-sm); font-weight: 600; color: var(--ink-700); font-size: var(--fs-md); }
.step-item .sn { width: 26px; height: 26px; border-radius: 50%; background: var(--gold-500); color: var(--navy-900); font-weight: 800; font-size: var(--fs-sm); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.step-item .si { width: 36px; height: 36px; border-radius: 10px; background: var(--navy-50); color: var(--navy-700); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.resume-card .end { margin-inline-start: auto; color: var(--ink-300); }
[dir="rtl"] .resume-card .end { transform: none; }
.step-body > .field .input { min-height: 54px; font-size: 17px; }
.reason-grid .reason { min-height: 52px; }
.photo-thumb .rm { position: absolute; top: 4px; inset-inline-end: 4px; width: 26px; height: 26px; border-radius: 50%; background: rgba(0, 0, 0, 0.6); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.more { border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.more-toggle { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-align: start; color: var(--ink-900); }
.more-toggle > .ic:first-child { color: var(--navy-500); flex: none; }
.more-toggle span { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.more-toggle b { font-size: var(--fs-md); }
.more-toggle small { font-size: var(--fs-xs); color: var(--ink-500); font-weight: 400; line-height: 1.4; }
.more-toggle .chev { color: var(--ink-300); transition: transform var(--t-med) var(--ease); }
.more-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.more-body { display: flex; flex-direction: column; gap: 14px; padding: 4px 16px 18px; border-top: 1px solid var(--line-soft); }
.more-body .form-grid { gap: 12px; }
.wait-check { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; background: rgba(30, 142, 90, 0.22); border: 1px solid rgba(74, 222, 128, 0.4); color: #bff0d3; font-size: var(--fs-sm); font-weight: 700; }
.wait-stats { grid-template-columns: 1fr 1.4fr; }
.wait-photos { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: 100%; }
.wphoto { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.14); color: #fff; font-size: var(--fs-xs); font-weight: 600; }
.wphoto.btn-add { background: rgba(217, 165, 33, 0.18); border-color: rgba(217, 165, 33, 0.45); color: var(--gold-200); }
.ring-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 340px; }
.ring-actions .btn-glass { min-height: 52px; border-radius: 26px; }
.ring .perm-note { display: flex; align-items: flex-start; gap: 6px; max-width: 340px; font-size: var(--fs-xs); color: rgba(255, 255, 255, 0.7); text-align: start; line-height: 1.5; }
.ring .perm-note .ic { flex: none; margin-top: 2px; }
.perm-card { position: absolute; inset-inline: 14px; top: calc(var(--safe-top) + 74px); z-index: 5; padding: 12px 14px; border-radius: 16px; background: #fff; color: var(--ink-900); box-shadow: var(--shadow-lg); display: flex; align-items: flex-start; gap: 12px; animation: sheet-in var(--t-slow) var(--ease-spring); max-width: calc(100% - 28px); }
.perm-card .ic-wrap { width: 40px; height: 40px; border-radius: 12px; background: var(--navy-50); color: var(--navy-700); display: flex; align-items: center; justify-content: center; flex: none; }
.perm-card .ic-wrap.warn { background: var(--warn-100); color: var(--warn-800); }
.perm-card > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.perm-card b { font-size: var(--fs-sm); }
.perm-card span { font-size: var(--fs-xs); color: var(--ink-500); line-height: 1.45; }
.perm-card .btn { align-self: flex-start; margin-top: 4px; }
.perm-card .pc-close { width: 30px; height: 30px; border-radius: 50%; color: var(--ink-500); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.call-local.is-off { width: 76px; }
.call-local.is-off video { opacity: 0; }
@media (max-height: 700px) {
  .hero-logo { width: 96px; height: 96px; margin: 8px auto 12px; border-radius: 26px; }
  .hero-logo img { width: 84px; height: 84px; }
  .hero h1 { font-size: 1.35rem; }
  .rings { width: 150px; height: 150px; }
  .rings .core { width: 90px; height: 90px; } .rings .core img { width: 76px; height: 76px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .call-top { padding-top: calc(var(--safe-top) + 8px); padding-bottom: 20px; }
  .call-local { width: 90px; top: calc(var(--safe-top) + 62px); }
  .call-bottom { padding-top: 24px; }
  .cbtn { width: 48px; height: 48px; } .cbtn.end { width: 52px; height: 52px; }
  .call-remote-ph .avatar { width: 72px; height: 72px; }
  .hero { padding-top: calc(var(--safe-top) + 10px); padding-bottom: 18px; border-radius: 0 0 24px 24px; }
  .hero-logo { width: 64px; height: 64px; margin: 6px auto 8px; border-radius: 18px; } .hero-logo img { width: 56px; height: 56px; }
  .hero h1 { font-size: 1.15rem; } .hero .hero-sub { display: none; }
  .wait-center { gap: 8px; padding: 8px 0; } .rings { width: 100px; height: 100px; } .rings .core { width: 64px; height: 64px; } .rings .core img { width: 54px; height: 54px; }
  .wait-tips { display: none; }
  .ring { gap: 10px; padding: 16px 20px; } .ring .avatar-ring { width: 90px; height: 90px; } .ring .avatar-ring .avatar { width: 64px; height: 64px; } .ring h2 { font-size: 1.2rem; }
}

/* ---------- بيانات إضافية (مجموعات) ومرفقات متعددة الأنواع ---------- */
.mgrp { display: flex; flex-direction: column; gap: 12px; padding: 12px 0 4px; border-top: 1px dashed var(--line); }
.mgrp:first-child { border-top: 0; padding-top: 4px; }
.mgrp-t { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: var(--fs-sm); color: var(--navy-700); }
.mgrp .chips .chip { min-height: 38px; }
.mgrp .seg button { min-height: 40px; font-size: var(--fs-xs); padding: 0 4px; }
.photo-actions.three { grid-template-columns: 1fr 1fr; }
.photo-thumb.file { display: flex; align-items: center; justify-content: center; background: var(--navy-50); }
.photo-thumb .ft { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--navy-700); font-size: 10px; font-weight: 700; text-align: center; padding: 6px; }
.photo-thumb .kind { position: absolute; bottom: 4px; inset-inline-start: 4px; font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: rgba(11, 46, 92, 0.85); color: #fff; }
.msg-video { max-width: 240px; width: 100%; border-radius: 14px; border: 1px solid var(--line-soft); background: #000; }
.sum-meta small { display: block; font-size: 10px; color: var(--ink-500); direction: ltr; text-align: start; }
.sum-disclaimer { display: flex; gap: 8px; align-items: flex-start; font-size: var(--fs-xs); color: var(--ink-500); background: var(--surface-sunken); }
.sum-disclaimer .ic { flex: none; margin-top: 2px; color: var(--ok-600); }
