/* Demonstração do Atto: conversa em um celular, com fundo branco.
   A interface pública mantém entrada, reinício, retry e privacidade.
   Todas as regras ficam dentro de .mia-demo. */
.mia-demo {
  --md-ink: #0B1626;
  --md-ink-edge: #2A4162;
  --md-blue: #0057FF;
  --md-blue-text: #0047D6;
  --md-blue-line: #C7DAFF;
  --md-line: #E4E9EE;
  --md-line-strong: #CDD5DE;
  --md-muted: #55636F;
  --md-faint: #6B7885;
  --md-amber-ink: #8F4A10;
  --md-chat-green: #086A55;
  --md-chat-green-hover: #075744;
  --md-chat-sent: #D9FDD3;
  --md-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --md-ease: cubic-bezier(.23, 1, .32, 1);
  --md-phone-w: 396px;
  --md-pad-top: 88px;
  --md-land: calc(var(--header-h, 80px) + 24px);
  position: relative;
  color: var(--md-ink);
  background: #fff;
  border-top: 1px solid var(--md-line);
  padding: var(--md-pad-top) 0 88px;
  scroll-margin-top: calc(var(--md-land) - var(--md-pad-top));
}
.mia-demo:focus { outline: none; }
.mia-demo [hidden] { display: none !important; }
.mia-demo ::selection { background: var(--md-blue-line); color: var(--md-ink); }
.mia-demo-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--md-phone-w);
  grid-template-areas: "head stage";
  align-items: center;
  column-gap: clamp(48px, 7vw, 104px);
  max-width: 1040px;
}
.mia-demo-intro { grid-area: head; min-width: 0; }
.mia-demo-stage { grid-area: stage; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.mia-demo-eyebrow { margin-bottom: 16px; color: var(--md-blue-text); font-size: 12px; font-weight: 600; letter-spacing: .11em; text-transform: uppercase; }
.mia-demo h2 { font-size: clamp(36px, 3.7vw, 52px); line-height: 1.06; font-weight: 700; letter-spacing: -.035em; color: var(--md-ink); text-wrap: balance; }
.mia-demo h2 > span { color: var(--md-blue-text); }
.mia-demo-lead { margin-top: 20px; max-width: 42ch; font-size: 17px; line-height: 1.65; color: var(--md-muted); text-wrap: pretty; }
.mia-demo-next { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 20px; color: var(--md-blue-text); font-size: 15px; font-weight: 600; }
.mia-demo-next svg { flex: none; width: 18px; height: 18px; transition: transform .2s var(--md-ease); }

/* O aparelho preserva a altura enquanto as mensagens rolam por dentro. */
.mia-demo-chat {
  position: relative;
  width: var(--md-phone-w);
  height: clamp(560px, calc(100svh - var(--md-land) - 40px), 700px);
  padding: 10px;
  border-radius: 60px;
  overflow-anchor: none;
  scroll-margin-top: calc(var(--header-h, 80px) + 12px);
  scroll-margin-bottom: 12px;
  background: linear-gradient(150deg, #2A4162 0%, #16273F 18%, #0D1829 55%, #1D3049 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.16), inset 0 0 0 3px #060D18, 0 32px 68px -34px rgba(11,22,38,.38);
}
.mia-demo-chat::before, .mia-demo-chat::after { content: ""; position: absolute; width: 3px; background: #22385A; }
.mia-demo-chat::before { left: -3px; top: 172px; height: 56px; border-radius: 3px 0 0 3px; box-shadow: 0 72px 0 #22385A; }
.mia-demo-chat::after { right: -3px; top: 210px; height: 88px; border-radius: 0 3px 3px 0; }
.mia-demo-screen { position: relative; display: flex; flex-direction: column; height: 100%; border-radius: 50px; overflow: hidden; background: #fff; color: var(--md-ink); }
.mia-demo-island { position: absolute; z-index: 1; left: 50%; top: 9px; width: 96px; height: 26px; border-radius: 20px; background: #050B14; transform: translateX(-50%); }
.mia-demo-phone-status { flex: none; display: flex; align-items: center; justify-content: space-between; height: 44px; padding: 3px 22px 0 28px; background: #fff; color: #182322; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mia-demo-phone-status > div { display: flex; align-items: center; gap: 5px; }
.mia-demo-phone-status svg { width: 15px; height: 13px; }
.mia-demo-phone-status .mia-demo-battery { width: 24px; }
.mia-demo-chat-top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 13px 16px; background: #fff; border-bottom: 1px solid var(--md-line); }
.mia-demo-identity { display: flex; align-items: center; gap: 11px; min-width: 0; }
.mia-demo-avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--md-ink); }
.mia-demo-identity h3 { font-size: 17px; font-weight: 600; line-height: 1.25; letter-spacing: -.01em; color: #173D32; }
.mia-demo-identity p { margin-top: 2px; font-size: 11.5px; line-height: 1.4; color: #52655D; }
.mia-demo-reset { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px; border-radius: 999px; color: var(--md-chat-green); font-size: 12px; font-weight: 500; line-height: 1; transition: background-color .15s ease, transform .16s var(--md-ease); }
.mia-demo-reset svg { width: 16px; height: 16px; }

/* Fundo branco; mensagens simples, sem selos ou quadro externo. */
.mia-demo-chat-body { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; padding: 16px 12px; background: #fff; scrollbar-width: thin; scrollbar-color: var(--md-line-strong) transparent; }
.mia-demo-chat-body.is-measuring { flex: none; height: auto; overflow: visible; }
.mia-demo-day { align-self: center; max-width: 100%; margin: 0 0 18px; color: var(--md-muted); font-size: 11.5px; line-height: 1.5; text-align: center; text-wrap: balance; }
.mia-demo-messages { display: flex; flex-direction: column; gap: 10px; border-radius: 10px; }
.mia-demo-message { min-width: 0; }
.mia-demo-message--assistant { align-self: flex-start; display: grid; grid-template-columns: minmax(0, 1fr); align-items: end; gap: 6px 8px; max-width: 94%; }
.mia-demo-message--assistant > .mia-demo-face { display: none; }
.mia-demo-message--assistant > :not(.mia-demo-face) { grid-column: 1; justify-self: start; }
.mia-demo-message--user { align-self: flex-end; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; max-width: 84%; }
.mia-demo-face { flex: none; width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--md-ink); }
.mia-demo-bubble { position: relative; min-width: 0; padding: 10px 12px 11px; border-radius: 11px; font-size: 15px; line-height: 1.5; }
.mia-demo-bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; text-wrap: pretty; }
.mia-demo-reply > p + p, .mia-demo-reply > ul + p, .mia-demo-reply > ol + p { margin-top: 8px; }
.mia-demo-reply strong { font-weight: 650; }
.mia-demo-reply ul, .mia-demo-reply ol { margin: 8px 0 0; padding-left: 20px; }
.mia-demo-reply > :first-child { margin-top: 0; }
.mia-demo-reply li { padding-left: 2px; overflow-wrap: anywhere; white-space: pre-wrap; }
.mia-demo-reply li + li { margin-top: 5px; }
.mia-demo-message--choices { width: 94%; }
.mia-demo-message--choices .mia-demo-bubble { width: 100%; }
.mia-demo-choices { display: grid; gap: 7px; margin-top: 12px; padding-top: 11px; border-top: 1px solid #D8E2DE; }
.mia-demo-choice { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #6D9384; border-radius: 9px; background: #fff; color: var(--md-chat-green); text-align: left; font: inherit; font-size: 14px; font-weight: 600; line-height: 1.4; transition: background-color .15s ease, border-color .15s ease, transform .16s var(--md-ease); }
.mia-demo-choice > span { min-width: 0; overflow-wrap: anywhere; }
.mia-demo-choice > svg { flex: none; width: 18px; height: 18px; }
.mia-demo .mia-demo-choice:disabled { opacity: 1; border-color: #D5DFDA; background: #F7F9F8; color: #64766C; }
.mia-demo .mia-demo-choice.is-selected { border-color: #6D9384; background: #E8F5ED; color: #075744; }
.mia-demo-message--assistant .mia-demo-bubble { background: #F3F6F8; color: #182922; border-top-left-radius: 3px; }
.mia-demo-message--user .mia-demo-bubble { background: var(--md-chat-sent); color: #182922; border: 1px solid transparent; border-top-right-radius: 3px; }
.mia-demo-message--failed .mia-demo-bubble { border-color: #E2A56A; }
.mia-demo-failed-note { display: inline-flex; align-items: center; gap: 5px; padding-right: 4px; font-size: 12.5px; font-weight: 500; line-height: 1.3; color: var(--md-amber-ink); }
.mia-demo-failed-note svg { flex: none; width: 14px; height: 14px; }
.mia-demo-message.is-new { animation: md-in .34s var(--md-ease) both; }
.mia-demo-message--user.is-new { transform-origin: 100% 100%; animation-name: md-in-user; animation-duration: .26s; }
.mia-demo-suggestions { margin-top: 18px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.mia-demo-suggestions > p { padding-right: 4px; font-size: 12.5px; line-height: 1.4; color: var(--md-muted); }
.mia-demo-suggestions > div { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.mia-demo-suggestions button { min-height: 44px; padding: 8px 14px; border: 1px solid #BDD3C3; border-radius: 999px; background: #fff; color: var(--md-chat-green); font-size: 14px; font-weight: 500; line-height: 1.3; transition: background-color .15s ease, border-color .15s ease, transform .16s var(--md-ease); }
.mia-demo-loading { display: flex; align-items: flex-end; gap: 8px; margin-top: 10px; align-self: flex-start; }
.mia-demo-loading .mia-demo-face { display: none; }
.mia-demo-loading .mia-demo-bubble { display: inline-flex; align-items: center; gap: 10px; padding: 11px 14px; background: #F3F6F8; color: #52655D; border-top-left-radius: 3px; }
.mia-demo-loading small { font-size: 13px; line-height: 1.3; }
.mia-demo-dots { display: inline-flex; gap: 4px; }
.mia-demo-dots i { width: 6px; height: 6px; border-radius: 50%; background: #668C76; animation: md-pulse 1.1s ease-in-out infinite; }
.mia-demo-dots i:nth-child(2) { animation-delay: .15s; }
.mia-demo-dots i:nth-child(3) { animation-delay: .3s; }

/* Erro mantém a pergunta e oferece retry ou edição. */
.mia-demo-error { flex: none; display: grid; grid-template-columns: 18px minmax(0, 1fr); column-gap: 10px; margin: 0 12px 10px; padding: 12px 14px 12px 12px; border-radius: 16px; background: #FFF6EC; box-shadow: inset 0 0 0 1px #F1DCC2; color: #66400F; font-size: 13.5px; line-height: 1.5; }
.mia-demo-error > svg { width: 18px; height: 18px; margin-top: 2px; color: #A65A0E; }
.mia-demo-error > div { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 10px; }
.mia-demo-error button { min-height: 44px; border-radius: 999px; font-size: 13.5px; font-weight: 600; line-height: 1.2; transition: background-color .15s ease, transform .16s var(--md-ease); }
.mia-demo-error [data-demo-retry] { padding: 0 16px; background: var(--md-ink); color: #fff; }
.mia-demo-error [data-demo-edit] { padding: 0 6px; color: var(--md-blue-text); text-decoration: underline; text-underline-offset: .22em; }
.mia-demo-form { flex: none; padding: 10px 12px 6px; background: #fff; border-top: 1px solid var(--md-line); }
.mia-demo-compose { display: flex; align-items: flex-end; gap: 6px; padding: 4px 4px 4px 16px; border: 1px solid var(--md-line-strong); border-radius: 24px; background: #fff; transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease; }
.mia-demo-compose:focus-within { border-color: var(--md-blue); box-shadow: 0 0 0 3px rgba(0,87,255,.16); }
.mia-demo-compose:has(textarea:disabled) { background: #F6F8FA; }
.mia-demo-compose textarea { flex: 1; display: block; width: 100%; min-width: 0; height: 44px; max-height: 128px; padding: 10px 0; border: 0; outline: 0; resize: none; background: transparent; overflow-y: auto; color: var(--md-ink); caret-color: var(--md-blue); font: inherit; font-size: 16px; line-height: 1.45; }
.mia-demo-compose textarea::placeholder { color: var(--md-faint); opacity: 1; }
.mia-demo-send { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--md-chat-green); color: #fff; transition: background-color .15s ease, color .15s ease, transform .16s var(--md-ease); }
.mia-demo-send svg { width: 19px; height: 19px; }
.mia-demo .mia-demo-send:disabled { background: #E6E9EE; color: var(--md-faint); opacity: 1; }
.mia-demo-form-meta { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-top: 8px; padding: 0 6px; }
.mia-demo-privacy { display: flex; gap: 6px; font-size: 12.5px; line-height: 1.5; color: var(--md-muted); text-wrap: pretty; }
.mia-demo-privacy svg { flex: none; width: 13px; height: 13px; margin-top: 3px; }
.mia-demo-privacy a { color: var(--md-blue-text); text-decoration: underline; text-underline-offset: 2px; }
.mia-demo-count { flex: none; padding-top: 1px; font-family: var(--md-mono); font-size: 12px; line-height: 1.5; color: var(--md-muted); font-variant-numeric: tabular-nums; }
.mia-demo-count.is-limit { color: var(--md-amber-ink); }
.mia-demo-noscript { padding: 0 16px 14px; background: #fff; font-size: 13px; color: #6E4210; }
.mia-demo-homebar { flex: none; position: relative; display: block; height: 20px; background: #fff; }
.mia-demo-homebar::after { content: ""; position: absolute; left: 50%; top: 8px; width: 124px; height: 5px; border-radius: 3px; background: var(--md-ink); transform: translateX(-50%); }
.mia-demo button:disabled { opacity: .5; cursor: default; }
.mia-demo-keys { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; font-size: 13px; line-height: 1.6; color: var(--md-muted); }
.mia-demo-keys kbd { padding: 1px 7px; border: 1px solid var(--md-line-strong); border-bottom-width: 2px; border-radius: 6px; background: #F6F8FA; color: var(--md-ink); font-family: inherit; font-size: 12px; font-weight: 500; line-height: 1.5; }
.mia-demo-keys > span { color: var(--md-faint); }
.mia-demo-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.mia-demo button:focus-visible, .mia-demo a:focus-visible { outline: 3px solid var(--md-blue); outline-offset: 2px; }
.mia-demo-next:focus-visible { border-radius: 6px; }
.mia-demo-messages:focus-visible { outline: 2px solid var(--md-blue); outline-offset: 4px; }
.mia-demo-messages[data-quiet-focus]:focus-visible { outline: none; }
.mia-demo-reset:active, .mia-demo-suggestions button:active:not(:disabled), .mia-demo-choice:active:not(:disabled), .mia-demo-error button:active { transform: scale(.97); }
.mia-demo-send:active:not(:disabled) { transform: scale(.92); }
@media (hover: hover) and (pointer: fine) {
  .mia-demo-reset:hover { background: #E2EEE5; }
  .mia-demo-suggestions button:hover:not(:disabled) { background: #EAF7E9; border-color: #84B397; }
  .mia-demo-choice:hover:not(:disabled) { background: #E8F5ED; border-color: var(--md-chat-green); }
  .mia-demo-send:hover:not(:disabled) { background: var(--md-chat-green-hover); }
  .mia-demo-error [data-demo-retry]:hover { background: var(--md-ink-edge); }
  .mia-demo-next:hover { text-decoration: underline; text-underline-offset: 5px; }
  .mia-demo-next:hover svg { transform: translateX(3px); }
}
@media (hover: none), (pointer: coarse) { .mia-demo-keys { display: none; } }
@media (pointer: coarse), (max-width: 640px) {
  .mia-demo-form-meta { margin-top: 13px; }
  .mia-demo-privacy a { display: inline-block; padding-block: 13px; margin-block: -13px; }
}
.mia-demo-chat.is-asleep .mia-demo-day,
.mia-demo-chat.is-asleep [data-demo-messages] > *,
.mia-demo-chat.is-asleep .mia-demo-suggestions > p,
.mia-demo-chat.is-asleep .mia-demo-suggestions button { opacity: 0; }
.mia-demo-chat.is-waking .mia-demo-day { animation: md-rise .42s var(--md-ease) .08s both; }
.mia-demo-chat.is-waking [data-demo-messages] > * { animation: md-in .42s var(--md-ease) .14s both; }
.mia-demo-chat.is-waking .mia-demo-suggestions > p { animation: md-rise .36s var(--md-ease) .24s both; }
.mia-demo-chat.is-waking .mia-demo-suggestions button { animation: md-rise .36s var(--md-ease) .3s both; }
.mia-demo-chat.is-waking .mia-demo-suggestions button:nth-child(2) { animation-delay: .35s; }
.mia-demo-chat.is-waking .mia-demo-suggestions button:nth-child(3) { animation-delay: .4s; }
@keyframes md-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes md-in-user { from { opacity: 0; transform: translateY(6px) scale(.96); } }
@keyframes md-rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes md-pulse { 0%,70%,100% { opacity: .35; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }
@media (max-width: 1100px) { .mia-demo { --md-phone-w: 388px; } .mia-demo-layout { column-gap: 48px; } }
@media (max-width: 1279px) { body.demo-chat-in-view #amsup-raiz .amsup-bolha[aria-expanded="false"] { visibility: hidden; pointer-events: none; } }
@media (max-width: 900px) {
  .mia-demo { --md-pad-top: 72px; padding-bottom: 72px; scroll-margin-top: var(--header-h,80px); }
  .mia-demo-layout { grid-template-columns: minmax(0,1fr); grid-template-areas: "head" "stage"; justify-items: center; }
  .mia-demo-intro { width: 100%; max-width: 560px; }
  .mia-demo-stage { margin-top: 36px; }
}
@media (max-width: 640px) {
  .mia-demo { --md-pad-top: 60px; padding-bottom: 48px; scroll-margin-top: 72px; }
  .mia-demo h2 { font-size: 36px; }
  .mia-demo-lead { margin-top: 16px; font-size: 16px; }
  .mia-demo-intro { max-width: none; }
  .mia-demo-stage { width: 100%; margin-top: 28px; gap: 14px; }
  .mia-demo-chat { width: min(100%,368px); min-height: 560px; height: var(--md-fit,clamp(560px,calc(100svh - 120px),680px)); padding: 8px; border-radius: 46px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), inset 0 0 0 3px #060D18, 0 24px 48px -28px rgba(11,22,38,.36); }
  .mia-demo-keys { display: none; }
  .mia-demo-chat::before { top: 142px; height: 42px; box-shadow: 0 57px 0 #22385A; }
  .mia-demo-chat::after { top: 171px; height: 62px; }
  .mia-demo-screen { border-radius: 38px; }
  .mia-demo-chat-top { padding: 9px 8px 12px 12px; }
  .mia-demo-identity { gap: 8px; }
  .mia-demo-avatar { width: 36px; height: 36px; }
  .mia-demo-reset { gap: 4px; padding: 8px 6px; }
  .mia-demo-bubble { font-size: 15.5px; }
  .mia-demo-form { padding: 10px 10px 12px; }
  .mia-demo-error { margin: 0 10px 10px; }
}
@media (max-width: 360px) {
  .mia-demo .container { padding-left: 16px; padding-right: 16px; }
  .mia-demo h2 { font-size: 32px; }
  .mia-demo-island { width: 80px; }
  .mia-demo-reset > span { display: none; }
  .mia-demo-reset { width: 44px; justify-content: center; padding: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .mia-demo-message.is-new, .mia-demo-chat.is-waking * { animation: none; }
  .mia-demo-dots i { animation: none; opacity: .8; }
  .mia-demo-suggestions button, .mia-demo-choice, .mia-demo-compose, .mia-demo-send, .mia-demo-reset, .mia-demo-error button, .mia-demo-next svg { transition: none; }
  .mia-demo-reset:active, .mia-demo-suggestions button:active, .mia-demo-choice:active, .mia-demo-error button:active, .mia-demo-send:active { transform: none; }
}

/* Atto: fundo azul circular apenas nos avatares do assistente. */
img[src*="atto-avatar-cartoon-256-55d88cd8e193.webp"] {
  background: #0057ff;
  border-radius: 50%;
  object-fit: cover;
}
