/* MedyClin — fluxo da consulta: dados → PIX → chat */
body.app { background: var(--violet-50); min-height: 100dvh; }
.app-top { background: #fff; border-bottom: 1px solid var(--line); }
.app-top .container { height: 64px; display: flex; align-items: center; justify-content: space-between; }
.app-top img { height: 30px; width: auto; }
.secure { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--ink-2); }
.secure svg { width: 15px; height: 15px; color: var(--ok); }

.flow { width: min(100% - 32px, 560px); margin: 28px auto 64px; }
.progress { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 22px; }
.progress span { height: 4px; border-radius: 4px; background: var(--violet-200); }
.progress span.on { background: var(--violet-700); }
.progress-labels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: -12px 0 22px; font-size: .78rem; color: var(--ink-3); }
.progress-labels .on { color: var(--violet-800); font-weight: 600; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px; box-shadow: var(--shadow-1); }
.panel h1 { font-size: 1.75rem; letter-spacing: -0.03em; }
.panel .sub { color: var(--ink-2); margin-top: 8px; }
.form { display: grid; gap: 18px; margin-top: 24px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } .panel { padding: 22px 18px; } }

/* Seletor do tipo de consulta */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  display: grid; gap: 2px; padding: 14px 16px; border-radius: var(--r-md);
  border: 1.5px solid var(--line); cursor: pointer; transition: all .15s ease; background: #fff;
}
.seg label b { font-size: 1rem; }
.seg label span { font-size: .88rem; color: var(--ink-2); }
.seg input:checked + label { border-color: var(--violet-600); background: var(--violet-50); box-shadow: var(--ring); }
.seg input:focus-visible + label { box-shadow: var(--ring); }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: .88rem; color: var(--ink-2); }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--violet-700); flex: none; }
.summary { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: var(--r-md); background: var(--paper); border: 1px dashed var(--line); }
.summary b { font-size: 1.25rem; letter-spacing: -0.02em; }
.btn-block { width: 100%; }

/* PIX */
.pix { display: grid; gap: 18px; justify-items: center; text-align: center; margin-top: 22px; }
.qr { width: 236px; height: 236px; border-radius: var(--r-md); border: 1px solid var(--line); padding: 10px; background: #fff; }
.qr img { width: 100%; height: 100%; image-rendering: pixelated; }
.copy { display: flex; width: 100%; gap: 8px; }
.copy input { flex: 1; min-width: 0; font-size: .82rem; color: var(--ink-2); background: var(--paper); }
.wait { display: inline-flex; align-items: center; gap: 10px; color: var(--violet-800); font-weight: 600; }
.timer { font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: .9rem; }
.pix-steps { text-align: left; width: 100%; display: grid; gap: 8px; padding: 0; margin: 0; list-style: none; counter-reset: p; }
.pix-steps li { counter-increment: p; display: flex; gap: 10px; font-size: .92rem; color: var(--ink-2); }
.pix-steps li::before { content: counter(p); width: 22px; height: 22px; flex: none; border-radius: 50%; background: var(--violet-100); color: var(--violet-800); display: grid; place-items: center; font-size: .75rem; font-weight: 700; }

/* Chat */
body.chat-mode .flow { width: min(100% - 0px, 760px); margin: 0 auto; }
.chat { display: grid; grid-template-rows: auto 1fr auto; height: calc(100dvh - 64px); background: #fff; border-inline: 1px solid var(--line); }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: #fff; }
.avatar { width: 44px; height: 44px; border-radius: 14px; flex: none; display: grid; place-items: center; overflow: hidden; background: var(--violet-700); color: #fff; font-weight: 700; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.assistant img { width: 26px; height: 26px; object-fit: contain; filter: brightness(0) invert(1); }
.chat-head .who { flex: 1; min-width: 0; }
.chat-head .who b { display: block; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .who span { font-size: .82rem; color: var(--ink-2); }


.msgs { overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; background:
  radial-gradient(circle at 1px 1px, var(--violet-100) 1px, transparent 0) 0 0/22px 22px, #fff; }
.m { max-width: 82%; padding: 11px 14px; border-radius: 18px; line-height: 1.45; font-size: .97rem; white-space: pre-wrap; word-wrap: break-word; animation: pop .18s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(4px) } }
.m small { display: block; font-size: .74rem; font-weight: 600; margin-bottom: 3px; }
.m time { display: block; font-size: .7rem; margin-top: 4px; opacity: .6; text-align: right; }
.m.patient { align-self: flex-end; background: var(--violet-700); color: #fff; border-bottom-right-radius: 6px; }
.m.assistant { align-self: flex-start; background: var(--violet-50); border: 1px solid var(--violet-100); border-bottom-left-radius: 6px; }
.m.assistant small { color: var(--violet-700); }
.m.doctor { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 6px; box-shadow: var(--shadow-1); }
.m.doctor small { color: var(--ink); }
.m.system { align-self: center; max-width: 92%; text-align: center; background: #e9f7f0; color: #0f6a46; font-size: .86rem; border-radius: 999px; padding: 8px 16px; white-space: normal; }
.m .file { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .9rem; white-space: normal; }
.m .file:hover { border-color: var(--violet-300); }
.m .file i { width: 32px; height: 36px; border-radius: 6px; background: var(--peach); display: grid; place-items: center; font-style: normal; font-size: .62rem; color: var(--danger); font-weight: 700; flex: none; }
.m .file-note { display: block; margin-top: 8px; font-size: .78rem; line-height: 1.4; color: var(--ink-3); }
.typing { align-self: flex-start; display: none; gap: 4px; padding: 14px 16px; border-radius: 18px; background: var(--violet-50); border: 1px solid var(--violet-100); }
.typing.show { display: inline-flex; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--violet-400); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25 } 40% { opacity: 1 } }

.composer { display: flex; gap: 10px; padding: 12px; border-top: 1px solid var(--line); background: #fff; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.composer textarea { flex: 1; min-height: 48px; max-height: 140px; padding: 12px 16px; border-radius: 24px; resize: none; border: 1.5px solid var(--line); line-height: 1.4; }
.composer textarea:focus { outline: none; border-color: var(--violet-500); box-shadow: var(--ring); }
.composer .btn { width: 48px; min-height: 48px; padding: 0; flex: none; }
.composer .btn svg { width: 20px; height: 20px; }
.closed-note { padding: 16px; text-align: center; color: var(--ink-2); font-size: .9rem; border-top: 1px solid var(--line); background: var(--paper); }
@media (min-width: 761px) { .chat { height: calc(100dvh - 64px - 32px); margin-top: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; } }

body.chat-mode .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
