/* واجهة المريض /v2 (شبيهة بواتساب) — فوق styles.css؛ نفس العناصر والمعرّفات تبع الواجهة الأصلية */
html, body.v2 { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body.v2 { padding: 0; }
body.v2 .brandbar { display: none; }
#app { position: fixed; top: 0; left: 0; right: 0; height: var(--vvh, 100dvh); display: flex; flex-direction: column;
  max-width: 760px; margin: 0 auto; background: var(--bg); will-change: transform; }
@media (min-width: 800px) { #app { border-inline: 1px solid var(--line, #d9e1e7); box-shadow: 0 0 40px rgba(27,111,148,.08); } }

.v2top { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px; position: relative; background: var(--card, #fff); border-bottom: 1px solid var(--line, #d9e1e7); }
.v2top .who { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 auto; }
.v2top .av { width: 56px; height: 56px; border-radius: 50%; background: #fff; border: 1.5px solid var(--lab-sky, #9fd3ea);
  display: grid; place-items: center; flex: 0 0 auto; overflow: hidden; }
.v2top .av img { width: 30px; height: 38px; object-fit: contain; display: block; margin: 0; transform: translateY(-3px); }   /* المثلث بيبان أوطى من وسطه الهندسي ← رفع بصري 3px */
.v2top .ttl { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; line-height: 1.25; text-align: start; }   /* RTL: الاسم والسطر محاذيان من جهة الشعار */
.v2top .nm { font-size: 20px; font-weight: 800; color: var(--ink, #1d222b); }
.v2top .sub { font-size: 12.5px; font-weight: 400; color: var(--ink-3, #6b7480); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v2top .acts { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.v2top .hs { display: flex; flex-direction: column; align-items: center; gap: 1px; width: 58px; padding: 4px 0; background: none;
  border: 0; color: var(--ink-2, #4a5361); cursor: pointer; touch-action: manipulation; }
.v2top .hs svg { width: 34px; height: 34px; }          /* أكبر من قبل، وأصغر من المايكروفون السفلي (56px) */
.v2top .hs small { font-size: 11px; color: var(--ink-2); line-height: 1.1; }
.v2top .dots { width: 36px; height: 44px; display: grid; place-items: center; background: none; border: 0; color: var(--ink-2, #4a5361);
  cursor: pointer; border-radius: 10px; touch-action: manipulation; }
.v2top .dots svg { width: 22px; height: 22px; }
.v2menu { position: absolute; top: 100%; left: 8px; right: auto; z-index: 100; width: max-content; min-width: 190px; max-width: calc(100vw - 16px);
  background: var(--card, #fff); color: var(--ink, #1d222b); border: 1px solid var(--line, #d9e1e7); border-radius: 12px;
  box-shadow: 0 8px 28px rgba(15,25,35,.22); padding: 6px; margin-top: 2px; }
.v2menu[hidden] { display: none; }
.v2menu button { display: block; width: 100%; text-align: start; background: none; border: 0; color: inherit; font: inherit; font-size: 16px;
  padding: 12px 14px; border-radius: 8px; cursor: pointer; touch-action: manipulation; }
.v2menu button:hover, .v2menu button:focus-visible { background: rgba(41,156,203,.1); outline: 0; }

#home.screen.on { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; animation: none; }
#expired.screen.on { display: block; flex: 1; overflow: auto; padding: 16px; }
#home > .jadoff { margin: 8px 12px 0; }
.v2chat { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; margin: 0; padding: 0; border: 0; background: #D0D6DE; box-shadow: none; }
#home.screen.on { background: #D0D6DE; }
html[data-theme="dark"] .v2chat, html[data-theme="dark"] #home.screen.on { background: none; }   /* الوضع الليلي بلا تغيير */
.v2chat .chat, #chatBox { flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 12px 8px; scroll-behavior: auto; -webkit-overflow-scrolling: touch; }
#chatBox .bubble { max-width: 86%; font-size: 16px; }
#chatBox .bubble.sys, #chatBox .bubble.joined { max-width: 94%; }
#cbOffer { flex: 0 0 auto; margin: 6px 12px 0; }
.v2status { flex: 0 0 auto; padding: 0 12px; }
.v2status:not(:has(:not([hidden]):not(:empty))) { display: none; }
.v2status .state { margin: 0 0 4px; min-height: 0; }
.v2status .state:empty { display: none; }

/* الشريط السفلي: ثابت بأسفل المحادثة، فوق الكيبورد (الارتفاع من visualViewport) وبعيد عن الحافة السفلية الآمنة */
.v2bar { flex: 0 0 auto; display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: var(--card, #fff); border-top: 1px solid var(--line, #d9e1e7); }
body.kb .v2bar { padding-bottom: 8px; }
.v2bar .pill { flex: 1 1 auto; min-width: 0; display: flex; align-items: flex-end; background: var(--bg); border: 1.5px solid var(--line, #cfd8de);
  border-radius: 28px; padding-inline: 6px 4px; }
.v2bar .pill:focus-within { border-color: var(--lab-blue); }
.v2bar textarea { flex: 1 1 auto; min-width: 0; min-height: 56px; height: 56px; max-height: 140px; border: 0; outline: 0; background: transparent;
  resize: none; padding: 14px 10px; font: 17px/1.6 inherit; color: inherit; border-radius: 28px; overflow-y: hidden; scrollbar-width: none; box-shadow: none; }
.v2bar textarea::-webkit-scrollbar { display: none; }
.v2bar textarea.tall { overflow-y: auto; }
.v2bar .clip { flex: 0 0 44px; width: 44px; height: 56px; display: grid; place-items: center; background: none; border: 0;
  color: var(--ink-2); cursor: pointer; touch-action: manipulation; }
.v2bar .clip svg { width: 25px; height: 25px; }
.v2bar .icon-btn.round { flex: 0 0 56px; margin: 0; }
.v2bar .icon-btn.rec { background: linear-gradient(150deg, #38aad7, var(--lab-blue)); border-color: var(--lab-blue); color: #fff; }
.v2bar .icon-btn.rec.on { background: linear-gradient(150deg, #e2574c, #c0392b); border-color: #c0392b; animation: ringRed 1.4s infinite; }
.v2bar .icon-btn[hidden] { display: none; }

/* ورقتا المكالمة والوصل/النتيجة */
.v2sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(15,25,35,.5); }
.v2sheet[hidden] { display: none; }
.v2panel { position: relative; width: 100%; max-width: 640px; max-height: calc(var(--vvh, 100dvh) - 24px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border-radius: 20px 20px 0 0; padding: 44px 12px calc(16px + env(safe-area-inset-bottom)); }
@media (min-width: 800px) { .v2sheet { align-items: center; } .v2panel { border-radius: 20px; } }
.v2x { position: absolute; top: 8px; inset-inline-start: 8px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(0,0,0,.07);
  color: inherit; display: grid; place-items: center; cursor: pointer; }
.v2x svg { width: 18px; height: 18px; }
.v2panel > .card { margin: 0; }
@media (prefers-reduced-motion: no-preference) { .v2panel { animation: v2up .22s ease-out; } @keyframes v2up { from { transform: translateY(24px); opacity: 0; } } }
