/* Diagnóstico BMO em formato de chat — mobile primeiro. */
:root {
  --ch-bg: #eef1f6;
  --ch-surface: #ffffff;
  --ch-text: #1e2838;
  --ch-muted: #5a6c7d;
  --ch-line: #dce3ec;
  --ch-accent: #2563eb;
  --ch-accent-strong: #1d4ed8;
  --ch-user: #2563eb;
  --ch-user-text: #ffffff;
  --ch-bot: #ffffff;
  --ch-online: #16a34a;
  --ch-wrong: #fde8e8;
  --ch-wrong-text: #8a1c1c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ch-bg: #0e1520;
    --ch-surface: #162031;
    --ch-text: #eef2f8;
    --ch-muted: #9fb0c6;
    --ch-line: #273449;
    --ch-accent: #5b8ff9;
    --ch-accent-strong: #3f78ee;
    --ch-user: #2f62d8;
    --ch-user-text: #ffffff;
    --ch-bot: #1c2840;
    --ch-online: #4ade80;
    --ch-wrong: #3b1d22;
    --ch-wrong-text: #fca5a5;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ch-bg);
  color: var(--ch-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

.ch-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 640px;
  margin: 0 auto;
  background: var(--ch-bg);
}
@media (min-width: 700px) {
  body { background: #e2e7ef; }
  .ch-app { box-shadow: 0 0 0 1px var(--ch-line), 0 10px 40px rgba(15, 30, 60, .08); }
}
@media (min-width: 700px) and (prefers-color-scheme: dark) {
  body { background: #090e16; }
}

/* ---------- topo */
.ch-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--ch-surface);
  border-bottom: 1px solid var(--ch-line);
  flex: none;
}
.ch-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ch-accent);
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  position: relative;
  flex: none;
}
.ch-avatar::after {
  content: '';
  position: absolute; right: 0; bottom: 0;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--ch-online);
  border: 2px solid var(--ch-surface);
}
.ch-who { display: flex; flex-direction: column; min-width: 0; }
.ch-who strong { font-size: 16px; }
.ch-steps {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  max-width: 420px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  min-width: 0;
}
.ch-steps li {
  flex: none;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--ch-muted);
  opacity: .7;
  transition: background .25s ease, border-color .25s ease, opacity .25s ease;
}
.ch-steps li + li { margin-left: 0; }
.ch-steps .ch-step-line {
  flex: 1 1 auto;
  width: auto; height: 1.5px;
  min-width: 2px;
  border: 0; border-radius: 0;
  background: var(--ch-muted);
  opacity: .45;
}
.ch-steps li.is-done { background: var(--ch-muted); border-color: var(--ch-muted); opacity: 1; }
.ch-steps li.is-current {
  width: 12px; height: 12px;
  background: var(--ch-text, currentColor);
  border-color: var(--ch-text, currentColor);
  opacity: 1;
}
.ch-steps .ch-step-line.is-done { opacity: .9; }
@media (max-width: 380px) { .ch-steps li { width: 7px; height: 7px; } }
.ch-count {
  margin-left: auto;
  font-size: 13px;
  color: var(--ch-muted);
  white-space: nowrap;
}
.ch-count b { font-size: 22px; font-weight: 700; color: var(--ch-text, inherit); margin-right: 4px; }
.ch-intro { max-width: 92%; line-height: 1.5; }

/* ---------- mensagens */
.ch-log {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
}
.ch-msg {
  max-width: 84%;
  padding: 9px 13px;
  border-radius: 18px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: ch-in .22s ease-out;
}
.ch-bot {
  align-self: flex-start;
  background: var(--ch-bot);
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 1px rgba(15, 30, 60, .06);
}
.ch-user {
  align-self: flex-end;
  background: var(--ch-user);
  color: var(--ch-user-text);
  border-bottom-right-radius: 6px;
  margin-top: 6px;
}
.ch-bot + .ch-user, .ch-user + .ch-bot, .ch-edit + .ch-bot { margin-top: 10px; }
.ch-user.is-wrong {
  background: var(--ch-wrong);
  color: var(--ch-wrong-text);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.ch-edit {
  align-self: flex-end;
  background: none;
  border: 0;
  padding: 2px 4px;
  font: inherit;
  font-size: 13px;
  color: var(--ch-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.ch-edit:hover { color: var(--ch-accent); }

.ch-typing {
  display: inline-flex;
  gap: 4px;
  padding: 13px 14px;
}
.ch-typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ch-muted);
  opacity: .5;
  animation: ch-dot 1.1s infinite ease-in-out;
}
.ch-typing span:nth-child(2) { animation-delay: .15s; }
.ch-typing span:nth-child(3) { animation-delay: .3s; }

.ch-action { padding: 0; background: none; box-shadow: none; }
.ch-link-btn {
  display: inline-block;
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--ch-accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}
.ch-link-btn:hover { background: var(--ch-accent-strong); }

.ch-agenda {
  max-width: 100%;
  width: 100%;
  padding: 0;
  overflow: hidden;
}
.ch-agenda iframe {
  display: block;
  width: 100%;
  height: 680px;
  border: 0;
}

/* ---------- área de resposta */
.ch-composer {
  flex: none;
  padding: 10px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: var(--ch-surface);
  border-top: 1px solid var(--ch-line);
  min-height: 64px;
}
.ch-composer:empty { min-height: 0; padding: 0; border-top: 0; }
.ch-composer.is-ended {
  text-align: center;
  color: var(--ch-muted);
  font-size: 14px;
  min-height: 0;
}
.ch-choices {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  max-height: 52vh;
  overflow-y: auto;
}
.ch-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border: 1px solid var(--ch-line);
  border-radius: 14px;
  background: var(--ch-surface);
  color: var(--ch-text);
  font: inherit;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  animation: ch-fade .2s ease-out both;
}
.ch-choice:hover { border-color: var(--ch-accent); }
.ch-choice:active { background: var(--ch-bg); }
.ch-choice:focus-visible, .ch-send:focus-visible, .ch-edit:focus-visible, .ch-link-btn:focus-visible {
  outline: 2px solid var(--ch-accent);
  outline-offset: 2px;
}
.ch-choice.is-single {
  justify-content: center;
  background: var(--ch-accent);
  border-color: var(--ch-accent);
  color: #fff;
  font-weight: 600;
}
.ch-choice.is-single:hover { background: var(--ch-accent-strong); }
.ch-key {
  flex: none;
  width: 24px; height: 24px;
  border-radius: 6px;
  border: 1px solid var(--ch-line);
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--ch-muted);
}
@media (hover: none) { .ch-key { display: none; } }

.ch-input-row { display: flex; align-items: flex-end; gap: 8px; }
.ch-input {
  flex: 1;
  min-width: 0;
  padding: 11px 16px;
  border: 1px solid var(--ch-line);
  border-radius: 22px;
  background: var(--ch-bg);
  color: var(--ch-text);
  font: inherit;
  font-size: 16px; /* evita zoom no iOS */
  resize: none;
  line-height: 1.4;
}
.ch-input:focus { outline: none; border-color: var(--ch-accent); }
.ch-send {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--ch-accent);
  color: #fff;
  display: grid; place-items: center;
  cursor: pointer;
}
.ch-send:hover { background: var(--ch-accent-strong); }

.ch-noscript { padding: 16px; }

@keyframes ch-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes ch-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ch-dot { 0%, 60%, 100% { transform: none; opacity: .4; } 30% { transform: translateY(-4px); opacity: .9; } }
@media (prefers-reduced-motion: reduce) {
  .ch-msg, .ch-choice { animation: none; }
  .ch-typing span { animation: none; }
  .ch-log { scroll-behavior: auto; }
}
