/* MedyClin — widget de suporte (botão + conversa com a equipe) */
.sup-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  display: inline-flex; align-items: center; gap: 9px;
  height: 52px; padding: 0 20px 0 16px; border: 0; border-radius: 999px;
  background: var(--violet-900, #4c1d95); color: #fff; font: inherit; font-weight: 650; font-size: .95rem; letter-spacing: -.01em;
  box-shadow: 0 14px 30px -12px rgb(76 29 149 / .55), 0 2px 6px rgb(30 27 46 / .12);
  cursor: pointer; transition: transform .18s ease, background .18s ease, bottom .25s ease, opacity .2s ease;
}
.sup-fab:hover { background: var(--violet-800, #5b21b6); transform: translateY(-2px); }
.sup-fab:focus-visible { outline: 3px solid var(--violet-300, #c4b5fd); outline-offset: 3px; }
.sup-fab svg { width: 22px; height: 22px; flex: none; }
.sup-fab .sup-dot {
  position: absolute; top: -3px; right: -3px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: #f97316; color: #fff; font-size: .74rem; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; font-style: normal;
}
.sup-fab .sup-dot[hidden] { display: none; }
html.sup-open .sup-fab { opacity: 0; pointer-events: none; }

.sup-panel {
  position: fixed; right: 18px; bottom: 18px; z-index: 70;
  width: 384px; height: min(620px, calc(100dvh - 36px));
  display: grid; grid-template-rows: auto 1fr auto; overflow: hidden;
  background: var(--paper, #fbfaf7); border: 1px solid var(--line, #e7e3f0); border-radius: 22px;
  box-shadow: 0 30px 60px -24px rgb(46 16 101 / .45), 0 4px 14px rgb(30 27 46 / .08);
  transform-origin: bottom right; animation: sup-in .2s ease;
}
.sup-panel[hidden] { display: none; }
.sup-panel [hidden] { display: none !important; } /* blocos internos com display próprio */
@keyframes sup-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

.sup-head {
  display: flex; align-items: center; gap: 12px; padding: 16px 16px 16px 18px;
  background: var(--violet-900, #4c1d95); color: #fff;
  background-image: radial-gradient(120% 140% at 100% 0%, rgb(139 92 246 / .55) 0%, transparent 55%);
}
.sup-avatar { width: 42px; height: 42px; border-radius: 14px; background: #fff; display: grid; place-items: center; flex: none; }
.sup-avatar img { width: 26px; height: 26px; }
.sup-head h2 { font-size: 1.02rem; line-height: 1.2; margin: 0; color: #fff; letter-spacing: -.01em; }
.sup-head p { margin: 2px 0 0; font-size: .8rem; color: rgb(255 255 255 / .78); display: flex; align-items: center; gap: 6px; }
.sup-head p::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgb(74 222 128 / .25); }
.sup-x { margin-left: auto; width: 38px; height: 38px; border-radius: 12px; border: 0; background: rgb(255 255 255 / .12); color: #fff; cursor: pointer; display: grid; place-items: center; }
.sup-x:hover { background: rgb(255 255 255 / .22); }
.sup-x svg { width: 18px; height: 18px; }

.sup-body { overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.sup-start { padding: 18px; display: grid; gap: 12px; }
.sup-intro { margin: 0; font-size: .95rem; color: var(--ink-2, #4a4560); line-height: 1.5; }
.sup-intro b { color: var(--ink, #1e1b2e); }
.sup-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.sup-chip {
  border: 1.5px solid var(--violet-200, #d9cffe); background: #fff; color: var(--violet-800, #5b21b6);
  border-radius: 999px; padding: 7px 12px; font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer;
}
.sup-chip:hover, .sup-chip[aria-pressed="true"] { background: var(--violet-50, #f6f3ff); border-color: var(--violet-400, #a78bfa); }
.sup-field { display: grid; gap: 5px; }
.sup-field label { font-size: .84rem; font-weight: 600; color: var(--ink, #1e1b2e); }
.sup-field input, .sup-field textarea {
  width: 100%; font: inherit; font-size: .95rem; padding: 11px 13px; border-radius: 12px;
  border: 1.5px solid var(--line, #e7e3f0); background: #fff; color: var(--ink, #1e1b2e);
}
.sup-field textarea { min-height: 92px; resize: vertical; }
.sup-field input:focus, .sup-field textarea:focus { outline: none; border-color: var(--violet-500, #8b5cf6); box-shadow: 0 0 0 4px rgb(139 92 246 / .16); }
.sup-linked { margin: 0; font-size: .84rem; padding: 10px 12px; border-radius: 12px; background: var(--violet-50, #f6f3ff); color: var(--violet-900, #4c1d95); }
.sup-err { margin: 0; min-height: 0; font-size: .84rem; color: var(--danger, #c2410c); }
.sup-err:empty { display: none; }
.sup-send { width: 100%; }
.sup-fine { margin: 0; font-size: .76rem; color: var(--ink-3, #7a7590); line-height: 1.45; }
.sup-fine a { color: inherit; text-decoration: underline; }

.sup-thread { padding: 16px 14px 10px; display: flex; flex-direction: column; gap: 9px; }
.sup-day { align-self: center; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3, #7a7590); margin: 4px 0; }
.sup-m { max-width: 84%; padding: 10px 13px; border-radius: 16px; font-size: .93rem; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.sup-m small { display: block; font-size: .72rem; font-weight: 700; margin-bottom: 2px; }
.sup-m time { display: block; font-size: .68rem; opacity: .62; text-align: right; margin-top: 3px; }
.sup-m.user { align-self: flex-end; background: var(--violet-700, #6d28d9); color: #fff; border-bottom-right-radius: 6px; }
.sup-m.staff { align-self: flex-start; background: #fff; border: 1px solid var(--line, #e7e3f0); border-bottom-left-radius: 6px; box-shadow: 0 1px 2px rgb(30 27 46 / .05); }
.sup-m.staff small { color: var(--violet-800, #5b21b6); }
.sup-m.system { align-self: center; max-width: 94%; text-align: center; background: var(--violet-50, #f6f3ff); color: var(--violet-900, #4c1d95); font-size: .82rem; border-radius: 14px; }
.sup-m.pending { opacity: .6; }

.sup-composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px 12px; border-top: 1px solid var(--line, #e7e3f0); background: #fff; }
.sup-composer[hidden] { display: none; }
.sup-composer textarea {
  flex: 1; min-height: 44px; max-height: 120px; resize: none; font: inherit; font-size: .95rem;
  padding: 10px 13px; border-radius: 14px; border: 1.5px solid var(--line, #e7e3f0);
}
.sup-composer textarea:focus { outline: none; border-color: var(--violet-500, #8b5cf6); box-shadow: 0 0 0 4px rgb(139 92 246 / .16); }
.sup-composer button { width: 44px; height: 44px; flex: none; border-radius: 14px; border: 0; background: var(--violet-700, #6d28d9); color: #fff; cursor: pointer; display: grid; place-items: center; }
.sup-composer button:hover { background: var(--violet-800, #5b21b6); }
.sup-composer button:disabled { opacity: .5; cursor: default; }
.sup-composer button svg { width: 20px; height: 20px; }

/* Botão de suporte no cabeçalho da consulta */
.sup-top {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--violet-200, #d9cffe); background: #fff; color: var(--violet-800, #5b21b6);
  font: inherit; font-size: .88rem; font-weight: 650; cursor: pointer;
}
.sup-top:hover { background: var(--violet-50, #f6f3ff); }
.sup-top svg { width: 17px; height: 17px; }
.sup-top .sup-dot { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #f97316; color: #fff; font-size: .7rem; font-weight: 700; display: grid; place-items: center; font-style: normal; }
.sup-top .sup-dot[hidden] { display: none; }

@media (max-width: 560px) {
  .sup-fab { right: 14px; height: 50px; padding: 0 16px 0 14px; }
  .sup-panel { inset: 0; width: auto; height: 100dvh; border-radius: 0; border: 0; animation: sup-up .22s ease; }
  @keyframes sup-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
  .sup-head { padding-top: max(16px, env(safe-area-inset-top)); }
  .sup-composer { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  html.sup-open, html.sup-open body { overflow: hidden; }
  .sup-top span.lbl { display: none; }
  .sup-top { width: 38px; padding: 0; justify-content: center; position: relative; }
  .sup-top .sup-dot { position: absolute; top: -4px; right: -4px; }
}
@media (prefers-reduced-motion: reduce) { .sup-panel, .sup-fab { animation: none; transition: none; } }
.app-top .top-right { display: flex; align-items: center; gap: 12px; }
@media (max-width: 400px) { .app-top .top-right .secure { font-size: .78rem; } }
