/* Hallmark · component: the Capifone helper and the conversation window · genre: editorial · design-system: design.md (v5)
 * states: default · hover · focus · active · disabled · loading (waiting) · error · success (protocol)
 * contrast: pass (ink on crema 15.8:1, muted 6.2:1, paper on ink 15.8:1)
 * The helper is one fixed button (capifone.js writes its position every frame): the art, the eyes drawn by the page,
 * breathing, blinking, sleeping, a hop on hover. The window is a real <dialog> (conversa.js) built to
 * .coordination/estudio-v5/contrato-conversa.md. Requires tokens.css and shell.css. */

/* ---------- The helper ---------- */
.capi {
  position: fixed;
  left: 0;
  top: 0;
  z-index: var(--z-helper);
  width: var(--capi-size, 92px);
  height: var(--capi-size, 92px);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-ink);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
}
/* A focus ring that shows on the night and on the crema alike: a crema ring inside the accent outline */
.capi:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 5px; box-shadow: 0 0 0 5px var(--color-paper); }
.capi-tilt, .capi-hop, .capi-breath, .capi-fig, .capi-pic { position: absolute; inset: 0; display: block; }
.capi-tilt { transform-origin: 50% 62%; }
.capi-hop { transform-origin: 50% 96%; transition: transform 450ms cubic-bezier(0.34, 1.8, 0.64, 1); }
.capi-breath { transform-origin: 50% 92%; }
/* The bust is cut straight at the bottom: its lower edge fades out, so the cut never shows when it tilts, sways or hops.
   The masked box is 12 % larger on every side than the picture (.capi-pic sits inside it at the bust's own size), so
   the picture's soft shadow is never cut into a square at the box's edge. The fade runs over the bust's lowest quarter. */
.capi-fig {
  inset: -12%;
  -webkit-mask-image: linear-gradient(to bottom, var(--color-ink) 69%, transparent 88.7%);
  mask-image: linear-gradient(to bottom, var(--color-ink) 69%, transparent 88.7%);
}
.capi-pic { inset: 9.677%; }
.capi-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: var(--shadow-helper); user-select: none; -webkit-user-drag: none; }
.capi:active .capi-hop { transform: scale(1.1, 0.86); transition: transform 120ms var(--ease-out); }

/* Two pictures of the same bust, pixel-aligned: with its painted eyes (shown without JavaScript, while loading, with
   reduced motion and on any error) and without eyes, under the eyes the page draws. The eyeless one is never shown
   alone: one class (is-vivo, set by capifone.js once both pictures are decoded) swaps the two and shows the eyes in
   the same frame. */
.capi-art--vivo, .capi-eyes { visibility: hidden; }
.capi.is-vivo .capi-art--vivo, .capi.is-vivo .capi-eyes { visibility: visible; }
.capi.is-vivo .capi-art--olhos { visibility: hidden; }

/* The living figure (capifone.js, capifone3d/): the same bust in three dimensions. Its canvas sits exactly over the
   picture's square and reaches beyond it (34 % on the left, 16 % on the right, 14 % above: CUT in capifone.js; docked, the
   16 % stay inside the screen), because the raised paw
   does; the figure breathes by itself, and draws its own fade at the bottom, where the picture has its mask. */
.capi-lona {
  position: absolute;
  left: -34%;
  top: -14%;
  width: 150%;
  height: 114%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 260ms linear;
}
.capi.is-3d { touch-action: pan-y; border-radius: 34%; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.capi.is-3d .capi-tilt { pointer-events: none; }
.capi.is-3d .capi-lona { opacity: 1; }
.capi.is-3d .capi-fig { opacity: 0; transition: opacity 200ms linear 120ms; }
/* A soft shadow on the crema, with a mouse only: on phones a filter over a picture that changes every frame costs too much */
@media (hover: hover) and (pointer: fine) { .capi.is-3d.is-docked .capi-lona { filter: var(--shadow-helper); } }
.capi:not(.is-docked) .capi-z { color: var(--color-on-night); }
.capi.is-3d .capi-breath { animation: none; }

/* The eyes: plum ovals with one white highlight, placed, sized and tilted from the art's data (capifone/olhos.json:
   --x, --y centre, --w, --h oval, --rot tilt, --hx, --hy, --hw, --hh highlight, --eye colour; fractions of the bust).
   The pair slides together (capifone.js); each eye blinks, smiles and closes around its own centre. */
.capi-eyes { position: absolute; inset: 0; pointer-events: none; }
.capi-eye, .capi-lid { position: absolute; inset: 0; transform-origin: calc(var(--x) * 100%) calc(var(--y) * 100%); }
.capi-eye { transform: scale(var(--eye-sx, 1), var(--eye-sy, 1)); transition: transform 260ms var(--ease-out); }
.capi-lid { transform: translateY(calc(var(--lid-y, 0) * var(--capi-size, 92px))) scaleY(var(--lid, 1)); transition: transform 140ms var(--ease-out), opacity 100ms linear; }
.capi-iris, .capi-shine, .capi-arc { position: absolute; display: block; border-radius: 50%; }
.capi-iris {
  left: calc(var(--x) * 100%);
  top: calc(var(--y) * 100%);
  width: calc(var(--w) * 100%);
  height: calc(var(--h) * 100%);
  background: var(--eye, var(--color-eye));
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg));
}
.capi-shine {
  left: calc(var(--hx) * 100%);
  top: calc(var(--hy) * 100%);
  width: calc(var(--hw) * 100%);
  height: calc(var(--hh) * 100%);
  background: var(--color-eye-shine);
  transform: translate(-50%, -50%);
}
.capi-arc {
  left: calc(var(--x) * 100%);
  top: calc(var(--y) * 100%);
  width: calc(var(--w) * 240%);
  height: calc(var(--h) * 60%);
  border-top: max(1.5px, calc(var(--capi-size, 92px) * 0.017)) solid var(--eye, var(--color-eye));
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  opacity: 0;
  transform: translate(-50%, -30%) scale(0.6);
  transition: opacity 100ms linear, transform 200ms var(--ease-out);
}
.capi.is-blink .capi-lid { animation: capi-blink 210ms linear; }
@keyframes capi-blink { 33% { transform: translateY(calc(var(--lid-y, 0) * var(--capi-size, 92px))) scaleY(0.08); } }
.capi.is-happy .capi-lid { opacity: 0; transform: scaleY(0); }
.capi.is-happy .capi-arc { opacity: 1; transform: translate(-50%, -30%); transition: opacity 120ms linear 70ms, transform 260ms cubic-bezier(0.34, 1.56, 0.64, 1) 70ms; }
.capi.is-asleep { --lid: 0.18; --lid-y: 0.012; }
.capi-z {
  position: absolute;
  right: 2%;
  top: 4%;
  color: var(--color-accent);
  font-size: max(11px, calc(var(--capi-size, 92px) * 0.16));
  font-weight: var(--wght-display);
  font-stretch: var(--wdth-display);
  line-height: 1;
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .capi:not(.is-3d) .capi-breath { animation: capi-breathe 1300ms ease-in-out infinite alternate; }
  .capi.is-asleep .capi-breath { animation-duration: 2600ms; }
  .capi.is-hop .capi-hop { animation: capi-hop 1100ms var(--ease-out); }
  .capi.is-nod .capi-hop { animation: capi-nod 320ms var(--ease-out); }
  .capi.is-asleep .capi-z { animation: capi-z 2400ms var(--ease-out) infinite; }
  .capi.is-asleep .capi-z + .capi-z { animation-delay: 1200ms; }
}
@keyframes capi-breathe { to { transform: translateY(-1.2%) scale(0.992, 1.016); } }
@keyframes capi-hop {
  8% { transform: scale(1.06, 0.93); }
  27% { transform: translateY(-18%) scale(0.97, 1.04); }
  50% { transform: scale(1.08, 0.91); }
  70% { transform: scale(0.98, 1.02); }
}
@keyframes capi-nod { 45% { transform: translateY(3%) scale(1.02, 0.98); } }
@keyframes capi-z {
  0% { opacity: 0; transform: translate(0, 0) scale(0.7); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(40%, -120%) scale(1.15); }
}

/* The line it says when a section reaches the middle of the screen, and the tip on hover when docked */
.capi-bubble, .capi-tip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: var(--z-helper);
  margin: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 300ms var(--ease-out), translate 450ms var(--ease-out), scale 450ms var(--ease-out);
  translate: 0 8px;
  scale: 0.94;
}
.capi-bubble {
  width: max-content;
  max-width: min(17.5rem, calc(100vw - 2 * var(--gutter) - var(--capi-size, 68px) - 16px));
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-media);
  background: var(--color-bubble);
  color: var(--color-ink);
  box-shadow: var(--shadow-float);
  font-size: 0.9375rem;
  font-weight: var(--wght-small);
  line-height: 1.4;
}
.capi-tip {
  width: max-content;
  max-width: 15rem;
  padding: var(--space-2xs) var(--space-xs);
  border-radius: var(--radius-input);
  background: var(--color-ink);
  color: var(--color-paper);
  font-size: var(--text-sm);
  font-weight: var(--wght-small);
  line-height: 1.4;
}
.capi-bubble.is-on, .capi-tip.is-on { opacity: 1; translate: 0 0; scale: 1; }
@media (prefers-reduced-motion: reduce) {
  .capi-bubble, .capi-tip { transition: opacity 150ms linear; translate: none; scale: none; }
  .capi-hop, .capi-eye, .capi-lid, .capi-arc { transition: none; }
}

/* ---------- The conversation window ---------- */
html.is-locked .capi, html.is-locked .capi-bubble, html.is-locked .capi-tip { visibility: hidden; }
.conversa {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: transparent;
  color: var(--color-ink);
}
.conversa::backdrop { background: var(--color-veil-night); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.cv {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background: var(--color-paper);
  transform-origin: var(--from-x, 50%) var(--from-y, 100%);
}
@media (min-width: 48rem) {
  .cv {
    width: min(1180px, 100% - 2 * var(--gutter));
    height: min(880px, 100% - 48px);
    margin: auto;
    border-radius: var(--radius-sheet);
    box-shadow: var(--shadow-float);
  }
}
@media (prefers-reduced-motion: no-preference) {
  .conversa[open] .cv { animation: cv-in 560ms var(--ease-out) both; }
  .conversa[open]::backdrop { animation: cv-fade 400ms var(--ease-out) both; }
  .conversa.is-closing .cv { animation: cv-out 320ms var(--ease-in) both; }
  .conversa.is-closing::backdrop { animation: cv-fade-out 320ms var(--ease-in) both; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 47.99rem) {
  .conversa[open] .cv { animation-name: cv-sheet-in; }
  .conversa.is-closing .cv { animation-name: cv-sheet-out; }
}
@media (prefers-reduced-motion: reduce) {
  .conversa[open] .cv { animation: cv-fade 150ms linear both; }
}
@keyframes cv-in { from { opacity: 0; transform: scale(0.16); } 35% { opacity: 1; } }
@keyframes cv-out { to { opacity: 0; transform: scale(0.16); } }
@keyframes cv-sheet-in { from { transform: translateY(100%); } }
@keyframes cv-sheet-out { to { transform: translateY(100%); } }
@keyframes cv-fade { from { opacity: 0; } }
@keyframes cv-fade-out { to { opacity: 0; } }

.cv-head {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: 72px;
  padding: max(var(--space-xs), env(safe-area-inset-top)) var(--space-xs) var(--space-xs) var(--space-md);
  border-bottom: 1px solid var(--color-rule);
}
.cv-avatar {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-paper-2);
  overflow: hidden;
}
.cv-avatar img { width: 140%; max-width: none; height: 140%; margin: -11% 0 0 -20%; object-fit: cover; }
/* With the living figure (conversa.js borrows it from the helper): bigger, out of the circle, no picture under it */
.cv-head .cv-avatar.tem-figura { width: 50px; height: 50px; margin-block: -2px; overflow: visible; border-radius: 0; background: none; }
@media (min-width: 40rem) { .cv-head .cv-avatar.tem-figura { width: 60px; height: 60px; margin-block: -6px -2px; } }
.cv-avatar.tem-figura img { visibility: hidden; }
.cv-avatar.tem-figura .capi-lona { opacity: 1; filter: none; }
.cv-who { flex: 1 1 auto; min-width: 0; }
.cv-title { font-size: 1.0625rem; font-weight: var(--wght-ui); line-height: 1.3; white-space: nowrap; }
.cv-sub { color: var(--color-muted); font-size: var(--text-sm); font-weight: var(--wght-small); line-height: 1.4; }
@media (max-width: 39.99rem) {
  .cv-sub { display: none; }
  .cv-head { padding-left: var(--space-sm); }
  .cv-head .cv-apagar { padding-inline: var(--space-2xs); }
}
.cv-apagar-resto { white-space: pre; } /* its leading space survives inside the flex button */
@media (max-width: 23.99rem) {
  .cv-apagar-resto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
.cv-tools { display: flex; align-items: center; gap: var(--space-3xs); flex: none; }
.cv-apagar {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-sm);
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-ink);
  font-size: var(--text-sm);
  font-weight: var(--wght-ui);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-color) var(--ease-out);
}
.cv-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--color-ink);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-ink);
  cursor: pointer;
  transition: background-color var(--dur-color) var(--ease-out), color var(--dur-color) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .cv-apagar:hover { background: var(--color-paper-2); }
  .cv-icon:hover { background: var(--color-ink); color: var(--color-paper); }
}
.cv-apagar:active, .cv-icon:active, .cv-chip:active, .cv-send:active { transform: translateY(1px); }

.cv-body { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; }
@media (min-width: 64rem) {
  .cv.has-thread .cv-body { grid-template-columns: minmax(0, 1fr) clamp(280px, 26vw, 340px); }
}
.cv-main { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-width: 0; min-height: 0; }
.cv-scroll { overflow-y: auto; overscroll-behavior: contain; padding: clamp(var(--space-md), 3vw, 40px) clamp(var(--space-sm), 3vw, 40px); }
.cv-scroll:focus { outline: none; }
@media (prefers-reduced-motion: no-preference) { .cv-scroll { scroll-behavior: smooth; } }

/* Opening screen */
.cv-start {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: var(--space-md);
  min-height: 100%;
  margin: 0 auto;
  max-width: 50rem;
  text-align: center;
}
.cv-start-title {
  max-width: 15ch;
  font-size: clamp(2.1rem, 1.2rem + 3vw, 3.6rem);
  font-weight: var(--wght-display);
  font-stretch: var(--wdth-display);
  letter-spacing: var(--track-display);
  line-height: 1;
  text-wrap: balance;
}
.cv-start-lead { max-width: 52ch; color: var(--color-ink-2); font-size: var(--text-lead); line-height: 1.45; text-wrap: balance; }
.cv-field {
  position: relative;
  width: 100%;
  border: 1px solid var(--color-rule-strong);
  border-radius: var(--radius-media);
  background: var(--color-paper);
  text-align: left;
  transition: border-color var(--dur-color) var(--ease-out);
}
.cv-field:focus-within { border-color: var(--color-ink-2); outline: 2px solid var(--color-focus); outline-offset: 1px; }
.cv-field textarea {
  display: block;
  width: 100%;
  min-height: 112px;
  padding: 18px 76px 18px 20px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: var(--color-ink);
  font-size: 1.1875rem;
  line-height: 1.45;
  resize: none;
  outline: none;
}
.cv-field textarea::placeholder { color: var(--color-muted); opacity: 1; }
.cv-field--compose textarea { min-height: 56px; max-height: 160px; padding: 15px 64px 15px 18px; font-size: 1.0625rem; }
.cv-send {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-ink);
  color: var(--color-paper);
  cursor: pointer;
  transition: background-color var(--dur-color) var(--ease-out), opacity var(--dur-color) var(--ease-out);
}
.cv-field--compose .cv-send { width: 44px; height: 44px; right: 6px; bottom: 6px; }
.cv-send .ico { transform: rotate(-90deg); }
.cv-send:disabled { opacity: 0.4; cursor: not-allowed; }
@media (hover: hover) and (pointer: fine) {
  .cv-send:not(:disabled):hover { background: var(--color-ink-2); }
}
.cv-chips-label { color: var(--color-muted); font-size: var(--text-sm); font-weight: var(--wght-small); }
.cv-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2xs); margin: 0; padding: 0; list-style: none; }
.cv-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  min-height: 44px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--color-rule-strong);
  border-radius: var(--radius-pill);
  background: var(--color-paper);
  color: var(--color-ink);
  font-size: 1rem;
  font-weight: var(--wght-small);
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--dur-color) var(--ease-out), border-color var(--dur-color) var(--ease-out), color var(--dur-color) var(--ease-out);
}
.cv-chip:disabled { cursor: default; opacity: 0.55; }
.cv-chip[aria-pressed="true"] { border-color: var(--color-ink); background: var(--color-ink); color: var(--color-paper); opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  .cv-chip:not(:disabled):hover { border-color: var(--color-ink); background: var(--color-paper-2); }
}
@media (max-width: 39.99rem) {
  .cv-start .cv-chips { flex-direction: column; align-items: stretch; width: 100%; }
}
.cv-note { max-width: 60ch; color: var(--color-muted); font-size: var(--text-sm); font-weight: var(--wght-small); line-height: 1.45; }
.cv-note a { color: inherit; text-underline-offset: 0.2em; }
.cv-alt { font-size: 1rem; }

/* The thread */
.cv-thread { display: grid; gap: var(--space-lg); max-width: 50rem; margin: 0 auto; padding: 0; list-style: none; }
.cv-msg { min-width: 0; }
.cv-msg--me {
  justify-self: end;
  max-width: min(35rem, 86%);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-media);
  background: var(--color-ink);
  color: var(--color-paper);
  font-size: 1.0625rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.cv-msg--ai { display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: var(--space-sm); align-items: start; }
.cv-msg--ai > .cv-avatar { grid-row: 1 / span 4; }
.cv-text { max-width: 64ch; padding-top: 9px; font-size: 1.0625rem; line-height: 1.6; overflow-wrap: anywhere; white-space: pre-line; }
.cv-later { grid-column: 2; }
@media (prefers-reduced-motion: no-preference) {
  .cv-later { animation: cv-later-in 400ms var(--ease-out) both; }
  .cv-msg--me { animation: cv-later-in 300ms var(--ease-out) both; }
}
@keyframes cv-later-in { from { opacity: 0; transform: translateY(8px); } }
.cv-msg--ai .cv-chips { justify-content: flex-start; margin-top: var(--space-sm); }
.cv-cases {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(17.5rem, 80%);
  gap: var(--space-xs);
  margin-top: var(--space-md);
  padding: 2px 2px var(--space-2xs);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--color-rule-strong) transparent;
}
.cv-case {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-media);
  background: var(--color-paper);
  color: var(--color-ink);
  text-decoration: none;
  scroll-snap-align: start;
  transition: transform var(--dur-hover) var(--ease-out), border-color var(--dur-color) var(--ease-out);
}
.cv-case figure { margin: 0; aspect-ratio: 16 / 10; overflow: hidden; border-bottom: 1px solid var(--color-rule); background: var(--color-paper-2); }
.cv-case img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.cv-case-body { display: grid; gap: var(--space-3xs); padding: var(--space-xs) var(--space-sm) var(--space-sm); }
.cv-case-name { font-weight: var(--wght-ui); line-height: 1.3; }
.cv-case-kind { color: var(--color-muted); font-size: var(--text-sm); font-weight: var(--wght-small); line-height: 1.4; }
.cv-case-text { display: -webkit-box; overflow: hidden; color: var(--color-ink-2); font-size: 0.9375rem; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; }
@media (hover: hover) and (pointer: fine) {
  .cv-case:hover { transform: translateY(-3px); border-color: var(--color-rule-strong); }
}
.cv-wait { display: flex; align-items: center; gap: var(--space-xs); padding-top: 10px; color: var(--color-muted); font-size: var(--text-sm); font-weight: var(--wght-small); }
.cv-dots { display: inline-flex; gap: 5px; }
.cv-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--color-ink-2); opacity: 0.3; }
@media (prefers-reduced-motion: no-preference) {
  .cv-dots i { animation: cv-dot 1000ms ease-in-out infinite; }
  .cv-dots i:nth-child(2) { animation-delay: 150ms; }
  .cv-dots i:nth-child(3) { animation-delay: 300ms; }
  .cv-avatar.is-thinking img { animation: cv-think 1800ms ease-in-out infinite; }
}
@keyframes cv-dot { 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes cv-think { 25% { transform: rotate(-6deg) translateY(-1px); } 75% { transform: rotate(6deg) translateY(-1px); } }
.cv-error { color: var(--color-accent); }

/* The contact step, inline under the answer that asks for it */
.cv-contato {
  display: grid;
  gap: var(--space-sm);
  max-width: 36rem;
  margin-top: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-media);
  background: var(--color-paper-2);
}
.cv-contato h3 { font-size: 1.125rem; font-weight: var(--wght-ui); line-height: 1.3; }
.cv-contato-grid { display: grid; gap: var(--space-sm); }
@media (min-width: 40rem) { .cv-contato-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cv-contato-grid .cv-full { grid-column: 1 / -1; } }
.cv-label { display: grid; gap: var(--space-3xs); font-size: var(--text-sm); font-weight: var(--wght-ui); line-height: 1.35; }
.cv-input {
  min-height: 48px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--color-rule-strong);
  border-radius: var(--radius-input);
  background: var(--color-paper);
  color: var(--color-ink);
  font-size: 1.0625rem;
  font-weight: var(--wght-body);
  outline: 2px solid transparent;
  outline-offset: 1px;
}
.cv-input:focus-visible { outline-color: var(--color-focus); border-color: var(--color-ink-2); }
.cv-input[aria-invalid="true"] { border-color: var(--color-accent); }
.cv-hint { color: var(--color-muted); font-size: var(--text-sm); font-weight: var(--wght-small); }
.cv-check { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: var(--space-xs); align-items: start; min-height: 44px; font-size: var(--text-sm); font-weight: var(--wght-small); line-height: 1.45; cursor: pointer; }
.cv-check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--color-ink); }
.cv-check[data-invalid="true"] { color: var(--color-accent); }
.cv-form-status { min-height: 1.45em; color: var(--color-muted); font-size: var(--text-sm); font-weight: var(--wght-small); line-height: 1.45; }
.cv-form-status[data-error="true"] { color: var(--color-accent); }
.cv-contato .btn { justify-self: start; }
.cv-done { display: grid; gap: var(--space-xs); max-width: 36rem; margin-top: var(--space-md); padding-top: var(--space-md); border-top: 2px solid var(--color-ink); }
.cv-done h3 { font-size: var(--text-title); font-weight: var(--wght-ui); line-height: 1.25; }
.cv-done h3:focus { outline: none; }
.cv-protocol { font-size: 1.25rem; font-weight: var(--wght-display); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.cv-off { display: grid; gap: var(--space-md); justify-items: center; align-content: center; min-height: 100%; max-width: 40rem; margin: 0 auto; text-align: center; }
.cv-off h3 { font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.5rem); font-weight: var(--wght-display); font-stretch: var(--wdth-display); letter-spacing: var(--track-display); line-height: 1.05; text-wrap: balance; }
.cv-off p { color: var(--color-ink-2); max-width: 46ch; }

/* The compose bar once the conversation has started */
.cv-compose { padding: var(--space-xs) clamp(var(--space-sm), 3vw, 40px) max(var(--space-sm), env(safe-area-inset-bottom)); border-top: 1px solid var(--color-rule); background: var(--color-paper); }
.cv-compose .cv-field { max-width: 50rem; margin: 0 auto; }
.cv-compose-meta { display: flex; justify-content: space-between; gap: var(--space-sm); max-width: 50rem; margin: var(--space-3xs) auto 0; }

/* The project sheet ("Ficha do projeto"): a column on computers, a folding bar on phones */
.cv-ficha { min-width: 0; min-height: 0; border-left: 1px solid var(--color-rule); background: var(--color-paper-2); overflow-y: auto; overscroll-behavior: contain; }
.cv-ficha > summary { display: none; }
.cv-ficha-inner { padding: var(--space-lg) var(--space-md); }
.cv-ficha-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-sm); padding-bottom: var(--space-sm); border-bottom: 2px solid var(--color-ink); }
.cv-ficha h3 { font-size: 1.125rem; font-weight: var(--wght-ui); line-height: 1.3; }
.cv-count { color: var(--color-muted); font-size: var(--text-sm); font-weight: var(--wght-ui); font-variant-numeric: tabular-nums; }
.cv-ficha dl { margin: 0; }
.cv-ficha-row { padding-block: var(--space-xs); border-bottom: 1px solid var(--color-rule); }
.cv-ficha dt { color: var(--color-muted); font-size: var(--text-sm); font-weight: var(--wght-small); line-height: 1.4; }
.cv-ficha dd { margin: var(--space-3xs) 0 0; font-size: 1rem; font-weight: var(--wght-ui); line-height: 1.4; overflow-wrap: anywhere; }
.cv-ficha dd.is-empty { color: var(--color-muted); font-weight: var(--wght-small); }
.cv-ficha-note { margin-top: var(--space-sm); color: var(--color-muted); font-size: var(--text-sm); line-height: 1.45; }
@media (prefers-reduced-motion: no-preference) {
  .cv-ficha dd.is-new { animation: cv-wipe 900ms var(--ease-out) both; }
}
@keyframes cv-wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@media (max-width: 63.99rem) {
  .cv-ficha { position: absolute; top: 0; left: 0; right: 0; z-index: 2; max-height: 55%; border-left: 0; border-bottom: 1px solid var(--color-rule); box-shadow: var(--shadow-float); }
  .cv-ficha > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); min-height: 52px; padding: 0 var(--space-md); font-weight: var(--wght-ui); list-style: none; cursor: pointer; }
  .cv-ficha > summary::-webkit-details-marker { display: none; }
  .cv-ficha > summary .ico { transition: transform var(--dur-short) var(--ease-out); }
  .cv-ficha[open] > summary .ico { transform: rotate(180deg); }
  .cv-ficha-inner { padding-top: 0; }
  .cv-ficha-head { display: none; }
  .cv.has-thread .cv-scroll { padding-top: calc(52px + var(--space-md)); }
}

/* The quick-question view: the studio assistant (/site/atendente.js) inside the same window */
.cv-pergunta { display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; padding: var(--space-md) clamp(var(--space-sm), 3vw, 40px) var(--space-md); gap: var(--space-sm); }
.cv-back { justify-self: start; }
.cv-pergunta .chat { max-width: 50rem; width: 100%; margin: 0 auto; min-height: 0; }
.chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-media);
  background: var(--color-paper);
}
.chat-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-rule);
}
.chat-head strong { grid-column: 1; font-weight: var(--wght-ui); font-size: 1.0625rem; line-height: 1.3; }
.chat-head .attendant-tag { grid-column: 1; color: var(--color-muted); font-size: var(--text-sm); font-weight: var(--wght-small); line-height: 1.4; }
.chat-head #attendant-new { grid-column: 2; grid-row: 1 / span 2; min-height: 44px; font-size: var(--text-sm); }
.attendant-suggestions { display: flex; flex-wrap: wrap; gap: var(--space-2xs); padding: var(--space-sm) var(--space-md) 0; }
.attendant-suggestions button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--color-rule-strong);
  border-radius: var(--radius-pill);
  background: var(--color-paper);
  color: var(--color-ink);
  font-size: 0.9375rem;
  font-weight: var(--wght-small);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-color) var(--ease-out), border-color var(--dur-color) var(--ease-out);
}
.attendant-suggestions button:disabled { opacity: 0.5; cursor: not-allowed; }
.attendant-suggestions button:active { transform: translateY(1px); }
@media (hover: hover) and (pointer: fine) {
  .attendant-suggestions button:hover:not(:disabled) { background: var(--color-paper-2); border-color: var(--color-ink); }
}
.attendant-log { flex: 1 1 auto; display: flex; flex-direction: column; gap: var(--space-sm); min-height: 10rem; overflow-y: auto; overscroll-behavior: contain; padding: var(--space-md); }
.attendant-message { max-width: 44ch; line-height: 1.5; overflow-wrap: anywhere; }
.attendant-message-bot { align-self: flex-start; color: var(--color-ink); }
.attendant-message-user { align-self: flex-end; max-width: min(46ch, 86%); padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-input); background: var(--color-ink); color: var(--color-paper); }
.attendant-message-human { align-self: flex-start; }
.attendant-team-label { font-weight: var(--wght-ui); }
/* Answer links are whole 44 px targets, as on the old homepage's panel */
.attendant-message a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; font-weight: var(--wght-ui); text-decoration-thickness: 1.5px; text-underline-offset: 0.2em; }
@media (hover: hover) and (pointer: fine) { .attendant-message a:hover { text-decoration-color: var(--color-accent); } }
.attendant-form { padding: var(--space-sm) var(--space-md) 0; border-top: 1px solid var(--color-rule); }
.attendant-form label { display: block; margin-bottom: var(--space-2xs); font-size: var(--text-sm); font-weight: var(--wght-ui); }
.attendant-compose { display: flex; gap: var(--space-2xs); }
.attendant-compose input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 52px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--color-rule-strong);
  border-radius: var(--radius-input);
  background: var(--color-paper);
  color: var(--color-ink);
  font-size: 1.0625rem;
  outline: 2px solid transparent;
  outline-offset: 1px;
}
.attendant-compose input::placeholder { color: var(--color-muted); opacity: 1; }
.attendant-compose input:focus-visible { outline-color: var(--color-focus); border-color: var(--color-ink-2); }
.attendant-compose input[readonly] { background: var(--color-paper-2); }
.attendant-compose input[aria-invalid="true"] { border-color: var(--color-accent); }
.attendant-compose .btn { min-height: 52px; padding: 0 var(--space-md); }
.attendant-form[data-state="sending"] .btn { opacity: 0.7; }
.attendant-status { min-height: 1.45em; padding: var(--space-2xs) var(--space-md) 0; color: var(--color-muted); font-size: var(--text-sm); font-weight: var(--wght-small); line-height: 1.45; }
.attendant-status[data-error] { color: var(--color-accent); }
.attendant-fallback { padding: 0 var(--space-md) var(--space-2xs); }
.attendant-fallback .link { font-size: var(--text-sm); }
.chat .notice { padding: 0 var(--space-md) var(--space-sm); color: var(--color-muted); font-size: var(--text-sm); }
