/* Enterprise chat presentation. Pinned composer/bubble exports remain unchanged. */
body[data-view="chat"] #application {
  --page: #fafafa;
  --surface: #fff;
  --ink: #25262a;
  --muted: #686b74;
  --line: #e7e7eb;
  --soft: #f0f0f3;
  --placeholder: #70727c;
  background: var(--page);
  color: var(--ink);

  .page-heading { display: none; }
  #panel { height: calc(100dvh - 50px); min-height: 0; }
  .enterprise-chat { display: flex; flex-direction: column; isolation: isolate; min-height: 0; overflow: hidden; }
  .chat-toolbar { display: flex; flex: 0 0 auto; min-height: 76px; justify-content: space-between; align-items: center; gap: 16px; border: 0; padding: 16px 32px; z-index: 2; }
  .chat-context { display: flex; flex-direction: column; min-width: 0; gap: 5px; }
  .chat-context-title { font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-context-detail { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
  .chat-toolbar-actions { display: flex; flex-shrink: 0; gap: 6px; }
  .chat-toolbar-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; min-width: 40px; background: transparent; border: 1px solid transparent; border-radius: 12px; padding: 9px 12px; color: var(--muted); font-size: 12px; }
  .chat-toolbar-actions button:hover:not(:disabled) { background: var(--soft); color: var(--ink); }
  .chat-toolbar-actions button:disabled { opacity: .4; cursor: default; }
  .chat-scroll { flex: 1 1 auto; min-height: 0; padding: 12px clamp(20px,4vw,48px) 28px; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: var(--line) transparent; scrollbar-gutter: stable; scroll-padding-block: 24px; overflow-anchor: none; }
  .chat-messages { width: 100%; max-width: 760px; margin: 12px auto 0; display: flex; flex-direction: column; gap: 36px; flex-shrink: 0; }
  .ivi-message-row { min-width: 0; }
  .ivi-message-row.assistant [data-slot="ivi-chat-bubble"] { max-width: none; }
  .ivi-message-row.assistant [data-slot="ivi-chat-bubble"] > div { color: var(--ink); font-size: 15px; line-height: 1.85; }
  .ivi-message-row.user [data-slot="ivi-chat-bubble"] > div { max-width: min(85%,600px); background: var(--soft); color: var(--ink); padding: 12px 18px; border-radius: 20px 20px 6px 20px; font-size: 14px; line-height: 1.65; box-shadow: none; }
  .ivi-message-content { overflow-wrap: anywhere; }
  .ivi-message-content p { margin: .85em 0; }
  .ivi-message-content strong { font-weight: 600; }
  .ivi-message-content :is(h1,h2,h3,h4) { margin: 1.8em 0 .65em; font-weight: 600; line-height: 1.4; letter-spacing: -.025em; color: var(--ink); }
  .ivi-message-content h1 { font-size: 1.35em; }
  .ivi-message-content h2 { font-size: 1.2em; }
  .ivi-message-content :is(h3,h4) { font-size: 1.08em; }
  .ivi-message-content > :first-child { margin-top: 0; }
  .ivi-message-content > :last-child { margin-bottom: 0; }
  .ivi-message-content :is(ul,ol) { padding-left: 1.4em; margin: .9em 0 1.3em; }
  .ivi-message-content li { margin: .5em 0; padding-left: .25em; }
  .ivi-message-content li::marker { color: var(--muted); font-size: .9em; }
  .ivi-message-content hr { height: 1px; border: 0; background: var(--line); margin: 28px 0; }
  .ivi-message-content blockquote { border-left: 2px solid var(--line); color: var(--muted); padding: 2px 18px; margin: 22px 0; }
  .ivi-message-content pre { border: 1px solid var(--line); background: var(--soft); padding: 18px 20px; border-radius: 14px; font-size: 13px; line-height: 1.75; }
  .ivi-message-content :not(pre) > code { padding: 2px 5px; background: var(--soft); border-radius: 5px; font-size: .9em; }
  .ivi-message-content table { border: 1px solid var(--line); border-radius: 12px; font-size: 13px; }
  .ivi-message-content th { background: var(--soft); }
  .ivi-message-content :is(th,td) { padding: 12px 16px; }
  .ivi-message-content a { text-decoration-color: color-mix(in srgb,var(--accent) 35%,transparent); text-underline-offset: 4px; }
  .message-actions { margin-top: 16px; }
  .message-actions button { display: inline-flex; gap: 7px; padding: 8px 10px; min-height: 36px; border-radius: 9px; color: var(--muted); font-size: 11px; background: transparent; }
  .message-actions button:hover { background: var(--soft); color: var(--ink); }
  .composer-dock { position: relative; inset: auto; flex: 0 0 auto; padding: 12px clamp(20px,4vw,48px) max(16px,env(safe-area-inset-bottom)); background: var(--page); pointer-events: auto; z-index: 3; }
  .composer-row { max-width: 800px; width: 100%; margin: 0 auto; gap: 0; }
  .enterprise-composer { min-height: 0; display: flex; flex-direction: column; padding: 10px 16px 8px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: 0 4px 24px #20212a06; justify-content: flex-start; transition: border-color 180ms, box-shadow 180ms; }
  .enterprise-composer:focus-within { border-color: color-mix(in srgb,var(--muted) 50%,var(--line)); border-radius: 24px; outline: none; box-shadow: 0 4px 24px #20212a0a; }
  .enterprise-composer textarea { color: var(--ink); font-size: 15px; line-height: 1.6; padding: 8px 4px; min-height: 40px; max-height: min(160px,25dvh); border: 0; background: transparent; outline: none; box-shadow: none; }
  .enterprise-composer > div { position: static; inset: auto; transform: none; padding-top: 6px; pointer-events: auto; }
  .enterprise-composer > div button { pointer-events: auto; }
  .enterprise-composer button[aria-label="Conversar por voz"], .enterprise-composer button[aria-label="Enviar"] { width: 40px; height: 40px; min-width: 40px; min-height: 40px; color: white; background: var(--accent); box-shadow: none; }
  .enterprise-composer button[aria-label="Anexar"], .enterprise-composer button[aria-label^="Ditar por voz"] { color: var(--muted); }
  .chat-composer-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 780px; margin: 10px auto 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
  .chat-character-count { white-space: nowrap; font-variant-numeric: tabular-nums; }
  .chat-status { color: var(--muted); font-size: 10px; line-height: 1.5; text-align: center; margin: 8px 0 0; }
  .chat-return { display: flex; justify-content: center; margin: -4px 0 12px; }
  .chat-return button { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: var(--surface); box-shadow: 0 3px 12px #00000005; font-size: 11px; }
  .chat-thinking { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 13px; color: var(--muted); }
  .chat-thinking-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: color-mix(in srgb,var(--accent) 8%,var(--surface)); color: var(--accent); }
  .chat-thinking-dots { display: inline-flex; gap: 3px; margin-left: 7px; vertical-align: middle; }
  .chat-thinking-dots i { width: 3px; height: 3px; background: currentColor; border-radius: 50%; }
  .chat-send-error { padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--muted); font-size: 13px; line-height: 1.65; }
  .chat-send-error strong { color: var(--ink); font-weight: 550; }
  .chat-send-error p { margin-top: 6px; }
  .chat-send-error button { margin-top: 12px; border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; background: var(--soft); color: var(--ink); }
  .older-messages { font-size: 12px; color: var(--muted); background: var(--surface); margin-bottom: 24px; }
  :is(button,a,summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
  .chat-scroll:focus-visible { outline: 1px solid var(--line); outline-offset: -2px; }
  .enterprise-hero { min-height: 300px; padding: 0 0 24px; }
  .business-greeting { font-size: clamp(28px,3.2vw,40px); }
  .business-greeting strong { font-weight: 550; }
  .business-actions { max-width: 800px; gap: 12px; margin-top: 32px; }
  .business-actions button { min-height: 112px; padding: 18px 16px; border-radius: 18px; background: color-mix(in srgb,var(--surface) 88%,transparent); }
  .business-actions button span { font-size: 13px; }
  .business-actions small { font-size: 11px; line-height: 1.6; }
  .business-actions .action-chevron { display: none; }
  .business-actions button span,.business-actions small { padding-right: 0; }
  .motion-control { top: 90px; bottom: auto; right: 24px; width: 28px; height: 28px; opacity: .65; }
  .aurora-field { pointer-events: none; opacity: .42; }
}
:root[data-theme="dark"] body[data-view="chat"] #application {
  --page: #111214; --surface: #1b1c1f; --ink: #e8e9ed; --muted: #93959e; --line: #303137; --soft: #24252a; --placeholder: #93959e;
}
body[data-view="chat"] .disclaimer { bottom: 7px; right: 28px; }
.chat-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
body[data-view="chat"] .conversation-history header { padding: 0 0 16px; border: 0; }
body[data-view="chat"] .conversation-history button { color: var(--ink); background: transparent; }
body[data-view="chat"] .conversation-history button:hover { background: var(--soft); }
body[data-view="chat"] .conversation-history .new-conversation { background: var(--soft); }
@media (min-width: 768px) and (max-width: 1100px) {
  body[data-view="chat"] #application #panel { height: calc(100dvh - 26px); }
}
@media (max-width: 1000px) {
  body[data-view="chat"] #application .business-actions { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 767px) {
  body[data-view="chat"] #application {
    #panel { height: calc(100dvh - 44px - env(safe-area-inset-top,0px)); min-height: 0; }
    .chat-toolbar { min-height: 52px; padding: 8px 16px; }
    .chat-context-title { max-width: 180px; font-size: 12px; }
    .chat-context-detail { font-size: 10px; }
    .chat-toolbar-actions { gap: 4px; }
    .chat-toolbar-actions button { padding: 10px; min-height: 40px; }
    .chat-toolbar-actions button span { display: none; }
    .chat-scroll { padding: 16px 20px 24px; }
    .chat-messages { margin-top: 0; gap: 30px; }
    .ivi-message-row.assistant [data-slot="ivi-chat-bubble"] > div { font-size: 15px; line-height: 1.8; }
    .ivi-message-row.user [data-slot="ivi-chat-bubble"] > div { font-size: 14px; padding: 10px 15px; }
    .message-actions button { min-height: 44px; }
    .composer-dock { padding: 8px 12px max(10px,env(safe-area-inset-bottom)); }
    .enterprise-composer { border-radius: 22px; padding: 6px 12px; }
    .enterprise-composer:focus-within { border-radius: 22px; }
    .enterprise-composer textarea { font-size: 16px; min-height: 38px; }
    .enterprise-composer > div { padding-top: 0; }
    .chat-composer-meta { font-size: 9px; margin: 8px 8px 0; }
    .chat-status { font-size: 9px; margin-top: 5px; }
    .enterprise-hero { min-height: 260px; padding-bottom: 20px; }
    .chat-return { margin-bottom: 8px; }
  }
}
@media (max-height: 650px) {
  body[data-view="chat"] #application {
    .chat-toolbar { min-height: 48px; padding-block: 6px; }
    .chat-composer-meta { display: none; }
    .composer-dock { padding-top: 6px; padding-bottom: 8px; }
    .enterprise-composer textarea { max-height: 80px; }
    .ivi-home-presence { height: 100px; }
  }
}
@media (prefers-reduced-motion: no-preference) {
  body[data-view="chat"] .chat-thinking-dots i { animation: chat-dot 1.4s ease-in-out infinite; }
  body[data-view="chat"] .chat-thinking-dots i:nth-child(2) { animation-delay: 150ms; }
  body[data-view="chat"] .chat-thinking-dots i:nth-child(3) { animation-delay: 300ms; }
  body[data-view="chat"] .chat-return { animation: chat-control-arrive 160ms ease-out both; }
}
@keyframes chat-dot { 0%,70%,100% { opacity: .3; } 35% { opacity: 1; } }
@keyframes chat-control-arrive { from { opacity: 0; translate: 0 4px; } to { opacity: 1; translate: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  body[data-view="chat"] #application :is(button,.enterprise-composer) { transition: none; }
}
@media (min-width: 768px) {
  body[data-view="chat"] .ivi-sidebar { overflow: hidden; gap: 16px; }
  body[data-view="chat"] .ivi-sidebar > :is(.sidebar-brand,.workspace,.sidebar-footer) { flex-shrink: 0; }
  body[data-view="chat"] .ivi-sidebar nav { flex: 1; min-height: 0; overflow-y: auto; gap: 4px; scrollbar-width: thin; }
  body[data-view="chat"] .ivi-sidebar nav button { min-height: 44px; padding-block: 10px; flex-shrink: 0; }
  body[data-view="chat"] .sidebar-footer { padding-top: 8px; }
}
