/* Vasudev Hospital – help-desk chatbot */
.chat-launch { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 60; display: inline-flex; align-items: center; gap: .55rem; min-height: 58px; padding: 0 1.2rem 0 1rem; border: 0; border-radius: 999px; background: var(--navy); color: var(--surface); font-weight: 600; font-size: 1rem; cursor: pointer; box-shadow: 0 10px 30px rgba(14, 23, 88, .35); transition: transform .18s ease; }
.chat-launch:hover { transform: translateY(-2px); }
.chat-launch svg { width: 24px; height: 24px; }
.chat-launch .dot { width: 10px; height: 10px; border-radius: 50%; background: #4fe39b; box-shadow: 0 0 0 3px color-mix(in srgb, var(--navy) 70%, transparent); }
@media (max-width: 520px) { .chat-launch span.lbl { display: none; } .chat-launch { padding: 0; width: 58px; justify-content: center; } .chat-launch .dot { position: absolute; top: 10px; right: 10px; } }
.chat-nudge { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(86px + env(safe-area-inset-bottom, 0px)); z-index: 60; max-width: 260px; padding: .75rem 2.2rem .75rem 1rem; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 14px 14px 4px 14px; box-shadow: var(--shadow); font-size: .95rem; cursor: pointer; animation: nudge .4s ease both; }
.chat-nudge button { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; }
@keyframes nudge { from { opacity: 0; transform: translateY(8px); } }

.chat { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 70; width: min(400px, calc(100vw - 32px)); height: min(640px, calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))); display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: 0 24px 60px rgba(10, 16, 60, .3); animation: chatin .22s ease both; }
@keyframes chatin { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@media (max-width: 520px) { .chat { right: 0; left: 0; bottom: 0; width: 100%; height: calc(100dvh - env(safe-area-inset-top, 0px)); border-radius: 18px 18px 0 0; } }
.chat-head { display: flex; align-items: center; gap: .7rem; padding: .8rem .9rem; background: var(--navy-deep); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chat-head { background: #050a1f; } }
:root[data-theme="dark"] .chat-head { background: #050a1f; }
.chat-head img { width: 40px; height: 40px; border-radius: 50%; background: #fff; }
.chat-head b { display: block; line-height: 1.15; }
.chat-head small { display: flex; align-items: center; gap: .35rem; opacity: .85; font-size: .82rem; }
.chat-head small::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #4fe39b; }
.chat-head .x { margin-left: auto; width: 40px; height: 40px; border: 0; border-radius: 10px; background: rgba(255,255,255,.1); color: #fff; cursor: pointer; display: grid; place-items: center; }
.chat-head .x svg { width: 20px; height: 20px; }
.chat-log { overflow-y: auto; padding: 1rem .9rem; display: flex; flex-direction: column; gap: .6rem; overscroll-behavior: contain; }
.msg-b, .msg-u { max-width: 88%; padding: .6rem .85rem; border-radius: 16px; font-size: .97rem; line-height: 1.45; overflow-wrap: anywhere; }
.msg-b { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg-u { align-self: flex-end; background: var(--navy); color: var(--surface); border-bottom-right-radius: 5px; }
.msg-b.em { background: var(--red-soft); border-color: transparent; color: var(--ink); }
.msg-b.em b { color: var(--red); }
.msg-b p + p, .msg-b p + ul, .msg-b ul + p { margin-top: .4rem; }
.msg-b ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.msg-b a { color: var(--navy); font-weight: 600; }
.msg-b .mini { display: grid; gap: .15rem; margin-top: .5rem; padding: .55rem .65rem; border-radius: 10px; background: var(--tint); font-size: .9rem; }
.msg-b .mini span { display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.msg-b .mini em { font-style: normal; color: var(--muted); }
.msg-b .mini code { font-family: var(--font-mono); font-size: .82rem; }
.msg-b .dc { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: .65rem; align-items: center; margin-top: .45rem; }
.msg-b .dc img, .msg-b .dc .av { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; object-position: center 15%; background: var(--tint); }
.msg-b .dc .av { display: grid; place-items: center; font-weight: 700; color: var(--navy); font-family: var(--font-display); }
.msg-b .dc small { display: block; color: var(--muted); line-height: 1.3; }
.msg-b .acts { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.msg-b .acts a, .msg-b .acts button { display: inline-flex; align-items: center; min-height: 34px; padding: .2rem .75rem; border-radius: 999px; border: 1.5px solid var(--navy); background: transparent; color: var(--navy); font-weight: 600; font-size: .88rem; text-decoration: none; cursor: pointer; }
.msg-b .acts .pri { background: var(--navy); color: var(--surface); }
.typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: .7rem .9rem; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 50% { opacity: .25; transform: translateY(-2px); } }
.chat-quick { display: flex; gap: .4rem; overflow-x: auto; padding: .5rem .9rem; border-top: 1px solid var(--line); background: var(--paper); scrollbar-width: thin; }
.chat-quick button { flex: none; min-height: 36px; padding: .25rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: .9rem; cursor: pointer; white-space: nowrap; }
.chat-quick button:hover { border-color: var(--navy); color: var(--navy); }
.chat-form { display: flex; gap: .5rem; padding: .6rem .7rem calc(.6rem + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; min-height: 46px; padding: .5rem .9rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--paper); font-size: 1rem; }
.chat-form input:focus { outline: none; border-color: var(--navy); }
.chat-form button { width: 46px; height: 46px; flex: none; border: 0; border-radius: 50%; background: var(--navy); color: var(--surface); cursor: pointer; display: grid; place-items: center; }
.chat-form button svg { width: 20px; height: 20px; }
