/* InkWoof v2: painel do agente (coluna acoplada, conversa, etapas, resultado, compositor).
   Portado de design/ui-v2/mockups/assets/mock.css para o DOM real. Só usa tokens --iw-*. */

/* ======================================================================
   Coluna
   ====================================================================== */
.iw-agent {
  position: relative; isolation: isolate; min-width: 0; min-height: 0; height: 100%;
  display: flex; flex-direction: column; background: var(--iw-surface-1); border-left: 1px solid var(--iw-line-1); color: var(--iw-text-1);
  font-family: var(--iw-font-ui);
}
.iw-agent[hidden] { display: none; }
.iw-agent::before { /* aura de tinta: mais forte quando trabalha */
  content: ""; position: absolute; inset: 0 0 auto 0; height: 260px; z-index: -1; pointer-events: none;
  background: var(--iw-agent-aura); opacity: .75; transition: opacity var(--iw-dur-slow) var(--iw-ease-out);
}
.iw-agent[data-state="working"]::before { opacity: 1; animation: iw-aura 3.2s ease-in-out infinite alternate; animation-play-state: var(--iw-loop-state); }
@keyframes iw-aura { from { opacity: .7; } to { opacity: 1; } }

.iw-resizer { position: absolute; left: -7px; top: 0; bottom: 0; width: 14px; z-index: 6; cursor: col-resize; display: grid; place-items: center; touch-action: none; }
.iw-resizer::before { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: transparent; transition: background var(--iw-dur-fast); }
.iw-resizer::after { content: ""; width: 4px; height: 40px; border-radius: 4px; background: var(--iw-line-3); transition: background var(--iw-dur-fast), height var(--iw-dur-fast) var(--iw-ease-spring); }
.iw-resizer:hover::before, .is-resizing .iw-resizer::before { background: var(--iw-accent-line); }
.iw-resizer:hover::after, .iw-resizer:focus-visible::after, .is-resizing .iw-resizer::after { background: var(--iw-accent-text); height: 56px; }

.iw-agent-head { position: relative; height: var(--iw-header-h); flex: none; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 10px; border-bottom: 1px solid var(--iw-line-1); }
.iw-agent-head::before { /* filete de tinta: a assinatura do agente; corre quando ele trabalha */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--iw-ink-line); background-size: 200% 100%; opacity: .7;
}
.iw-agent[data-state="working"] .iw-agent-head::before { opacity: 1; animation: iw-flow 2.4s linear infinite; animation-play-state: var(--iw-loop-state); }
@keyframes iw-flow { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.iw-agent-id { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 10px 0 6px; border-radius: 12px; min-width: 0; text-align: left; color: var(--iw-text-1); }
.iw-agent-id:hover, .iw-agent-id[aria-expanded="true"] { background: var(--iw-surface-3); }
.iw-agent-name { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.iw-agent-name b { font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iw-agent-name small { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--iw-text-3); white-space: nowrap; }
.iw-agent-name small .iw-dot { width: 6px; height: 6px; }
.iw-agent[data-state="working"] .iw-agent-name small .iw-dot { background: var(--iw-accent-text); }
.iw-agent[data-state="attention"] .iw-agent-name small .iw-dot { background: var(--iw-warning); }
.iw-agent-id > .i { color: var(--iw-text-3); }
.iw-agent-actions { margin-left: auto; display: flex; gap: 2px; }

.iw-agent-ctx { flex: none; display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--iw-line-1); overflow: hidden; white-space: nowrap; }
.iw-agent-ctx > span:first-child { font-size: 12px; color: var(--iw-text-3); margin-right: 2px; }
.iw-agent-ctx .iw-chip { min-width: 0; max-width: 100%; }
.iw-agent-ctx .iw-chip > span { overflow: hidden; text-overflow: ellipsis; }
.iw-agent-ctx .iw-chip:empty { display: none; }

/* ======================================================================
   Popover da conexão
   ====================================================================== */
.iw-pop {
  position: absolute; z-index: calc(var(--iw-z-popover) + 1); left: 10px; right: 10px; top: calc(var(--iw-header-h) - 4px); max-width: 420px; border-radius: 18px; overflow: hidden;
  background: var(--iw-surface-2); box-shadow: var(--iw-shadow-3); animation: iw-pop-in var(--iw-dur-base) var(--iw-ease-out) both; transform-origin: 30% 0;
}
.iw-pop[hidden] { display: none; }
.iw-pop-hero { position: relative; padding: 18px 18px 16px; background: var(--iw-agent-aura), var(--iw-surface-2); border-bottom: 1px solid var(--iw-line-1); }
.iw-pop-hero-row { display: flex; align-items: center; gap: 12px; }
.iw-pop-hero .iw-orb { width: 44px; height: 44px; }
.iw-pop-hero h3 { font-size: 17px; font-weight: 650; line-height: 22px; }
.iw-pop-hero p { font-size: 12.5px; color: var(--iw-text-3); }
.iw-status-pill { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--iw-success); background: var(--iw-success-soft); box-shadow: inset 0 0 0 1px rgba(62, 224, 197, .25); white-space: nowrap; }
.iw-status-pill.is-off { color: var(--iw-text-2); background: var(--iw-surface-3); box-shadow: inset 0 0 0 1px var(--iw-line-2); }
.iw-pop-sec { padding: 14px 18px; border-bottom: 1px solid var(--iw-line-1); }
.iw-pop-sec h4 { margin: 0 0 10px; font-size: 11.5px; font-weight: 600; letter-spacing: var(--iw-ls-caps); text-transform: uppercase; color: var(--iw-text-3); }
.iw-cap { display: grid; grid-template-columns: 28px 1fr auto; gap: 0 10px; align-items: center; padding: 7px 0; }
.iw-cap-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--iw-text-2); background: var(--iw-surface-3); }
.iw-cap b { font-size: 13px; font-weight: 600; line-height: 18px; }
.iw-cap small { display: block; font-size: 12px; line-height: 16px; color: var(--iw-text-3); }
.iw-pop-foot { display: flex; align-items: center; gap: 8px; padding: 12px 14px; }
.iw-pop-foot .iw-btn { height: 36px; font-size: 13px; padding: 0 12px; }

/* ======================================================================
   Linha do tempo
   ====================================================================== */
.iw-thread { flex: 1; min-height: 0; overflow: auto; padding: 20px 16px 12px; display: flex; flex-direction: column; gap: 22px; scrollbar-width: thin; scrollbar-color: var(--iw-surface-4) transparent; overscroll-behavior: contain; }
.iw-thread:focus-visible { outline-offset: -2px; }
.iw-thread-inner { display: flex; flex-direction: column; gap: 22px; width: 100%; max-width: var(--iw-chat-max); margin: 0 auto; min-height: min-content; }
.iw-thread-inner > .turn { display: flex; flex-direction: column; gap: 22px; }
.turn.is-new { animation: iw-msg-in var(--iw-dur-base) var(--iw-ease-out) both; }
.turn.is-initial { animation-delay: calc(var(--turn, 0) * 40ms); }
.iw-day { align-self: center; font-size: 11.5px; color: var(--iw-text-3); padding: 2px 10px; border-radius: 999px; background: var(--iw-surface-2); }

.iw-msg-user { align-self: flex-end; max-width: 90%; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.iw-bubble {
  padding: 11px 14px; border-radius: 18px 18px 6px 18px; font-size: var(--iw-fs-chat); line-height: var(--iw-lh-chat);
  color: var(--iw-text-1); background: var(--iw-surface-3); box-shadow: inset 0 0 0 1px var(--iw-line-1), inset 0 1px 0 var(--iw-highlight);
  overflow-wrap: anywhere;
}
.iw-bubble p { margin: 0; white-space: pre-wrap; }
.iw-bubble a, .iw-link { color: var(--iw-accent-text); text-decoration: underline; text-decoration-color: var(--iw-accent-line); text-underline-offset: 3px; }
.iw-bubble .msg-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.iw-msg-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; font-size: 11.5px; color: var(--iw-text-3); padding: 0 4px; }
.iw-msg-meta .iw-chip { height: 24px; font-size: 11.5px; padding: 0 8px; gap: 6px; }
.iw-msg-meta .iw-chip::after { display: none; }
.iw-brand-tag b { color: var(--iw-text-1); font-weight: 600; }
.iw-refrow { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.iw-refrow figure { position: relative; margin: 0; width: 34px; height: 42px; border-radius: 5px; overflow: hidden; box-shadow: var(--iw-shadow-thumb); background: var(--iw-surface-3); display: grid; place-items: center; color: var(--iw-text-3); }
.iw-refrow img { width: 100%; height: 100%; object-fit: cover; }
.iw-refrow figcaption { position: absolute; left: 2px; top: 2px; min-width: 12px; height: 12px; border-radius: 3px; font: 600 8.5px/12px var(--iw-font-mono); text-align: center; color: #fff; background: rgba(8, 9, 13, .75); }
.iw-refmore { align-self: center; font: 600 11px/1 var(--iw-font-mono); color: var(--iw-text-3); padding: 0 4px; }

.iw-msg-agent { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.iw-msg-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.iw-msg-head b { font-weight: 650; }
.iw-msg-head span:not(.iw-orb) { color: var(--iw-text-3); font-size: 12px; }
.iw-msg-head .iw-orb { width: 20px; height: 20px; }
.msg-body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.iw-msg-text { font-size: var(--iw-fs-chat); line-height: var(--iw-lh-chat); color: var(--iw-text-1); text-wrap: pretty; overflow-wrap: anywhere; white-space: pre-line; }
.iw-msg-text.is-clamped { display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; }
.msg-more { align-self: flex-start; min-height: 32px; }
.iw-msg-meta.agent-job-progress { justify-content: flex-start; padding: 0; }
@keyframes iw-msg-in { from { opacity: 0; transform: translateY(calc(var(--iw-move) * 8px)); } to { opacity: 1; transform: none; } }
.msg-live { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--iw-text-2); }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--iw-accent-text); animation: iw-breath 900ms ease-in-out infinite alternate; animation-play-state: var(--iw-loop-state); }
.typing i:nth-child(2) { animation-delay: 150ms; }
.typing i:nth-child(3) { animation-delay: 300ms; }

/* Etapas: só o que o agente relatou, na ordem em que apareceu */
.iw-steps-sum { display: flex; align-items: center; gap: 8px; width: fit-content; height: 32px; padding: 0 10px 0 8px; border-radius: 999px; font-size: 12.5px; color: var(--iw-text-2); background: var(--iw-success-soft); box-shadow: inset 0 0 0 1px rgba(62, 224, 197, .18); cursor: pointer; list-style: none; }
.iw-steps-sum::-webkit-details-marker { display: none; }
.iw-steps-sum .i:first-child { color: var(--iw-success); }
.iw-steps-sum .i:last-child { transition: transform var(--iw-dur-fast); }
details[open] > .iw-steps-sum .i:last-child { transform: rotate(180deg); }
details.msg-steps > .iw-steps { margin-top: 10px; }
.iw-steps { list-style: none; margin: 0; padding: 14px 14px 6px; border-radius: var(--iw-radius-lg); background: var(--iw-surface-2); box-shadow: inset 0 0 0 1px var(--iw-line-1), inset 0 1px 0 var(--iw-highlight); position: relative; }
.iw-step { position: relative; display: grid; grid-template-columns: 22px 1fr auto; gap: 2px 12px; padding-bottom: 14px; --c: var(--iw-step-compose); }
.iw-step::before { content: ""; position: absolute; left: 10px; top: 24px; bottom: 2px; width: 2px; border-radius: 2px; background: var(--iw-line-2); }
.iw-step:last-child::before { display: none; }
.iw-step.is-done::before { background: linear-gradient(var(--c), color-mix(in oklab, var(--c) 40%, transparent)); opacity: .55; }
.iw-step-ico { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; grid-row: span 2; }
.iw-step.is-done .iw-step-ico { color: var(--iw-text-on-bright); background: var(--c); }
.iw-step.is-done .iw-step-ico .i { width: 13px; height: 13px; stroke-width: 2.6; }
.iw-step.is-active .iw-step-ico { background: conic-gradient(from var(--iw-angle), transparent 0 30%, var(--c) 100%); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px)); mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px)); animation: iw-rim 900ms linear infinite; animation-play-state: var(--iw-loop-state); }
.iw-step.is-pending .iw-step-ico { box-shadow: inset 0 0 0 2px var(--iw-line-3); }
.iw-step.is-warn .iw-step-ico { color: var(--iw-text-on-bright); background: var(--iw-warning); }
.iw-step.is-warn .iw-step-ico .i { width: 13px; height: 13px; stroke-width: 2.4; }
.iw-step-t { font-size: 14px; line-height: 22px; color: var(--iw-text-2); font-weight: 500; overflow-wrap: anywhere; }
.iw-step.is-active .iw-step-t { color: var(--iw-text-1); font-weight: 600; }
.iw-step.is-pending .iw-step-t { color: var(--iw-text-3); }
.iw-step-d { grid-column: 2; font-size: 12.5px; line-height: 18px; color: var(--iw-text-3); }
.iw-step-time { grid-column: 3; grid-row: 1; font: 500 11.5px/22px var(--iw-font-mono); color: var(--iw-text-3); }
.iw-step.is-active .iw-step-time { color: var(--c); }
.step-list { list-style: none; margin: 0; padding: 0; }

/* Resultado: as páginas dentro da conversa */
.iw-result { border-radius: var(--iw-radius-lg); background: var(--iw-surface-2); box-shadow: inset 0 0 0 1px var(--iw-line-1), inset 0 1px 0 var(--iw-highlight), 0 12px 30px -18px rgba(0, 0, 0, .7); padding: 12px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.iw-result-head { display: flex; align-items: center; gap: 10px; padding: 2px 2px 0; }
.iw-result-head .i { color: var(--iw-format-carousel); }
.iw-result-head b { font-size: 13.5px; font-weight: 600; }
.iw-result-head .mono { margin-left: auto; font-size: 11.5px; color: var(--iw-text-3); }
.iw-pages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.agent-focus .iw-pages { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.iw-pcard {
  position: relative; display: block; padding: 0; border: 0; aspect-ratio: var(--ar, 4 / 5); border-radius: 8px; overflow: hidden; box-shadow: var(--iw-shadow-thumb); background: var(--iw-surface-3);
  transition: transform var(--iw-dur-fast) var(--iw-ease-spring), box-shadow var(--iw-dur-fast) var(--iw-ease-out);
}
.iw-pcard canvas { display: block; width: 100%; height: 100%; background: transparent; opacity: 0; transition: opacity var(--iw-dur-slow); }
.iw-pcard canvas.is-painted { opacity: 1; }
.iw-pcard:hover { transform: translateY(calc(var(--iw-move) * -3px)); box-shadow: 0 0 0 1px var(--iw-accent-line), 0 14px 28px -10px rgba(0, 0, 0, .7); }
.iw-pcard.is-open { box-shadow: 0 0 0 2px var(--iw-surface-2), 0 0 0 4px var(--iw-select); }
.iw-pcard-n { position: absolute; left: 6px; bottom: 6px; height: 18px; min-width: 18px; padding: 0 5px; border-radius: 5px; font: 600 10.5px/18px var(--iw-font-mono); text-align: center; color: #fff; background: rgba(8, 9, 13, .72); backdrop-filter: blur(6px); }
.iw-pcard-open { display: none; position: absolute; right: 6px; top: 6px; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 10.5px; font-weight: 600; line-height: 20px; color: #fff; background: var(--iw-accent); }
.iw-pcard.is-open .iw-pcard-open { display: block; }
.agent-focus .iw-pcard-open { display: none !important; }
.iw-pcard-more { display: grid; place-items: center; font: 600 12px/1 var(--iw-font-mono); color: var(--iw-text-3); box-shadow: inset 0 0 0 1px var(--iw-line-2); background: none; }
.iw-reveal { animation: iw-reveal var(--iw-dur-reveal) var(--iw-ease-out) both; animation-delay: calc(var(--i, 0) * var(--iw-stagger-pages) + 200ms); }
@keyframes iw-reveal {
  from { clip-path: inset(0 0 100% 0 round 8px); filter: blur(8px) saturate(.3); transform: translateY(calc(var(--iw-move) * 6px)) scale(calc(1 - var(--iw-move) * .03)); }
  60% { filter: blur(1px) saturate(.9); }
  to { clip-path: inset(0 0 0 0 round 8px); filter: none; transform: none; }
}
.iw-result-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.iw-result-foot .iw-btn { height: 36px; font-size: 13px; padding: 0 10px; border-radius: 10px; margin-left: auto; }
.iw-result-foot .iw-btn svg { width: 16px; height: 16px; }
.iw-chip-ok { color: var(--iw-success); background: var(--iw-success-soft); box-shadow: none; height: 26px; }
.iw-chip-ok::after { display: none; }

/* Ações rápidas */
.iw-quick { display: flex; flex-wrap: wrap; gap: 8px; }
.iw-qa {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 12px; border-radius: 999px;
  font-size: 13px; font-weight: 500; color: var(--iw-text-1); background: var(--iw-surface-2);
  box-shadow: inset 0 0 0 1px var(--iw-line-2), inset 0 1px 0 var(--iw-highlight);
  transition: background var(--iw-dur-fast), box-shadow var(--iw-dur-fast), transform var(--iw-dur-instant);
}
.iw-qa .i { color: var(--iw-text-3); width: 16px; height: 16px; }
.iw-qa:hover { background: var(--iw-surface-3); box-shadow: inset 0 0 0 1px var(--iw-accent-line); }
.iw-qa:hover .i { color: var(--iw-accent-text); }

/* Cartões de estado na conversa */
.iw-note { border-radius: var(--iw-radius-lg); padding: 14px; display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden; background: var(--iw-surface-2); box-shadow: inset 0 0 0 1px var(--iw-line-2); }
.iw-note-head { display: flex; align-items: center; gap: 10px; }
.iw-note-head b { font-size: 14.5px; font-weight: 650; }
.iw-note-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; color: var(--iw-accent-text); background: var(--iw-accent-soft); }
.iw-note p { font-size: 14px; line-height: 21px; color: var(--iw-text-2); margin: 0; overflow-wrap: anywhere; }
.iw-note p strong { color: var(--iw-text-1); font-weight: 600; }
.iw-note-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.iw-note.is-ask { background: linear-gradient(180deg, var(--iw-warning-soft), transparent 70%), var(--iw-surface-2); box-shadow: inset 0 0 0 1px rgba(245, 194, 94, .28), inset 0 1px 0 var(--iw-highlight); }
.iw-note.is-ask .iw-note-ico { color: var(--iw-text-on-bright); background: var(--iw-warning); }
.iw-note.is-error { background: var(--iw-danger-soft); box-shadow: inset 0 0 0 1px rgba(255, 107, 134, .25); padding: 10px 10px 10px 12px; flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; }
.iw-note.is-error .iw-note-body { display: flex; flex-direction: column; min-width: 0; flex: 1 1 180px; }
.iw-note.is-error .iw-btn { height: 34px; font-size: 12.5px; padding: 0 10px; flex: none; }
.iw-note.is-error .iw-note-ico { color: var(--iw-danger); background: rgba(255, 107, 134, .14); width: 28px; height: 28px; }
.iw-note.is-error b { font-size: 13.5px; }
.iw-note.is-error p { font-size: 13px; line-height: 19px; }
.iw-btn-sm { height: 36px; min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; gap: 6px; }
.iw-btn-sm svg { width: 16px; height: 16px; }
.agent-reference-status { padding: 12px 14px; border-radius: var(--iw-radius-lg); background: var(--iw-surface-2); box-shadow: inset 0 0 0 1px var(--iw-line-2); font-size: 13px; line-height: 19px; color: var(--iw-text-2); }
.agent-reference-status b { display: block; color: var(--iw-text-1); font-weight: 650; margin-bottom: 4px; }
.agent-reference-status p { margin: 4px 0 0; }
.agent-reference-status.is-qualified { box-shadow: inset 0 0 0 1px rgba(62, 224, 197, .3); }
.agent-reference-status details { margin-top: 6px; }
.agent-reference-status summary { cursor: pointer; color: var(--iw-accent-text); font-size: 12.5px; }
.agent-direction-options { display: grid; gap: 8px; }
.agent-direction-options section { padding: 12px 14px; border-radius: var(--iw-radius-lg); background: var(--iw-surface-2); box-shadow: inset 0 0 0 1px var(--iw-line-2); display: grid; gap: 6px; justify-items: start; }
.agent-direction-options h3 { font-size: 14px; font-weight: 650; }
.agent-direction-options p { font-size: 13px; line-height: 19px; color: var(--iw-text-2); margin: 0; }
.url-pill { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; vertical-align: bottom; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Vazio */
.iw-empty { margin: auto 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 8px 8px 0; }
.iw-empty-art { position: relative; width: 132px; height: 112px; }
.iw-empty-art::before { content: ""; position: absolute; inset: 6px 0 -6px; border-radius: 50%; background: radial-gradient(closest-side, rgba(245, 194, 94, .22), rgba(61, 92, 255, .10) 60%, transparent); filter: blur(4px); }
.iw-empty-art img { position: relative; width: 132px; height: 132px; margin-top: -14px; object-fit: contain; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .5)); }
.iw-empty h2 { font-family: var(--iw-font-display); font-size: var(--iw-fs-d4); line-height: var(--iw-lh-d4); letter-spacing: var(--iw-ls-d4); font-weight: var(--iw-fw-display); }
.iw-empty > p { max-width: 36ch; font-size: 14px; line-height: 21px; color: var(--iw-text-2); margin: 0; }
.iw-suggest { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; text-align: left; }
.iw-sug {
  display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 6px; padding: 12px; min-height: 92px; border-radius: 14px; background: var(--iw-surface-2);
  box-shadow: inset 0 0 0 1px var(--iw-line-1), inset 0 1px 0 var(--iw-highlight); transition: box-shadow var(--iw-dur-fast), transform var(--iw-dur-fast) var(--iw-ease-spring), background var(--iw-dur-fast);
}
.iw-sug:hover { background: var(--iw-surface-3); box-shadow: inset 0 0 0 1px var(--iw-accent-line); transform: translateY(calc(var(--iw-move) * -2px)); }
.iw-sug .i { color: var(--iw-accent-text); }
.iw-sug b { font-size: 13.5px; font-weight: 600; line-height: 18px; }
.iw-sug small { font-size: 12px; line-height: 16px; color: var(--iw-text-3); }

/* ======================================================================
   Faixa ao vivo (Inko, estado factual, relógio, parar)
   ====================================================================== */
.dock-notice { flex: none; margin: 0 12px 8px; padding: 9px 12px; border-radius: 12px; font-size: 12.5px; line-height: 18px; color: var(--iw-text-2); background: var(--iw-surface-2); box-shadow: inset 0 0 0 1px var(--iw-line-2); }
.dock-notice.has-error { color: var(--iw-warning); background: var(--iw-warning-soft); box-shadow: inset 0 0 0 1px rgba(245, 194, 94, .28); }
.iw-live {
  flex: none; margin: 0 12px 10px; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 14px;
  background: linear-gradient(90deg, rgba(61, 92, 255, .10), rgba(62, 224, 197, .06)), var(--iw-surface-2); box-shadow: inset 0 0 0 1px var(--iw-accent-line);
  width: calc(100% - 24px); max-width: var(--iw-chat-max); align-self: center;
}
.iw-live[hidden] { display: none; }
.iw-live-inko { position: relative; width: 52px; height: 44px; flex: none; border-radius: 10px; overflow: hidden; background: radial-gradient(80% 90% at 30% 20%, rgba(245, 194, 94, .22), transparent 70%), var(--iw-surface-3); }
.iw-live-inko .agent-inko { position: absolute; inset: 0; }
.iw-live-inko .agent-inko img { position: absolute; width: 50px; height: 50px; left: -4px; top: -1px; object-fit: contain; }
.iw-live-inko .agent-inko svg { position: absolute; right: 1px; top: 25px; width: 18px; height: 14px; overflow: visible; }
.iw-live-inko path { fill: none; stroke: var(--iw-accent-text); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: iw-draw 2.2s var(--iw-ease-in-out) infinite; animation-play-state: var(--iw-loop-state); }
@keyframes iw-draw { 0% { stroke-dashoffset: 60; } 55%, 80% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; opacity: 0; } }
.iw-live-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; flex: 1; }
.iw-live-txt b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iw-live-txt small { font-size: 12px; color: var(--iw-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iw-live-time { font: 500 12px/1 var(--iw-font-mono); color: var(--iw-accent-text); }
.iw-stop { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--iw-text-1); background: var(--iw-surface-4); box-shadow: inset 0 0 0 1px var(--iw-line-2); }
.iw-stop .i { width: 12px; height: 12px; fill: currentColor; stroke: none; }
.iw-stop:hover:not(:disabled) { background: var(--iw-danger-soft); color: var(--iw-danger); }
.iw-stop:disabled { opacity: .55; }

/* ======================================================================
   Compositor (no painel e na tela inicial compartilham as peças)
   ====================================================================== */
.iw-composer-wrap { flex: none; padding: 4px 12px 12px; width: 100%; max-width: calc(var(--iw-chat-max) + 24px); margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.agent-offline-note { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 12px; font-size: 12.5px; line-height: 18px; color: var(--iw-text-2); background: var(--iw-surface-2); box-shadow: inset 0 0 0 1px var(--iw-line-2); }
.agent-offline-note button { color: var(--iw-accent-text); font-weight: 600; text-decoration: underline; text-decoration-color: var(--iw-accent-line); text-underline-offset: 3px; min-height: 32px; }
.agent-recovery { display: grid; gap: 8px; }
.agent-recovery[hidden] { display: none; }
.agent-recovery label { align-items: flex-start; justify-content: flex-start; }
.agent-footnote { margin: 0; padding: 0 6px; font-size: 12px; line-height: 17px; color: var(--iw-text-3); }
.agent-footnote[hidden] { display: none; }
.brief-composer.iw-composer {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 12px 12px 10px; border-radius: var(--iw-radius-xl);
  background: var(--iw-surface-2); box-shadow: inset 0 0 0 1px var(--iw-line-2), inset 0 1px 0 var(--iw-highlight), 0 10px 30px -14px rgba(0, 0, 0, .7);
  transition: box-shadow var(--iw-dur-base) var(--iw-ease-out); margin: 0; border: 0;
}
.brief-composer.iw-composer::before { /* aro de tinta */
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none; background: var(--iw-ink-rim);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); opacity: 0; transition: opacity var(--iw-dur-base) var(--iw-ease-out);
}
.brief-composer.iw-composer:focus-within::before { opacity: 1; animation: iw-rim var(--iw-dur-rim) linear infinite; animation-play-state: var(--iw-loop-state); }
.brief-composer.iw-composer:focus-within { box-shadow: inset 0 0 0 1px transparent, 0 0 0 4px var(--iw-accent-soft), 0 18px 50px -16px rgba(61, 92, 255, .45); }
.brief-composer.is-dragging { box-shadow: inset 0 0 0 1.5px var(--iw-accent-text), 0 0 0 4px var(--iw-accent-soft); }
.composer-field { display: block; margin: 0; padding: 0; }
.composer-field textarea, .brief-composer textarea[name="prompt"] {
  display: block; width: 100%; min-height: 48px; max-height: 220px; resize: none; border: 0; outline: 0; padding: 2px 4px; background: transparent; box-shadow: none; border-radius: 0;
  font: 400 var(--iw-fs-chat)/var(--iw-lh-chat) var(--iw-font-ui); color: var(--iw-text-1);
}
.composer-field textarea::placeholder { color: var(--iw-text-3); opacity: 1; }
.composer-links[hidden] { display: none; }
.composer-links label { display: grid; gap: 6px; font-size: 12px; color: var(--iw-text-3); }
.composer-links textarea { min-height: 52px; padding: 8px 10px; border: 0; border-radius: 10px; background: var(--iw-surface-3); color: var(--iw-text-1); box-shadow: inset 0 0 0 1px var(--iw-line-2); font: 13px/18px var(--iw-font-mono); resize: vertical; }
.composer-bottom, .iw-composer-bar { display: flex; align-items: center; gap: 2px; min-width: 0; }
.composer-tools { display: flex; align-items: center; gap: 2px; min-width: 0; flex-wrap: wrap; flex: 1; }
.composer-slot { display: contents; }
.composer-slot:empty { display: none; }
.composer-picks { display: inline-flex; align-items: center; gap: 4px; min-width: 0; margin-left: 2px; }
.composer-bottom .iw-icon-btn { width: 36px; height: 36px; border-radius: 9px; position: relative; }
.composer-bottom .iw-icon-btn::after { content: ""; position: absolute; inset: -2px; }
.composer-tool-label { display: none; }
.composer-send.iw-send {
  margin-left: auto; width: 40px; height: 40px; padding: 0; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none;
  background: linear-gradient(180deg, var(--iw-accent-top), var(--iw-accent-bottom)); box-shadow: var(--iw-button-sheen), var(--iw-glow-accent);
  transition: transform var(--iw-dur-fast) var(--iw-ease-spring), opacity var(--iw-dur-fast);
}
.composer-send.iw-send:hover:not(:disabled) { transform: translateY(calc(var(--iw-move) * -1px)) scale(1.04); }
.composer-send.iw-send:disabled { opacity: .4; box-shadow: none; cursor: default; transform: none; }
.composer-send-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.composer-send .i { width: 20px; height: 20px; stroke-width: 2.2; }
.composer-error { margin: 0; padding: 8px 10px; border-radius: 10px; font-size: 12.5px; line-height: 18px; color: var(--iw-danger); background: var(--iw-danger-soft); box-shadow: inset 0 0 0 1px rgba(255, 107, 134, .25); }
.composer-error[hidden] { display: none; }
.composer-drop { display: none; position: absolute; inset: 0; z-index: 4; border-radius: inherit; place-items: center; background: color-mix(in oklab, var(--iw-surface-2) 86%, transparent); backdrop-filter: blur(4px); box-shadow: inset 0 0 0 1.5px var(--iw-accent-text); }
.composer-drop span { display: inline-flex; align-items: center; gap: 8px; color: var(--iw-accent-text); font-size: 14px; }
.brief-composer.is-dragging .composer-drop { display: grid; }
.iw-composer-hint { display: flex; justify-content: space-between; gap: 8px; padding: 0 6px; font-size: 11.5px; color: var(--iw-text-3); white-space: nowrap; overflow: hidden; }
.iw-composer-hint span { display: inline-flex; align-items: center; gap: 5px; }
.iw-composer-hint kbd { height: 18px; font-size: 10.5px; padding: 0 5px; }
.brief-composer.is-send-blocked .composer-send { opacity: .4; }

/* Anexos: legíveis, numerados 1..N, reordenáveis */
.iw-attach-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px; font-size: 12.5px; color: var(--iw-text-2); }
.iw-attach-head[hidden] { display: none; }
.iw-attach-head b { color: var(--iw-text-1); font-weight: 600; }
.iw-attach-head .iw-btn { height: 30px; padding: 0 8px; font-size: 12px; }
.iw-attach { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: none; }
.iw-attach:empty { display: none; }
.iw-attach::-webkit-scrollbar { display: none; }
.iw-att, .source-chip {
  position: relative; flex: none; display: block; width: 58px; height: 72px; border-radius: 8px; overflow: hidden; background: var(--iw-surface-3); color: var(--iw-text-3);
  box-shadow: var(--iw-shadow-thumb); animation: iw-att-in var(--iw-dur-base) var(--iw-ease-spring) both; animation-delay: calc(var(--i, 0) * var(--iw-stagger-list));
  transition: box-shadow var(--iw-dur-fast), opacity var(--iw-dur-fast);
}
.source-chip[draggable="true"] { cursor: grab; }
.source-chip.is-dragging { opacity: .45; }
.source-chip .source-preview { width: 100%; height: 100%; object-fit: cover; display: block; }
.source-chip .source-icon { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; }
.source-chip .source-icon svg { width: 24px; height: 24px; }
.source-chip .source-index { position: absolute; left: 4px; top: 4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 5px; font: 650 11px/18px var(--iw-font-mono); text-align: center; color: #fff; background: var(--iw-accent); box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.source-chip .source-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.source-chip .source-remove { position: absolute; right: 3px; top: 3px; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; color: #fff; background: rgba(8, 9, 13, .72); opacity: 0; transition: opacity var(--iw-dur-fast); }
.source-chip .source-remove::after { content: ""; position: absolute; inset: -9px; }
.source-chip .source-move { position: absolute; left: 2px; right: 2px; bottom: 2px; display: flex; justify-content: space-between; opacity: 0; transition: opacity var(--iw-dur-fast); font-style: normal; }
.source-chip .source-move button { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; color: #fff; background: rgba(8, 9, 13, .72); }
.source-chip .source-move button:disabled { visibility: hidden; }
.source-chip:hover .source-remove, .source-chip:focus-within .source-remove, .source-chip:hover .source-move, .source-chip:focus-within .source-move { opacity: 1; }
@media (hover: none) { .source-chip .source-remove, .source-chip .source-move { opacity: 1; } }
.link-pill { flex: none; align-self: center; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 6px 0 10px; border-radius: 999px; font-size: 12.5px; color: var(--iw-text-2); background: var(--iw-surface-3); box-shadow: inset 0 0 0 1px var(--iw-line-2); max-width: 220px; }
.link-pill em { font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-pill svg { width: 14px; height: 14px; flex: none; }
.link-pill button { width: 24px; height: 24px; border-radius: 50%; color: var(--iw-text-3); font-size: 15px; line-height: 1; display: grid; place-items: center; }
.link-pill button:hover { background: var(--iw-surface-4); color: var(--iw-text-1); }

/* Como usar a referência */
.agent-edit-options[hidden] { display: none; }
.agent-edit-options { display: grid; gap: 8px; }
.iw-modes-label { font-size: 12.5px; color: var(--iw-text-2); padding: 2px 2px 0; display: flex; justify-content: space-between; align-items: center; }
.iw-modes-label .iw-link { min-height: 28px; }
.iw-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.iw-modes[hidden] { display: none; }
.iw-mode {
  display: grid; grid-template-columns: 28px 1fr; gap: 0 10px; align-items: center; min-height: 52px; padding: 8px 10px; border-radius: 12px; text-align: left;
  background: var(--iw-surface-1); box-shadow: inset 0 0 0 1px var(--iw-line-2); transition: box-shadow var(--iw-dur-fast), background var(--iw-dur-fast); color: var(--iw-text-1);
}
.iw-mode:hover { background: var(--iw-surface-3); }
.iw-mode-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; grid-row: span 2; color: var(--iw-text-2); background: var(--iw-surface-3); }
.iw-mode b { font-size: 12.5px; font-weight: 600; line-height: 16px; }
.iw-mode small { font-size: 11.5px; line-height: 15px; color: var(--iw-text-3); }
.iw-mode[aria-checked="true"] { background: var(--iw-accent-soft); box-shadow: inset 0 0 0 1.5px var(--iw-accent-text); }
.iw-mode[aria-checked="true"] .iw-mode-ico { color: #fff; background: var(--iw-accent); }
@keyframes iw-att-in { from { opacity: 0; transform: translateY(calc(var(--iw-move) * 8px)) scale(calc(1 - var(--iw-move) * .1)); } to { opacity: 1; transform: none; } }

/* Soltar arquivos em qualquer ponto do painel */
.dock-drop { display: none; position: absolute; inset: 0; z-index: 5; place-items: center; text-align: center; padding: 24px; background: color-mix(in oklab, var(--iw-surface-1) 88%, transparent); backdrop-filter: blur(6px); box-shadow: inset 0 0 0 2px var(--iw-accent-text); }
.dock-drop > div { display: grid; gap: 6px; justify-items: center; color: var(--iw-accent-text); }
.dock-drop b { font-size: 15px; }
.dock-drop span { font-size: 13px; color: var(--iw-text-2); }
.agent-dock.is-dropping .dock-drop { display: grid; }

/* ======================================================================
   Posição: acoplado (grade), gaveta (< 1024) e folha inferior (< 700)
   ====================================================================== */
.iw-editor[data-agent-mode="overlay"] > .agent-dock, .iw-editor[data-agent-mode="sheet"] > .agent-dock {
  grid-column: 1 / -1; grid-row: 1; position: absolute; z-index: var(--iw-z-popover); top: 0; right: 0; bottom: 0; height: auto; width: var(--agent-w); max-width: 100%; box-shadow: var(--iw-shadow-3);
  animation: iw-sheet-in var(--iw-dur-panel) var(--iw-ease-out) both;
}
@keyframes iw-sheet-in { from { opacity: .4; transform: translateX(calc(var(--iw-move) * 28px)); } to { opacity: 1; transform: none; } }
.iw-editor[data-agent-mode="sheet"] > .agent-dock {
  left: var(--iw-rail-w); width: auto; top: 12dvh; border-radius: 22px 22px 0 0; border-left: 0; box-shadow: 0 -1px 0 var(--iw-line-2), 0 -24px 60px -20px rgba(0, 0, 0, .8);
  animation-name: iw-sheet-up;
}
@keyframes iw-sheet-up { from { opacity: .4; transform: translateY(calc(var(--iw-move) * 36px)); } to { opacity: 1; transform: none; } }
.iw-editor[data-agent-mode="sheet"] .iw-resizer { display: none; }
.iw-editor[data-agent-mode="sheet"] .iw-agent-head { border-radius: 22px 22px 0 0; }
.iw-editor[data-agent-mode="sheet"] .iw-pages { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 76px; overflow-x: auto; scrollbar-width: none; padding: 5px; margin: -5px; }
.iw-editor[data-agent-mode="sheet"] .iw-quick { flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px; padding: 0 14px; scrollbar-width: none; }
.iw-editor[data-agent-mode="sheet"] .iw-qa { flex: none; }
.iw-editor[data-agent-mode="sheet"] .iw-suggest { grid-template-columns: 1fr; }
.iw-editor[data-agent-mode="sheet"] .iw-modes { grid-template-columns: 1fr; }
@media (max-width: 460px) { .iw-modes { grid-template-columns: 1fr; } .iw-suggest { grid-template-columns: 1fr; } .iw-composer-hint span:last-child { display: none; } }
.iw-editor.agent-focus .iw-thread-inner { max-width: 760px; }
@media (prefers-reduced-motion: reduce) {
  .turn.is-new, .iw-editor[data-agent-mode="overlay"] > .agent-dock, .iw-editor[data-agent-mode="sheet"] > .agent-dock { animation: none; }
  .iw-reveal { animation: none; }
}
