/* ── Variáveis: alias para css/style.css (tema único com o app) ── */
:root {
  --ai-bg: var(--bg);
  --ai-card: var(--surface);
  --ai-card-hover: var(--surface2);
  --ai-border: var(--border);
  --ai-text: var(--text);
  --ai-muted: var(--muted);
  --ai-accent: var(--accent);
  --ai-accent-dark: var(--accent-dark);
  --ai-accent-dim: var(--accent-dim);
  --ai-accent-glow: var(--accent-glow);
  --ai-green: var(--green);
  --ai-radius: 24px;
  --ai-radius-sm: 14px;
  --ai-shadow-sm: var(--shadow-xs);
  --ai-shadow: var(--shadow);
  --ai-shadow-lg: var(--shadow-lg);
  --ai-glass: color-mix(in srgb, var(--surface) 78%, transparent);
  --ai-glass-border: color-mix(in srgb, var(--border) 65%, transparent);
  --ai-bubble-user-radius: 1.25rem 1.25rem 0.25rem 1.25rem;
  --ai-bubble-ai-radius: 1.25rem 1.25rem 1.25rem 0.25rem;
  --ai-card-radius-v2: 14px;
  --ai-input-radius: 999px;
  --ai-header-glass: rgba(255, 255, 255, 0.7);
  --ai-header-blur: 40px;
  --ai-chip-bg: color-mix(in srgb, var(--ai-accent) 10%, transparent);
  --ai-chip-text: var(--ai-accent-dark);
}

@supports not (color: color-mix(in srgb, white, black)) {
  :root {
    --ai-glass: rgba(255, 255, 255, 0.78);
    --ai-glass-border: rgba(225, 231, 240, 0.85);
  }
}

[data-theme="dark"] {
  --ai-bg: var(--bg);
  --ai-card: var(--surface);
  --ai-card-hover: var(--surface2);
  --ai-border: var(--border);
  --ai-text: var(--text);
  --ai-muted: var(--muted);
  --ai-glass: color-mix(in srgb, var(--surface) 82%, transparent);
  --ai-glass-border: rgba(255, 255, 255, 0.1);
  --ai-header-glass: rgba(17, 24, 39, 0.75);
}

@supports not (color: color-mix(in srgb, white, black)) {
  [data-theme="dark"] {
    --ai-glass: rgba(17, 24, 39, 0.88);
    --ai-glass-border: rgba(255, 255, 255, 0.1);
  }
}

/* ── Stitch Design Reference (COTTE): tipografia e superfícies no escopo da página ── */
.page-assistente-ia {
  --stitch-primary: #004e5c;
  --stitch-primary-container: #00687a;
  --stitch-surface: #f7fafe;
  --stitch-surface-low: #f1f4f8;
  --stitch-on-surface: #181c1f;
  --stitch-on-variant: #3f484b;
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
}

.page-assistente-ia .ai-hero-title,
.page-assistente-ia .wpp-title,
.page-assistente-ia .suggestion-group-title,
.page-assistente-ia .assistente-preferencias-header h2,
.page-assistente-ia .chat-header-name {
  font-family:
    "Plus Jakarta Sans",
    "Inter",
    system-ui,
    sans-serif;
}

.page-assistente-ia .page-title {
  font-family: "Outfit", sans-serif;
}

.page-assistente-ia .page-sub {
  font-family: "DM Sans", sans-serif;
}

html:not([data-theme="dark"]) .page-assistente-ia {
  --ai-bg: var(--stitch-surface);
  --ai-card: #ffffff;
  --ai-card-hover: var(--stitch-surface-low);
  --ai-text: var(--stitch-on-surface);
  --ai-muted: var(--stitch-on-variant);
}

@supports (color: color-mix(in srgb, white, black)) {
  html:not([data-theme="dark"]) .page-assistente-ia {
    --ai-glass: color-mix(in srgb, #ffffff 82%, var(--stitch-surface) 18%);
    --ai-glass-border: color-mix(in srgb, #6f797c 14%, transparent);
  }
}

.ai-assistant-container {
  max-width: none !important;
  width: 100% !important;
  margin: 0;
  padding: 0;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100%;
  flex: 1;
  position: relative;
  box-sizing: border-box !important;
}

/* Hero + chat: miolo substituível por telas de bloqueio (mantém header com engrenagem no embed) */
#aiAssistantMainSlot {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100% !important;
  max-width: none !important;
  box-sizing: border-box !important;
}

/* ── Hero (Glassmorphism + Stitch surfaces) ─────────────────── */
.ai-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--ai-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--ai-glass-border);
  border-radius: 1.5rem;
  padding: 22px 26px;
  margin: 20px;
  box-shadow: 0 28px 48px -16px rgba(24, 28, 31, 0.07);
  transition:
    box-shadow 0.3s ease,
    transform 0.3s ease;
}

.ai-hero:hover {
  box-shadow: 0 32px 56px -18px rgba(0, 78, 92, 0.1);
  transform: translateY(-2px);
}

.ai-hero-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(
    135deg,
    var(--ai-accent) 0%,
    var(--ai-accent-dark) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 8px 16px var(--ai-accent-glow);
}

.ai-hero-icon svg {
  width: 24px;
  height: 24px;
  stroke: white;
  fill: none;
}

.ai-hero-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ai-text);
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.ai-hero-sub {
  font-size: 0.85rem;
  color: var(--ai-muted);
  margin: 2px 0 0;
}

.pref-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  z-index: 299;
  animation: fadeIn 0.2s ease;
}

.pref-backdrop.is-open {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.assistente-preferencias-card {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin-top: 0;
  background: var(--ai-card);
  border: 1px solid var(--ai-border);
  border-radius: 16px;
  padding: 0;
  width: min(680px, calc(100% - 40px));
  max-height: 88dvh;
  overflow: hidden;
  flex-direction: column;
  z-index: 300;
  box-shadow: var(--ai-shadow-lg);
}

.assistente-preferencias-card.is-open {
  display: flex;
  animation: prefModalIn 0.22s cubic-bezier(0.2, 0.9, 0.2, 1);
}

@keyframes prefModalIn {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 10px)) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.topbar-gear-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  flex-shrink: 0;
  transition:
    background 0.2s,
    border-color 0.2s;
}

/* Indicador discreto: há preferências personalizadas salvas (formato ≠ auto ou instruções) */
.assistente-gear-saved-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ai-green);
  box-shadow: 0 0 0 2px var(--surface);
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.assistente-gear-saved-badge.is-visible {
  opacity: 1;
  transform: scale(1);
}

.assistente-gear-saved-badge--on-header {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.92);
}

.topbar-gear-btn:hover {
  background: var(--surface2);
  border-color: var(--accent);
}

.assistente-preferencias-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--ai-border);
  flex-shrink: 0;
}

.assistente-preferencias-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.assistente-preferencias-header-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--ai-chip-bg);
  color: var(--ai-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.assistente-preferencias-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.assistente-preferencias-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--ai-border);
  background: var(--ai-bg);
  color: var(--ai-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.assistente-preferencias-close:hover {
  color: var(--ai-text);
  border-color: var(--ai-accent);
}

.assistente-preferencias-header h2 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ai-text);
}

.assistente-preferencias-header p {
  margin: 3px 0 0;
  font-size: 0.77rem;
  color: var(--ai-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

/* ── Modal Preferências v2: Abas ── */

.assistente-pref-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 16px;
  background: var(--ai-bg);
  border-bottom: 1px solid var(--ai-border);
  flex-shrink: 0;
}

.assistente-pref-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ai-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  min-height: 36px;
  white-space: nowrap;
}

.assistente-pref-tab-btn:hover {
  background: var(--ai-card-hover);
  color: var(--ai-text);
}

.assistente-pref-tab-btn.active {
  background: var(--ai-chip-bg);
  color: var(--ai-accent-dark);
  border-color: color-mix(in srgb, var(--ai-accent) 25%, transparent);
  font-weight: 600;
}

/* ── Painéis de conteúdo ── */

.assistente-pref-panel {
  display: none;
  overflow-y: auto;
  padding: 16px;
  flex: 1;
  min-height: 0;
}

.assistente-pref-panel.active {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Cards de seção ── */

.pref-section-card {
  background: color-mix(in srgb, var(--ai-bg) 60%, var(--ai-card) 40%);
  border: 1px solid var(--ai-border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pref-section-card-title {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ai-muted);
}

.pref-hint {
  font-size: 0.74rem;
  color: var(--ai-muted);
  display: block;
  margin-top: 2px;
}

/* ── Ações do painel de preferências ── */

.assistente-preferencias-actions {
  margin-top: auto;
  padding-top: 4px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.assistente-preferencias-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ── Editor de prompts: layout melhorado ── */

.assistente-prompts-editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.assistente-prompts-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.assistente-prompts-editor h4 {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Prompts: biblioteca sem borda superior extra (dentro do panel) */
.assistente-pref-panel .assistente-prompts-library {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.assistente-preferencias-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  color: var(--ai-muted);
  background: color-mix(in srgb, var(--ai-card-hover) 80%, var(--ai-bg) 20%);
}

.assistente-preferencias-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.assistente-preferencias-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.assistente-preferencias-field span {
  font-size: 0.78rem;
  color: var(--ai-muted);
}

.assistente-preferencias-field select,
.assistente-preferencias-field input,
.assistente-preferencias-field textarea {
  width: 100%;
  border: 1px solid var(--ai-border);
  border-radius: 10px;
  background: var(--ai-bg);
  color: var(--ai-text);
  padding: 9px 10px;
  font-size: 0.84rem;
}

.assistente-preferencias-field textarea {
  resize: vertical;
  min-height: 74px;
}

/* .assistente-preferencias-actions: definida acima na seção v2 */
.assistente-preferencias-actions small {
  color: var(--ai-muted);
  font-size: 0.75rem;
}

.assistente-prompts-library {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed color-mix(in srgb, var(--ai-border) 70%, transparent 30%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.assistente-prompts-library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.assistente-prompts-library-header h3 {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ai-text);
}

.assistente-prompts-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.assistente-prompts-list {
  max-height: 220px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.assistente-prompt-item {
  border: 1px solid var(--ai-border);
  border-radius: 10px;
  padding: 10px;
  background: color-mix(in srgb, var(--ai-card) 88%, var(--ai-bg) 12%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.assistente-prompt-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.assistente-prompt-item-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ai-text);
}

.assistente-prompt-item-chip {
  font-size: 0.68rem;
  color: var(--ai-muted);
  background: var(--ai-bg);
  border-radius: 999px;
  padding: 3px 8px;
}

.assistente-prompt-item-body {
  margin: 0;
  font-size: 0.77rem;
  color: var(--ai-text);
  line-height: 1.45;
}

.assistente-prompt-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.assistente-prompt-item-footer small {
  color: var(--ai-muted);
  font-size: 0.7rem;
}

.assistente-prompt-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ── Responsivo: Modal como bottom sheet em mobile ── */

@media (max-width: 520px) {
  .assistente-preferencias-card,
  .assistente-preferencias-card.is-open {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-height: 92dvh;
    border-radius: 20px 20px 0 0;
  }

  @keyframes prefModalIn {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .assistente-preferencias-header p {
    max-width: 180px;
  }

  .assistente-pref-tabs {
    padding: 8px 12px;
  }

  .assistente-pref-panel {
    padding: 12px;
  }

  .assistente-prompts-editor-grid {
    grid-template-columns: 1fr;
  }

  .assistente-prompts-editor-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .assistente-prompts-editor-actions {
    align-self: flex-end;
  }
}

@media (max-width: 360px) {
  .assistente-pref-tab-btn {
    font-size: 0.78rem;
    padding: 6px 10px;
  }
}

.assistente-prompts-load-more-wrap {
  display: flex;
  justify-content: center;
}

.assistente-prompt-empty {
  font-size: 0.78rem;
  color: var(--ai-muted);
  padding: 8px;
  text-align: center;
}

.assistente-prompts-editor {
  border: 1px solid var(--ai-border);
  border-radius: 10px;
  padding: 10px;
  background: color-mix(in srgb, var(--ai-bg) 92%, var(--ai-card) 8%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.assistente-prompts-editor h4 {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ai-text);
}

.assistente-prompts-favorite-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--ai-muted);
}

.assistente-prompts-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Toggles de módulos ativos ── */

.pref-modulos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pref-modulo-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--ai-border);
  border-radius: 10px;
  background: var(--ai-bg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.pref-modulo-toggle:hover {
  border-color: var(--ai-accent);
}

.pref-modulo-toggle.is-off {
  opacity: 0.55;
}

.pref-modulo-toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pref-modulo-toggle-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ai-text);
}

.pref-modulo-toggle-status {
  font-size: 0.7rem;
  color: var(--ai-muted);
}

.pref-modulo-checkbox {
  width: 40px;
  height: 22px;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: var(--ai-accent);
}

@media (max-width: 520px) {
  .pref-modulos-grid {
    grid-template-columns: 1fr;
  }
}

.btn-xs {
  padding: 5px 8px;
  font-size: 0.72rem;
}

.btn-danger-text {
  color: #ef4444;
}

.ai-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ai-green);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 20px;
  padding: 6px 14px;
  white-space: nowrap;
}

.ai-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ai-green);
  animation: status-pulse 2s ease-in-out infinite;
}

@keyframes status-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(0.9);
  }
}

/* ── Categories & Suggestions ────────────────────────────────── */
.suggestions-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}

.suggestion-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.suggestion-group-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ai-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-left: 4px;
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

/* Menu de Ações Stitch: linhas em superfície baixa, sem borda dura */
.shortcut {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--stitch-surface-low, var(--ai-card-hover));
  border: 1px solid transparent;
  border-radius: 1rem;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
  text-align: left;
  color: var(--ai-text);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(24, 28, 31, 0.04);
}

html:not([data-theme="dark"]) .shortcut {
  background: var(--stitch-surface-low);
}

.shortcut:hover {
  border-color: rgba(0, 104, 122, 0.2);
  background: #effdff;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px -8px rgba(0, 78, 92, 0.12);
}

@supports (color: color-mix(in srgb, white, black)) {
  html:not([data-theme="dark"]) .shortcut:hover {
    border-color: color-mix(in srgb, var(--stitch-primary-container, var(--ai-accent)) 22%, transparent);
    background: color-mix(in srgb, var(--stitch-surface-low) 65%, #ecfeff 35%);
  }
}

.shortcut-icon {
  font-size: 1.25rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 104, 122, 0.12);
  border-radius: 0.75rem;
  flex-shrink: 0;
}

@supports (color: color-mix(in srgb, white, black)) {
  .shortcut-icon {
    background: color-mix(
      in srgb,
      var(--stitch-primary-container, var(--ai-accent)) 20%,
      transparent
    );
  }
}

[data-theme="dark"] .shortcut {
  background: var(--ai-card-hover);
  box-shadow: none;
}

[data-theme="dark"] .shortcut:hover {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.28);
}

.shortcut-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ai-text);
  line-height: 1.4;
}

/* ── Chat Container ────────────────────────────────────────────── */
.chat-container {
  background: var(--ai-card);
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  position: relative;
  width: 100% !important;
  max-width: none !important;
  box-sizing: border-box !important;
  background-image: none;
}

@supports not (color: color-mix(in srgb, white, black)) {
  .chat-container {
    border: none;
    box-shadow: none;
  }
}

.chat-header {
  display: none;
}

.chat-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.chat-header-info {
  min-width: 0;
}

.chat-header-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-header-status {
  width: fit-content;
  max-width: 100%;
}

.chat-header-gear-btn {
  position: relative;
}

.embed-assistant-toolbar {
  display: none;
}

.embed-context-bar {
  display: flex;
}

.embed-context-bar {
  align-items: center;
  gap: 10px;
  padding: 7px 14px 8px;
  background: color-mix(in srgb, var(--ai-card) 98%, var(--ai-bg) 2%);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.embed-context-bar__label {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ai-accent-dim) 54%, white 46%);
  color: var(--ai-accent-dark);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.embed-context-bar__content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  white-space: nowrap;
}

.embed-context-bar__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.embed-context-bar__action {
  border: 1px solid color-mix(in srgb, var(--ai-accent) 24%, transparent);
  background: white;
  color: var(--ai-text);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 9px;
  cursor: pointer;
}

.embed-context-bar__action--clear {
  border-color: color-mix(in srgb, #ef4444 26%, transparent);
  color: #b91c1c;
}

.embed-context-bar__primary,
.embed-context-bar__secondary {
  overflow: hidden;
  text-overflow: ellipsis;
}

.embed-context-bar__primary {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--ai-text);
}

.embed-context-bar__secondary {
  font-size: 0.68rem;
  color: var(--ai-muted);
}

.embed-context-bar__secondary:empty {
  display: none;
}

.embed-context-bar__secondary:not(:empty)::before {
  content: "•";
  margin-right: 6px;
  color: color-mix(in srgb, var(--ai-muted) 70%, transparent);
}

.embed-assistant-toolbar-btn,
.embed-assistant-toolbar-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.embed-assistant-toolbar-btn {
  border: none;
  cursor: pointer;
}

.assistente-blocked-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: clamp(320px, 52vh, 520px);
  padding: 28px 24px;
  text-align: center;
  background: var(--ai-card);
  border: 1px solid var(--ai-border);
  border-radius: var(--ai-radius);
  box-shadow: var(--ai-shadow-sm);
}

.assistente-blocked-state__icon {
  font-size: 2.9rem;
  line-height: 1;
}

.assistente-blocked-state__title {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ai-text);
}

.assistente-blocked-state__text {
  margin: 0;
  max-width: 34ch;
  color: var(--ai-muted);
  line-height: 1.55;
}

.assistente-blocked-state__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.chat-messages {
  flex-grow: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
  width: 100% !important;
  max-width: none !important;
  box-sizing: border-box !important;
}

[data-theme="dark"] .chat-messages {
  background: var(--ai-card);
}

.chat-messages::-webkit-scrollbar {
  width: 5px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--ai-border);
  border-radius: 10px;
}

.message {
  display: flex;
  flex-direction: column;
  margin-bottom: 8px;
  animation: fadeUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.message.user {
  align-items: flex-end;
}
.message.ai {
  align-items: flex-start;
}

.message-bubble {
  display: inline-block;
  max-width: 82%;
  padding: 14px 18px 9px;
  border-radius: 20px;
  font-size: 0.9rem;
  line-height: 1.55;
  position: relative;
  word-break: normal;
  overflow-wrap: anywhere;
  box-shadow: var(--ai-shadow-sm);
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

/* Usuário: pílula alinhada ao Chat v2 Stitch (primary-container → primary) */
.message.user .message-bubble {
  background: var(--stitch-primary-container, var(--ai-accent));
  color: #fff;
  border: none;
  padding: 14px 22px 10px 18px;
  border-radius: var(--ai-bubble-user-radius);
  letter-spacing: 0.01em;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 4px 20px -4px rgba(0, 78, 92, 0.18),
    0 12px 28px -12px rgba(15, 23, 42, 0.15);
}

/* IA: cartão claro com sombra suave (Chat v2 Stitch) */
.message.ai .message-bubble {
  overflow: visible;
  color: var(--ai-text);
  border: none;
  padding: 16px 20px 12px 22px;
  border-radius: var(--ai-bubble-ai-radius);
  letter-spacing: 0.01em;
  background: color-mix(in srgb, var(--ai-card) 94%, var(--ai-bg) 6%);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}

/* Tabelas dentro do bubble podem expandir */
.message.ai .message-bubble .ai-table-wrapper {
  max-width: calc(82vw - 44px);
  width: max-content;
  min-width: 100%;
}

/* Lista de clientes dentro do bubble: largura total da tabela */
.message.ai .message-bubble .orc-list-card {
  max-width: none;
  width: max-content;
}

/* Texto da mensagem IA mantém overflow hidden para não vazar */
.message.ai .message-bubble > p,
.message.ai .message-bubble > div:not(.orc-list-card):not(.ai-table-wrapper):not(.semantic-printable-card) {
  overflow: hidden;
}

.message.ai .message-bubble::before {
  display: none;
}

[data-theme="dark"] .message.ai .message-bubble {
  background: var(--ai-card-hover);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}

/* Hora como caption (tabular-nums), fora do “peso” visual do corpo */
.message-bubble::after {
  content: attr(data-time);
  display: block;
  font-size: 0.65rem;
  margin-top: 7px;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  opacity: 0.55;
}

.message.ai .message-bubble::after {
  color: var(--ai-muted);
  text-align: left;
  padding-left: 1px;
}

.message.user .message-bubble::after {
  color: rgba(255, 255, 255, 0.88);
  text-align: right;
  opacity: 0.72;
}

/* ── Welcome ────────────────────────────────────────────────────── */
.welcome-msg {
  background: var(--stitch-surface-low, var(--ai-bg));
  border: 1px solid color-mix(in srgb, var(--ai-border) 35%, transparent);
  border-radius: 1.25rem;
  border-bottom-left-radius: 0.35rem;
  padding: 24px;
  max-width: none !important;
  width: 100% !important;
  box-sizing: border-box !important;
  box-shadow: 0 4px 24px -8px rgba(0, 78, 92, 0.07);
}

@supports not (color: color-mix(in srgb, white, black)) {
  .welcome-msg {
    border: 1px solid var(--ai-border);
  }
}

html:not([data-theme="dark"]) .welcome-msg {
  background: var(--stitch-surface-low);
}

[data-theme="dark"] .welcome-msg {
  background: var(--ai-card-hover);
}

.wpp-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ai-text);
  margin-bottom: 8px;
}

/* ── Loading Redesign ──────────────────────────────────────────── */
.loading-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 6px 10px;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  background: var(--ai-accent);
  border-radius: 50%;
  animation: typing-dots 1.4s infinite ease-in-out both;
  opacity: 0.4;
}

.loading-dots span:nth-child(1) {
  animation-delay: -0.32s;
}
.loading-dots span:nth-child(2) {
  animation-delay: -0.16s;
}
.loading-dots span:nth-child(3) {
  animation-delay: 0;
}

@keyframes typing-dots {
  0%,
  80%,
  100% {
    transform: scale(0.7);
    opacity: 0.4;
    box-shadow: none;
  }
  40% {
    transform: scale(1.1);
    opacity: 1;
    box-shadow: 0 0 6px var(--ai-accent-glow);
  }
}

.typing-indicator-text {
  font-size: 0.85rem;
  color: var(--ai-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
  animation: text-pulse 2s infinite ease-in-out;
  display: none;
}

@keyframes text-pulse {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

.ai-loading-row {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 10px;
  padding: 0;
}

.ai-loading-bubble {
  min-width: 220px !important;
  padding: 14px 16px 12px 16px !important;
  border-radius: 20px 22px 20px 14px !important;
  background: color-mix(in srgb, var(--ai-card) 96%, var(--ai-bg) 4%) !important;
  border: 1px solid color-mix(in srgb, var(--ai-border) 75%, transparent) !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08) !important;
}

[data-theme="dark"] .ai-loading-bubble {
  background: color-mix(in srgb, var(--ai-card-hover) 94%, var(--ai-bg) 6%) !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.24) !important;
  border-color: color-mix(in srgb, var(--ai-border) 70%, transparent) !important;
}

.message.loading .ai-loading-bubble {
  animation: none;
}

.ai-skeleton-line {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--ai-border) 26%, transparent) 0%,
    color-mix(in srgb, var(--ai-border) 46%, transparent) 50%,
    color-mix(in srgb, var(--ai-border) 26%, transparent) 100%
  );
  background-size: 220% 100%;
  animation: ai-skeleton-shimmer 1.2s linear infinite;
}

.ai-skeleton-line--w90 {
  width: 90%;
}

.ai-skeleton-line--w70 {
  width: 70%;
}

.ai-skeleton-line--w45 {
  width: 45%;
}

@keyframes ai-skeleton-shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -120% 0;
  }
}

/* ── Chat Input (Glass floating style) ─────────────────────────── */
.chat-input {
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--ai-bg) 92%, #fff 8%);
  border-top: 1px solid rgba(111, 121, 124, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: relative;
  z-index: 10;
}

[data-theme="dark"] .chat-input {
  background: color-mix(in srgb, var(--ai-bg) 96%, transparent);
  border-top-color: rgba(255, 255, 255, 0.06);
}

.input-wrapper {
  max-width: none !important;
  width: 100% !important;
  margin: 0 auto;
  position: relative;
  padding: 0 16px;
  box-sizing: border-box !important;
}

.input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 8px 6px 18px;
  background: var(--stitch-surface-low, var(--ai-card));
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html:not([data-theme="dark"]) .input-group {
  background: var(--stitch-surface-low);
}

.input-group:focus-within {
  border-color: rgba(0, 104, 122, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 0 0 3px rgba(0, 104, 122, 0.12);
  transform: none;
}

.input-group input,
.input-group textarea {
  flex: 1;
  padding: 12px 0;
  border: none;
  font-size: 1rem;
  font-family: inherit;
  background: transparent;
  color: var(--ai-text);
  outline: none;
}

.input-group input:focus,
.input-group textarea:focus {
  border-color: transparent !important;
  box-shadow: none !important;
}

.input-group textarea {
  min-height: 40px;
  max-height: 100px;
  line-height: 1.4;
  padding: 9px 0;
  font-size: 0.95rem;
  resize: none;
  overflow-y: auto;
  transition: height 0.15s ease-out;
}

.input-group input::placeholder,
.input-group textarea::placeholder {
  color: var(--ai-muted);
}

/* ── Chat Input Actions (Microfone e Enviar) ── */
.input-actions-right {
  display: flex;
  align-items: center;
  gap: 4px;
  align-self: center;
  flex-shrink: 0;
}

.chat-input-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: none;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: transparent;
  color: var(--ai-muted);
  padding: 0; /* Correção para Firefox */
  appearance: none;
  -moz-appearance: none;
  -webkit-appearance: none;
}

.chat-input-btn svg {
  flex-shrink: 0;
  display: block;
  width: 20px; /* Garante tamanho no Firefox */
  height: 20px;
}

.btn-attach {
  display: flex;
}

.page-assistente-ia .btn-voice {
  background: var(--stitch-primary-container, var(--ai-accent));
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 104, 122, 0.22);
}

.page-assistente-ia .btn-voice:hover {
  background: color-mix(in srgb, var(--stitch-primary-container) 90%, #000 10%);
  color: #fff;
}

.page-assistente-ia .btn-voice[aria-pressed="true"] {
  color: #fff;
  background: #dc2626;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.25);
}

.page-assistente-ia .btn-send {
  background: var(--stitch-primary-container, var(--ai-accent));
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 104, 122, 0.22);
}

.page-assistente-ia .btn-send:hover {
  background: var(--stitch-primary, var(--ai-accent-dark));
  color: #fff;
}

.btn-send {
  display: none;
}

.btn-voice {
  display: flex;
}

.input-group.has-content .btn-send {
  display: flex;
}

.input-group.has-content .btn-voice {
  display: none;
}

.btn-send.is-loading {
  display: flex !important;
  background: #ef4444;
  border-radius: 12px;
}
.btn-send.is-loading .icon-send {
  display: none;
}
.btn-send.is-loading .icon-stop {
  display: block !important;
}

/* ── Slash Commands Menu (ref. Menu de Ações Stitch) ── */
.slash-commands-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  width: 100%;
  max-width: 320px;
  background: var(--ai-card);
  border: 1px solid color-mix(in srgb, var(--ai-border) 40%, transparent);
  border-radius: 1.25rem;
  box-shadow:
    0 -12px 40px rgba(0, 78, 92, 0.1),
    0 4px 24px rgba(15, 23, 42, 0.06);
  margin-bottom: 12px;
  z-index: 20;
  overflow: hidden;
  animation: fadeUp 0.2s ease-out;
}

.slash-commands-list {
  max-height: 250px;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slash-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
  border: none;
  background: transparent;
  width: 100%;
  font-family: inherit;
  color: var(--ai-text);
}

.slash-item:hover,
.slash-item.active {
  background: var(--ai-accent-dim);
}

.slash-item-icon {
  font-size: 1.2rem;
}
.slash-item-content {
  display: flex;
  flex-direction: column;
}
.slash-item-cmd {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--ai-accent);
}
.slash-item-desc {
  font-size: 0.75rem;
  color: var(--ai-muted);
}

.input-hint {
  font-size: 0.7rem;
  color: var(--ai-muted);
  text-align: center;
  margin-top: 8px;
  opacity: 0.7;
}

/* ── Mobile (≤768px) ─────────────────────────────────────────── */
@media (max-width: 768px) {
  body {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  .ai-assistant-container {
    padding: 0 !important;
    max-width: none !important;
    width: 100% !important;
    gap: 0;
    height: 100vh;
    height: 100dvh;
  }

  .ai-hero {
    display: none !important;
  }

  .assistente-preferencias-card {
    margin: 10px 12px 0;
  }

  .assistente-preferencias-grid {
    grid-template-columns: 1fr;
  }

  .assistente-prompts-filters {
    grid-template-columns: 1fr;
  }

  .assistente-prompt-item-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .assistente-preferencias-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .chat-container {
    border-radius: 0;
    border: none;
    height: 100%;
    min-height: 0; /* Android/Chrome: flex child pode encolher; rolagem fica em .chat-messages */
    background-image: none;
  }

  /* Chat v2 Stitch: top bar em vidro, texto escuro sobre fundo claro */
  .chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 14px;
    position: sticky;
    top: 0;
    z-index: 40;
    flex-shrink: 0;
    background: var(--ai-header-glass);
    backdrop-filter: blur(var(--ai-header-blur));
    -webkit-backdrop-filter: blur(var(--ai-header-blur));
    border-bottom: 1px solid rgba(111, 121, 124, 0.1);
    box-shadow: 0 1px 24px rgba(0, 0, 0, 0.04);
  }

  [data-theme="dark"] .chat-header {
    background: var(--ai-header-glass);
    border-bottom-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 1px 24px rgba(0, 0, 0, 0.04);
  }

  .chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: var(--stitch-primary-container, var(--ai-accent));
    border: 2px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(0, 78, 92, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .chat-header-avatar svg {
    width: 22px;
    height: 22px;
    stroke: #fff;
  }
  .chat-header-name {
    color: var(--stitch-primary, var(--ai-accent-dark));
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: -0.02em;
  }
  [data-theme="dark"] .chat-header-name {
    color: #e2e8f0;
  }
  .chat-header-status {
    color: #16a34a;
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
  }
  [data-theme="dark"] .chat-header-status {
    color: #4ade80;
  }
  .chat-header-status-dot {
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
  }
  [data-theme="dark"] .chat-header-status-dot {
    box-shadow: 0 0 0 2px rgba(17, 24, 39, 0.9);
  }

  .chat-messages {
    padding: 20px 16px;
    background: var(--ai-bg);
  }

  .saldo-valor {
    font-size: 1.6rem;
  }

  .slash-commands-menu {
    max-height: 200px;
    position: fixed;
    bottom: 80px;
    left: 10px;
    right: 10px;
    width: auto;
    max-width: none;
  }
  .input-hint {
    display: none;
  }

  /* ── Fix: main não scrollável — chat-header substitui topbar no mobile ── */
  .main--chat {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    height: 100vh; /* fallback */
  }

  /* Topbar oculta no mobile — chat-header tem hamburger + voltar + gear */
  .main--chat .topbar {
    display: none;
  }

  .main--chat .ai-assistant-container {
    flex: 1;
    min-height: 0;
    height: auto; /* sobrescreve 100dvh */
  }

  /* Header do chat fora do card: cantos contínuos com o miolo */
  .ai-assistant-container > .chat-header {
    border-radius: 20px 20px 0 0;
  }
  #aiAssistantMainSlot > .chat-container {
    border-radius: 0 0 20px 20px;
  }

  /* ── Hamburger no chat-header ── */
  .chat-header-hamburger {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--stitch-on-surface, var(--ai-text));
    flex-shrink: 0;
    transition: background 0.2s;
  }

  .chat-header-hamburger:active {
    background: rgba(15, 23, 42, 0.12);
  }

  [data-theme="dark"] .chat-header-hamburger {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
  }

  /* ── Voltar no chat-header ── */
  .chat-header-back-btn {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--stitch-on-surface, var(--ai-text));
    flex-shrink: 0;
    transition: background 0.2s;
  }

  .chat-header-back-btn:active {
    background: rgba(15, 23, 42, 0.12);
  }

  [data-theme="dark"] .chat-header-back-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
  }

  /* ── Modo compacto quando teclado virtual abre ── */
  .chat-header {
    transition: padding 0.2s ease;
  }

  .chat-header--compact {
    padding: 8px 16px !important;
  }

  .chat-header--compact .chat-header-avatar {
    display: none;
  }

  .chat-header--compact .chat-header-name {
    font-size: 0.875rem;
  }

  .chat-header--compact .chat-header-status {
    display: none;
  }

  /* ── Quick Reply Chips ── */
  .quick-reply-area {
    padding: 8px 16px 4px;
    background: var(--ai-bg);
    display: flex;
    gap: 8px;
    overflow-x: auto;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .quick-reply-area::-webkit-scrollbar {
    display: none;
  }

  .quick-reply-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: var(--ai-card);
    border: 1px solid var(--ai-accent);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ai-accent);
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
    font-family: inherit;
  }

  .quick-reply-chip:active {
    background: var(--ai-accent);
    color: white;
    transform: scale(0.96);
  }

  /* ── Preferências: bottom sheet no mobile ── */
  .assistente-preferencias-card {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    transform: none;
    margin: 0;
    border-radius: 2.5rem 2.5rem 0 0;
    border-bottom: none;
    z-index: 300;
    max-height: 85vh;
    overflow-y: auto;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.25);
    width: auto;
  }

  .assistente-preferencias-card.is-open {
    display: block;
    transform: none;
    animation: slideUpSheet 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  @keyframes slideUpSheet {
    from {
      transform: translateY(100%);
      opacity: 0.5;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }

  /* ── Gear button no chat-header ── */
  .chat-header-gear-btn {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748b;
    flex-shrink: 0;
    transition: background 0.2s;
  }

  .chat-header-gear-btn:active {
    background: rgba(15, 23, 42, 0.1);
  }

  [data-theme="dark"] .chat-header-gear-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
  }

  .page-assistente-ia .chat-header-new-btn {
    border-radius: 0.75rem;
    border: none;
    background: var(--stitch-primary-container, var(--ai-accent));
    color: #fff;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(0, 104, 122, 0.25);
  }

  .page-assistente-ia .chat-header-new-btn:hover {
    filter: brightness(1.06);
  }

  [data-theme="dark"] .page-assistente-ia .chat-header-new-btn {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  }

  .topbar-gear-btn {
    display: none;
  }
}

/* ── Base compartilhada: todos os cards AI seguem o padrão v2 ──── */
.orc-preview-card,
.orc-success-card,
.opr-card,
.saldo-rapido-resposta,
.confirmation-card,
.pending-action-card {
  background: var(--ai-card);
  border: 1px solid var(--ai-border);
  border-radius: 16px;
  overflow: hidden;
  padding: 0;
  margin-top: 12px;
  width: 100%;
  max-width: min(400px, 100%);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.10);
  animation: fadeUp 0.3s ease-out;
}
.pending-action-card {
  max-width: min(380px, 100%);
}

/* Banner padrão — linha colorida no topo de cada card */
.orc-preview-header,
.opr-numero,
.saldo-banner,
.confirmation-card-banner,
.pending-action-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 10px 16px;
}

/* Cores por tipo de banner */
.orc-preview-header {
  background: color-mix(in srgb, #6366f1 10%, white 90%);
  color: #4338ca;
}
.opr-numero {
  background: color-mix(in srgb, var(--ai-accent) 10%, white 90%);
  color: var(--ai-accent-dark, #0d7a6e);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.saldo-banner {
  background: color-mix(in srgb, #16a34a 10%, white 90%);
  color: #15803d;
}
.confirmation-card-banner {
  background: color-mix(in srgb, var(--ai-accent) 12%, white 88%);
  color: var(--ai-accent-dark, #0d7a6e);
}
.pending-action-header {
  background: color-mix(in srgb, #f59e0b 12%, white 88%);
  color: #92400e;
}

/* Ícone circular no banner */
.orc-preview-header__icon,
.saldo-banner__icon,
.confirmation-card-banner__icon,
.pending-action-header__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
  line-height: 1;
}
.orc-preview-header__icon { background: #6366f1; color: white; }
.saldo-banner__icon       { background: #16a34a; color: white; }
.confirmation-card-banner__icon { background: var(--ai-accent); color: white; }
.pending-action-header__icon {
  background: #f59e0b;
  color: white;
  font-size: 0.65rem;
}

/* Body interno dos cards — padding padrão */
.orc-preview-body,
.opr-body,
.saldo-body,
.confirmation-card-body,
.pending-action-body {
  padding: 14px 16px 16px;
}

/* ── orc-preview-card ── */
.orc-preview-header {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
}

/* ── opr-card ── */
.opr-body .opr-field { font-size: 0.84rem; }

/* ── saldo-rapido-resposta ── */
.saldo-body {
  text-align: center;
  padding: 20px 16px 18px;
}

/* ── confirmation-card ── */
.confirmation-card-field {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--ai-border) 50%, transparent);
  font-size: 0.84rem;
}
.confirmation-card-field:last-child { border-bottom: none; }
.confirmation-card-label { color: var(--ai-muted); font-weight: 500; }
.confirmation-card-value { color: var(--ai-text); font-weight: 600; text-align: right; }

/* ── pending-action-card ── */
.pending-action-tool {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ai-text);
  margin-bottom: 10px;
}
.pending-action-summary {
  font-size: 0.82rem;
  color: var(--ai-text);
  background: color-mix(in srgb, var(--ai-bg) 70%, var(--ai-border) 30%);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  line-height: 1.55;
}
.pending-action-guidance {
  font-size: 0.75rem;
  color: var(--ai-muted);
  margin-bottom: 14px;
}
.pending-action-buttons {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
}
.pa-cancel-btn {
  flex: 1 1 auto;
  min-width: 90px;
}
.pa-btn-cadastrar {
  background: var(--ai-green, #16a34a) !important;
}
.pending-action-status {
  font-size: 0.8rem;
  color: var(--ai-muted);
  margin-top: 10px;
  text-align: center;
}

.orc-field,
.opr-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--ai-border);
  font-size: 0.85rem;
}

.orc-field:last-of-type,
.opr-field:last-of-type {
  border-bottom: none;
}
.orc-label,
.opr-label {
  color: var(--ai-muted);
  font-weight: 500;
}
.orc-value,
.opr-value {
  font-weight: 600;
  color: var(--ai-text);
  text-align: right;
}
.orc-valor {
  color: var(--ai-accent);
  font-size: 1.1rem;
  font-weight: 700;
}
.orc-ok {
  color: var(--ai-green);
}
.orc-warn {
  color: #f59e0b;
}

.orc-select {
  border: 1px solid var(--ai-border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.875rem;
  width: 100%;
  background: var(--ai-card);
  color: var(--ai-text);
  margin-top: 4px;
}

.orc-actions,
.orc-action-btns {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.orc-action-btns--success {
  justify-content: center;
}

.orc-confirm-btn {
  flex: 1;
  padding: 12px;
  background: linear-gradient(
    135deg,
    var(--ai-accent) 0%,
    var(--ai-accent-dark) 100%
  );
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 10px var(--ai-accent-glow);
}

.orc-confirm-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 15px var(--ai-accent-glow);
}

.orc-cancel-btn,
.orc-action-btn {
  padding: 10px 14px;
  background: color-mix(in srgb, var(--ai-card) 82%, var(--ai-bg) 18%);
  border: 1px solid color-mix(in srgb, var(--ai-border) 85%, transparent);
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  color: var(--ai-text);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: normal;
  min-width: 0;
}

.orc-action-btn:hover {
  background: color-mix(in srgb, var(--ai-accent-dim) 70%, var(--ai-card) 30%);
  border-color: color-mix(in srgb, var(--ai-accent) 50%, var(--ai-border) 50%);
  color: var(--ai-accent-dark);
  transform: translateY(-1px);
}

@media (max-width: 480px) {
  .orc-action-btns {
    flex-direction: column;
    width: 100%;
  }
  .orc-action-btn {
    width: 100%;
    padding: 12px;
    font-size: 0.9375rem;
  }
}

/* Success & Status Badges */
.orc-success-card {
  text-align: left;
  max-width: min(380px, 100%);
  border: 1px solid
    color-mix(in srgb, var(--ai-green) 40%, var(--ai-border) 60%);
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--ai-green) 12%, var(--ai-card) 88%) 0%,
    var(--ai-card) 100%
  );
  box-shadow: 0 10px 25px -10px rgba(16, 185, 129, 0.3);
  border-radius: var(--ai-card-radius-v2);
  padding: 16px;
  margin-top: 10px;
  position: relative;
  overflow: hidden;
}
.orc-success-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--ai-green);
  border-radius: 4px 0 0 4px;
}
.orc-success-topline {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.orc-success-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.orc-success-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #fff;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.6);
}
.orc-success-kicker {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  color: var(--ai-green);
}
.orc-success-subtitle {
  font-size: 0.84rem;
  color: var(--ai-muted);
  line-height: 1.35;
}
.orc-success-num {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ai-text);
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}
.orc-success-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}
.orc-success-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--ai-bg) 80%, transparent);
  border: 1px solid var(--ai-border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ai-text);
}
.orc-success-meta-item.highlight-meta {
  background: color-mix(in srgb, var(--ai-accent) 15%, transparent);
  color: var(--ai-accent);
  border-color: color-mix(in srgb, var(--ai-accent) 30%, transparent);
}
.orc-success-details {
  padding: 12px;
  background: color-mix(in srgb, var(--ai-bg) 50%, var(--ai-card) 50%);
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--ai-muted);
}
.orc-success-actions-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ai-muted);
  margin-bottom: 10px;
}
.orc-action-btns--success {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.orc-action-btns--success .orc-action-btn {
  width: 100%;
  min-height: 74px;
  justify-content: flex-start;
  align-items: flex-start;
  text-align: left;
  padding: 14px 16px;
  gap: 10px;
}
.orc-action-btn__icon {
  flex-shrink: 0;
  font-size: 1.05rem;
  line-height: 1;
  margin-top: 2px;
}
.orc-action-btn__content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
}
.orc-action-btn__label {
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.25;
}
.orc-action-btn__hint {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ai-muted);
}
.orc-action-btns--success .orc-action-btn--primary {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--ai-accent) 16%, #fff 84%) 0%,
    color-mix(in srgb, var(--ai-accent) 24%, #fff 76%) 100%
  );
  border-color: color-mix(in srgb, var(--ai-accent) 38%, transparent);
  box-shadow: 0 10px 24px -18px var(--ai-accent-glow);
}
.orc-action-btns--success .orc-action-btn--primary .orc-action-btn__label {
  color: var(--ai-accent-dark);
}
.orc-action-btns--success .orc-action-btn--secondary {
  background: color-mix(in srgb, var(--ai-card) 72%, var(--ai-bg) 28%);
}
.orc-action-btns--success .orc-action-btn--utility {
  background: color-mix(in srgb, var(--ai-bg) 86%, #fff 14%);
}
.orc-action-btns--success .btn-link {
  grid-column: auto;
}

.btn-aprovar {
  background: #dcfce7 !important;
  color: #15803d !important;
}
.btn-link {
  background: #f1f5f9 !important;
  color: #334155 !important;
}

.opr-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-rascunho {
  background: #f1f5f9;
  color: #64748b;
}
.badge-enviado {
  background: #e0f2fe;
  color: #0369a1;
}
.badge-aprovado {
  background: #dcfce7;
  color: #15803d;
}

/* Suggestions & Feedback (Refined) */
.sugestoes-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding: 12px;
  background: color-mix(in srgb, var(--ai-card) 40%, transparent);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.sugestoes-container::before {
  display: none;
}

.sugestoes-header {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ai-muted);
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.sugestoes-header span.sug-icon {
  background: transparent;
  color: var(--ai-muted);
  width: auto;
  height: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
}

.sugestao-chip {
  flex: 0 1 auto;
  justify-content: center;
  padding: 6px 14px;
  background: color-mix(in srgb, var(--ai-accent) 10%, transparent);
  border: 1px solid transparent;
  border-radius: 20px;
  color: var(--ai-text);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transform: translateY(5px);
}
.sugestao-chip.visible {
  opacity: 1;
  transform: translateY(0);
}
.sugestao-chip:hover {
  background: color-mix(in srgb, var(--ai-accent) 20%, transparent);
  color: var(--ai-accent);
  border-color: transparent;
  transform: translateY(0);
  box-shadow: none;
}
.sugestao-chip:active {
  transform: scale(0.98);
  background: color-mix(in srgb, var(--ai-accent) 30%, transparent);
}
.sugestao-chip.dismissed {
  opacity: 0;
  transform: scale(0.8);
}
.sugestao-chip-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* Insights proativos: compacto, discreto e acionável */
.assistente-insights {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  width: 100%;
  box-sizing: border-box;
}

.assistente-insights--welcome {
  margin-top: 18px;
}

.assistente-insights__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.assistente-insights__eyebrow {
  color: var(--ai-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
}

.assistente-insights__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border: 1px solid color-mix(in srgb, var(--ai-border) 70%, transparent);
  border-radius: 999px;
  color: var(--ai-muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.assistente-insights__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.assistente-insight-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  background: color-mix(in srgb, var(--ai-card) 78%, var(--ai-bg) 22%);
  border: 1px solid color-mix(in srgb, var(--ai-border) 72%, transparent);
  border-radius: 14px;
  box-shadow: 0 8px 22px -18px rgba(15, 23, 42, 0.28);
}

.assistente-insight-card__top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.assistente-insight-chip,
.assistente-insight-domain {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.assistente-insight-chip {
  background: color-mix(in srgb, var(--ai-accent) 12%, transparent);
  color: var(--ai-accent-dark);
}

.assistente-insight-chip--alta {
  background: color-mix(in srgb, #f59e0b 14%, transparent);
  color: #92400e;
}

.assistente-insight-domain {
  max-width: 45%;
  overflow: hidden;
  color: var(--ai-muted);
  text-overflow: ellipsis;
  background: color-mix(in srgb, var(--ai-border) 34%, transparent);
}

.assistente-insight-dismiss {
  margin-left: auto;
  padding: 3px 0;
  background: transparent;
  border: 0;
  color: var(--ai-muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
}

.assistente-insight-dismiss:hover,
.assistente-insight-dismiss:focus-visible {
  color: var(--ai-text);
  outline: none;
}

.assistente-insight-title {
  margin: 0;
  color: var(--ai-text);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.assistente-insight-desc {
  margin: 0;
  color: var(--ai-muted);
  font-size: 0.78rem;
  line-height: 1.42;
}

.assistente-insight-action {
  justify-self: start;
  min-height: 32px;
  padding: 7px 10px;
  background: var(--ai-card);
  border: 1px solid color-mix(in srgb, var(--ai-accent) 26%, var(--ai-border));
  border-radius: 10px;
  color: var(--ai-accent-dark);
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.assistente-insight-action:hover,
.assistente-insight-action:focus-visible {
  background: color-mix(in srgb, var(--ai-accent) 10%, var(--ai-card));
  border-color: color-mix(in srgb, var(--ai-accent) 42%, var(--ai-border));
  outline: none;
  transform: translateY(-1px);
}

[data-theme="dark"] .assistente-insight-card {
  background: color-mix(in srgb, var(--ai-card-hover) 82%, transparent);
  box-shadow: none;
}

[data-theme="dark"] .assistente-insight-chip--alta {
  color: #fbbf24;
}

@media (max-width: 640px) {
  .sugestoes-container {
    flex-direction: column;
  }

  .assistente-insights__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .assistente-insight-card {
    padding: 11px;
  }

  .assistente-insight-domain {
    max-width: 38%;
  }

  .assistente-insight-action {
    width: 100%;
    justify-content: center;
  }
}

.feedback-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 0;
  opacity: 0.65;
}
.feedback-bar:hover {
  opacity: 1;
}
.feedback-label {
  font-size: 0.65rem;
  color: var(--ai-muted);
}
.feedback-btn {
  background: none;
  border: none;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.72rem;
  line-height: 1;
  transition: transform 0.15s;
}
.feedback-btn:hover {
  background: var(--ai-accent-dim);
  transform: scale(1.2);
}

.action-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--ai-chip-bg);
  color: var(--ai-chip-text);
  margin-bottom: 6px;
}

.chat-date-separator {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

.chat-date-pill {
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ai-muted);
  background: color-mix(in srgb, var(--ai-bg) 80%, var(--ai-card) 20%);
}

.quick-actions-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  background: rgba(2, 6, 23, 0.18);
  z-index: 199;
}

.quick-actions-sheet {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  background: var(--ai-card);
  border-radius: 1.5rem 1.5rem 0 0;
  border: 1px solid var(--ai-border);
  border-bottom: none;
  max-height: 70vh;
  overflow-y: auto;
  padding: 14px 12px calc(18px + env(safe-area-inset-bottom, 0px));
}

.quick-actions-sheet.is-open {
  display: block;
  animation: slideUpSheet 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.quick-actions-backdrop.is-open {
  display: block;
}

.quick-actions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-action-item {
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--ai-border) 85%, transparent);
  background: color-mix(in srgb, var(--ai-card) 92%, var(--ai-bg) 8%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 12px;
  font-family: inherit;
  color: var(--ai-text);
  cursor: pointer;
  text-align: left;
}

.quick-action-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: var(--ai-accent-dim);
  flex-shrink: 0;
}

.quick-action-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.quick-action-label {
  font-size: 0.86rem;
  font-weight: 700;
}

.quick-action-desc {
  font-size: 0.75rem;
  color: var(--ai-muted);
}

.quick-action-chevron {
  font-size: 1rem;
  color: var(--ai-muted);
  flex-shrink: 0;
}

[data-theme="dark"] .quick-actions-sheet {
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .quick-action-item {
  background: color-mix(in srgb, var(--ai-card-hover) 90%, var(--ai-bg) 10%);
  border-color: rgba(255, 255, 255, 0.08);
}

/* Saldo Rápido — apenas overrides específicos (base v2 no bloco acima) */
.saldo-rapido-resposta {
  /* background e border controlados pela base compartilhada */
}
.saldo-valor {
  font-size: 2rem;
  font-weight: 800;
  color: var(--ai-accent-dark);
  margin: 8px 0;
  letter-spacing: -0.03em;
}
.saldo-valor.positivo {
  color: var(--ai-green);
}
.saldo-valor.negativo {
  color: #ef4444;
}
.saldo-data {
  font-size: 0.75rem;
  color: var(--ai-muted);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .message {
    animation: none;
  }

  .message-bubble {
    transition: none;
  }

  .assistente-gear-saved-badge {
    transition: none;
  }

  .assistente-preferencias-card.is-open {
    animation: none;
  }

  .ai-skeleton-line {
    animation: none;
  }

  .ai-status-badge--loading .ai-status-dot {
    animation: none;
  }

  .quick-actions-sheet.is-open {
    animation: none;
  }

  .action-status-chip,
  .chat-date-pill {
    animation: none;
  }
}

/* ── Embed mode (iframe dentro do dashboard) ─────────────────── */
body.embed-mode .sidebar,
body.embed-mode .topbar,
body.embed-mode .ai-hero {
  display: none !important;
}
body.embed-mode .btn-attach,
body.embed-mode .quick-actions-sheet,
body.embed-mode .quick-actions-backdrop,
body.embed-mode .chat-date-separator {
  display: none !important;
}
body.embed-mode .action-status-chip {
  font-size: 0.6rem;
  padding: 2px 6px;
}
body.embed-mode {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}
html:has(body.embed-mode) {
  height: 100%;
}
body.embed-mode .main,
body.embed-mode .main--chat {
  margin-left: 0 !important;
  padding: 0 !important;
  min-height: 100%;
  height: 100%;
  overflow: hidden;
}
body.embed-mode .ai-assistant-container {
  padding: 0 !important;
  max-width: 100% !important;
  gap: 0 !important;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}
body.embed-mode #aiAssistantMainSlot {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
body.embed-mode .chat-container {
  border-radius: 0 0 20px 20px !important;
  height: auto !important;
  flex: 1 1 auto;
  min-height: 0 !important;
  box-shadow: none !important;
  overflow: hidden;
}

/* Header de card compacto */
body.embed-mode .chat-header {
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 10px !important;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--ai-card) 94%, white 6%) 0%,
    color-mix(in srgb, var(--ai-card-hover) 92%, var(--ai-bg) 8%) 100%
  ) !important;
  border-radius: 20px 20px 0 0;
  box-shadow:
    inset 0 -1px 0 rgba(15, 23, 42, 0.06),
    0 10px 24px rgba(15, 23, 42, 0.08);
}
body.embed-mode .chat-header-hamburger,
body.embed-mode .chat-header-back-btn,
body.embed-mode .chat-header-new-btn {
  display: none !important;
}
body.embed-mode .chat-header-brand {
  gap: 10px;
}
body.embed-mode .chat-header-avatar {
  width: 32px !important;
  height: 32px !important;
  border-radius: 10px !important;
  background: color-mix(
    in srgb,
    var(--ai-accent-dim) 72%,
    white 28%
  ) !important;
  border: none !important;
  color: var(--ai-accent-dark);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}
body.embed-mode .chat-header-avatar svg {
  width: 16px !important;
  height: 16px !important;
  stroke: currentColor !important;
}
body.embed-mode .chat-header-name {
  font-size: 0.84rem !important;
  font-weight: 700 !important;
  color: var(--ai-text) !important;
  letter-spacing: -0.01em;
}
body.embed-mode .chat-header-status {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ai-accent-dim) 58%, white 42%);
  color: var(--ai-accent-dark) !important;
  font-size: 0.64rem !important;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}
body.embed-mode .chat-header-status-dot {
  width: 5px;
  height: 5px;
  box-shadow: none;
}
body.embed-mode .chat-header-actions {
  gap: 0;
}
body.embed-mode .chat-header-gear-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: var(--ai-text);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}
body.embed-mode .chat-header-gear-btn:hover {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(6, 182, 212, 0.18);
}
body.embed-mode .assistente-gear-saved-badge--on-header {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.96);
}

body.embed-mode .embed-assistant-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px 10px;
  background: color-mix(in srgb, var(--ai-card) 97%, var(--ai-bg) 3%);
  box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.05);
}
body.embed-mode .embed-assistant-toolbar-btn,
body.embed-mode .embed-assistant-toolbar-link {
  flex: 0 0 auto;
  color: var(--ai-muted);
  background: rgba(255, 255, 255, 0.82);
}
body.embed-mode .embed-assistant-toolbar-btn:hover,
body.embed-mode .embed-assistant-toolbar-link:hover {
  color: var(--ai-text);
  background: rgba(255, 255, 255, 0.98);
  transform: translateY(-1px);
}
body.embed-mode .embed-assistant-toolbar-link {
  margin-left: auto;
}
body.embed-mode .embed-context-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 8px;
  background: color-mix(in srgb, var(--ai-card) 98%, var(--ai-bg) 2%);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
body.embed-mode .embed-context-bar:not([hidden]) {
  display: flex;
}
body.embed-mode .embed-context-bar__label {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ai-accent-dim) 54%, white 46%);
  color: var(--ai-accent-dark);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
body.embed-mode .embed-context-bar__content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  white-space: nowrap;
}
body.embed-mode .embed-context-bar__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
body.embed-mode .embed-context-bar__action {
  border: 1px solid color-mix(in srgb, var(--ai-accent) 24%, transparent);
  background: white;
  color: var(--ai-text);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 9px;
  cursor: pointer;
}
body.embed-mode .embed-context-bar__action--clear {
  border-color: color-mix(in srgb, #ef4444 26%, transparent);
  color: #b91c1c;
}
body.embed-mode .embed-context-bar__primary,
body.embed-mode .embed-context-bar__secondary {
  overflow: hidden;
  text-overflow: ellipsis;
}
body.embed-mode .embed-context-bar__primary {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--ai-text);
}
body.embed-mode .embed-context-bar__secondary {
  font-size: 0.68rem;
  color: var(--ai-muted);
}
body.embed-mode .embed-context-bar__secondary:empty {
  display: none;
}
body.embed-mode .embed-context-bar__secondary:not(:empty)::before {
  content: "•";
  margin-right: 6px;
  color: color-mix(in srgb, var(--ai-muted) 70%, transparent);
}
body.embed-mode .assistente-blocked-state {
  min-height: clamp(220px, 42vh, 320px);
  padding: 22px 18px;
  gap: 10px;
  border-radius: 0 0 20px 20px;
  border-top: none;
  box-shadow: none;
}
body.embed-mode .assistente-blocked-state__icon {
  font-size: 2.3rem;
}
body.embed-mode .assistente-blocked-state__title {
  font-size: 1.02rem;
}
body.embed-mode .assistente-blocked-state__text {
  max-width: 28ch;
  font-size: 0.9rem;
  line-height: 1.45;
}
body.embed-mode .assistente-blocked-state__actions {
  gap: 10px;
}
body.embed-mode .assistente-blocked-state__actions .btn {
  min-height: 38px;
  padding: 8px 14px;
  font-size: 0.78rem;
}

/* Preferências no body: z-index alto no iframe do dashboard (empilhamento sobre o chat). */
body.embed-mode .pref-backdrop.is-open {
  z-index: 99998;
}
body.embed-mode .assistente-preferencias-card {
  z-index: 99999;
}

/* Card welcome compacto */
body.embed-mode .welcome-msg {
  padding: 12px !important;
  border-radius: 14px !important;
}
body.embed-mode .welcome-msg .wpp-title {
  font-size: 0.82rem !important;
  margin-bottom: 4px !important;
}
body.embed-mode .welcome-msg > p {
  font-size: 0.72rem !important;
  margin-bottom: 10px !important;
}

/* App-icons grid (embed) */
body.embed-mode .shortcuts-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)) !important;
  gap: 6px !important;
}
body.embed-mode .shortcut {
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  padding: 7px 2px 6px !important;
  background: var(--ai-card) !important;
  border: none !important;
  border-radius: 12px !important;
  box-shadow: 0 1px 5px rgba(15, 23, 42, 0.07) !important;
  min-height: unset !important;
  text-align: center !important;
  width: 100% !important;
}
body.embed-mode .shortcut:hover {
  transform: scale(1.05) !important;
  box-shadow: 0 3px 10px rgba(6, 182, 212, 0.15) !important;
}
body.embed-mode .shortcut-icon {
  font-size: 1.15rem !important;
  width: 28px !important;
  height: 28px !important;
  border-radius: 8px !important;
  background: linear-gradient(
    135deg,
    var(--ai-accent-dim),
    rgba(6, 182, 212, 0.1)
  ) !important;
}
body.embed-mode .shortcut-label {
  font-size: 0.55rem !important;
  font-weight: 500 !important;
  color: var(--ai-muted) !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 98% !important;
}
body.embed-mode .suggestion-group-title {
  display: none !important;
}
body.embed-mode .suggestions-section {
  gap: 6px !important;
}
body.embed-mode .suggestion-group {
  gap: 6px !important;
}

/* Mensagens e input compactos */
body.embed-mode .chat-messages {
  padding: 8px 10px !important;
  gap: 5px !important;
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
}
body.embed-mode .chat-messages.chat-messages--dense {
  gap: 3px !important;
}
body.embed-mode .message {
  margin-bottom: 0 !important;
}
body.embed-mode .message.message--compact {
  opacity: 0.92;
}
body.embed-mode .message.ai .message-bubble {
  padding: 5px 9px 3px 12px !important;
  font-size: 13px !important;
  line-height: 1.38 !important;
  max-width: 94% !important;
  border-radius: 10px 12px 11px 8px !important;
}
body.embed-mode .message.ai .message-bubble::before {
  top: 6px !important;
  bottom: 6px !important;
  width: 2px !important;
}
body.embed-mode .message.user .message-bubble {
  padding: 5px 9px 3px !important;
  font-size: 13px !important;
  line-height: 1.38 !important;
  max-width: 80% !important;
  border-radius: 10px 11px 9px 11px !important;
}
body.embed-mode .message-bubble::after {
  font-size: 9px !important;
  margin-top: 3px !important;
  display: block !important;
  float: none !important;
  margin-left: 0 !important;
  letter-spacing: 0.01em !important;
}
body.embed-mode .message.ai .message-bubble::after {
  text-align: left !important;
}
body.embed-mode .message.user .message-bubble::after {
  text-align: right !important;
}
body.embed-mode .message.message--compact .message-bubble {
  padding-top: 4px !important;
  padding-bottom: 2px !important;
  font-size: 12px !important;
  line-height: 1.28 !important;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06) !important;
}
body.embed-mode .message.message--compact .message-bubble::after {
  font-size: 8px !important;
  margin-top: 2px !important;
  opacity: 0.42 !important;
}
body.embed-mode .message.message--compact .message-copy-btn,
body.embed-mode .message.message--compact .feedback-bar,
body.embed-mode .message.message--compact .tool-trace {
  opacity: 0.56;
}
body.embed-mode .message.message--compact .feedback-bar {
  transform: scale(0.96);
  transform-origin: left top;
}
body.embed-mode .feedback-label {
  display: none !important;
}
body.embed-mode .feedback-bar {
  margin-top: 1px !important;
  gap: 2px !important;
}
body.embed-mode .welcome-msg {
  max-width: 100% !important;
}
body.embed-mode .welcome-msg .wpp-title {
  font-size: 11px !important;
  margin-bottom: 3px !important;
}
body.embed-mode .tool-trace {
  font-size: 8px !important;
  gap: 3px !important;
  margin-top: 2px !important;
}
body.embed-mode .tool-trace-item {
  font-size: 8px !important;
  padding: 0px 4px !important;
  opacity: 0.6 !important;
}
body.embed-mode .chat-input {
  padding: 9px 12px !important;
  flex-shrink: 0;
}
body.embed-mode .input-group {
  padding: 3px 5px 3px 13px !important;
  align-items: center !important;
}
body.embed-mode .input-group input,
body.embed-mode .input-group textarea {
  padding: 7px 0 !important;
  font-size: 0.85rem !important;
}
body.embed-mode .input-group button {
  width: 34px !important;
  height: 34px !important;
  border-radius: 8px !important;
}
body.embed-mode .input-group textarea {
  min-height: 30px !important;
}
body.embed-mode .input-actions-right {
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
}

/* ── Erro, status dinâmico, copiar, scroll ───────────────────────── */
.message.error .message-bubble {
  background: rgba(254, 226, 226, 0.95);
  border: 1px solid rgba(220, 38, 38, 0.35);
  color: #7f1d1d;
  padding-left: 14px;
}

.message.error .message-bubble::before {
  display: none;
}

[data-theme="dark"] .message.error .message-bubble {
  background: rgba(127, 29, 29, 0.35);
  border-color: rgba(248, 113, 113, 0.4);
  color: #fecaca;
}

.ai-status-badge--loading {
  color: #0369a1;
  background: rgba(14, 165, 233, 0.12);
  border-color: rgba(14, 165, 233, 0.25);
}

.ai-status-badge--loading .ai-status-dot {
  background: #0ea5e9;
  animation: status-pulse 1s ease-in-out infinite;
}

.ai-status-badge--error {
  color: #b91c1c;
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.35);
}

.ai-status-badge--error .ai-status-dot {
  background: #ef4444;
  animation: none;
  opacity: 1;
}

.ai-status-badge--offline {
  color: #64748b;
  background: rgba(100, 116, 139, 0.12);
  border-color: rgba(100, 116, 139, 0.25);
}

.ai-status-badge--offline .ai-status-dot {
  background: #94a3b8;
  animation: none;
}

.message-copy-btn {
  position: absolute;
  top: 4px;
  right: 6px;
  z-index: 2;
  font-size: 0.7rem;
  line-height: 1;
  padding: 3px 5px;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ai-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}

[data-theme="dark"] .message-copy-btn {
  background: rgba(30, 41, 59, 0.9);
  color: #94a3b8;
}

.message.ai:hover .message-bubble .message-copy-btn,
.message-copy-btn:focus-visible {
  opacity: 1;
}

button.sugestao-chip {
  margin: 0;
  cursor: pointer;
  background: var(--ai-card);
  font-family: inherit;
  border: 1px solid var(--ai-border);
}

.chat-scroll-bottom-btn {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 100px;
  z-index: 12;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--ai-border);
  background: var(--ai-card);
  color: var(--ai-accent-dark);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--ai-shadow);
  display: none;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.chat-scroll-bottom-btn:hover {
  transform: translateX(-50%) scale(1.05);
  box-shadow: var(--ai-shadow-lg);
}

.chat-scroll-bottom-btn.is-visible {
  display: flex;
}

.chat-scroll-bottom-btn.is-paused {
  color: var(--ai-accent);
  border-color: color-mix(in srgb, var(--ai-accent) 28%, var(--ai-border));
}

.chat-header .chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.chat-header-new-btn {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 32px;
  padding: 0 10px;
  border-radius: 0.75rem;
  border: none;
  background: var(--stitch-primary-container, var(--ai-accent));
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(0, 104, 122, 0.2);
}

.chat-header-new-btn:hover {
  filter: brightness(1.06);
}

@media (max-width: 768px) {
  .chat-header-new-btn {
    display: inline-flex;
  }
}

body.embed-mode .chat-header-new-btn {
  display: inline-flex;
}

/* Markdown seguro (subset): negrito, código, links — ver textToHtmlRich em assistente-ia.js */
.resposta-direta,
.onboarding-md,
.operador-md {
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: anywhere;
}

.resposta-direta strong,
.onboarding-md strong,
.operador-md strong {
  font-weight: 700;
  color: var(--text);
}

.resposta-direta .assistente-md-code,
.onboarding-md .assistente-md-code,
.operador-md .assistente-md-code,
.message-bubble .assistente-md-code {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.88em;
  padding: 0.1em 0.35em;
  border-radius: 6px;
  background: var(--accent-dim);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  color: var(--text);
}

@supports not (color: color-mix(in srgb, white, black)) {
  .resposta-direta .assistente-md-code,
  .onboarding-md .assistente-md-code,
  .operador-md .assistente-md-code,
  .message-bubble .assistente-md-code {
    border: 1px solid rgba(6, 182, 212, 0.25);
  }
}

.resposta-direta .assistente-md-link,
.onboarding-md .assistente-md-link,
.operador-md .assistente-md-link,
.message-bubble .assistente-md-link {
  color: var(--accent-dark);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.resposta-direta .assistente-md-link:hover,
.onboarding-md .assistente-md-link:hover,
.operador-md .assistente-md-link:hover,
.message-bubble .assistente-md-link:hover {
  color: var(--accent);
}

/* ── Tabelas Ricas (Listas de Dados) ── */
.ai-table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin-top: 14px;
  margin-bottom: 14px;
  border-radius: 12px;
  border: 1px solid var(--ai-border);
  background: var(--ai-card);
  box-shadow: var(--ai-shadow-sm);
  /* Garante scroll horizontal visível */
  -webkit-overflow-scrolling: touch;
}

/* ── Lista de Clientes: alinhada com message-bubble ── */
.orc-list-card[data-testid="assistente-clientes-list-card"] {
  width: 100%;
  /* Permite que a tabela interna expanda conforme necessário */
}

/* Wrapper da tabela: scroll horizontal quando necessário */
.orc-list-card .ai-table-wrapper {
  max-width: 100%;
  overflow-x: auto;
}

/* Tabela de clientes: layout flexível, expande para caber conteúdo */
.ai-table.clientes-table,
.orc-list-card .ai-table {
  width: max-content;
  min-width: 100%;
}

/* Coluna ID: compacta */
.orc-list-card .ai-table th:first-child,
.orc-list-card .ai-table td:first-child {
  width: 55px;
  text-align: center;
}

/* Coluna Nome: maior e destacada */
.orc-list-card .ai-table th:nth-child(2),
.orc-list-card .ai-table td:nth-child(2) {
  min-width: 140px;
  max-width: 200px;
}

.orc-list-card .ai-table td:nth-child(2) {
  font-weight: 600;
}

/* Coluna Telefone */
.orc-list-card .ai-table th:nth-child(3),
.orc-list-card .ai-table td:nth-child(3) {
  min-width: 100px;
  max-width: 120px;
}

/* Coluna Email: flexível */
.orc-list-card .ai-table th:nth-child(4),
.orc-list-card .ai-table td:nth-child(4) {
  min-width: 130px;
  max-width: 180px;
}

/* Coluna Cadastro: compacta */
.orc-list-card .ai-table th:nth-child(5),
.orc-list-card .ai-table td:nth-child(5) {
  width: 85px;
  white-space: nowrap;
}

/* Coluna Ações: centralizada */
.orc-list-card .ai-table th:nth-child(6),
.orc-list-card .ai-table td:nth-child(6) {
  width: 75px;
  white-space: nowrap;
  text-align: center;
}

/* Botões de ação na tabela */
.acoes-tabela {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-acao-tabela {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--ai-border);
  background: var(--ai-card);
  color: var(--ai-text);
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.btn-acao-tabela:hover {
  background: var(--ai-accent);
  border-color: var(--ai-accent);
  color: #fff;
  transform: scale(1.08);
}

.btn-acao-tabela:active {
  transform: scale(0.95);
}

/* Conteúdo truncável nas células */
.ai-table .td-truncate {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.ai-table th {
  background: color-mix(in srgb, var(--ai-card) 60%, var(--ai-bg) 40%);
  color: var(--ai-text);
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ai-border);
  white-space: nowrap;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.8;
}

.ai-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--ai-border);
  color: var(--ai-text);
  vertical-align: middle;
}

.ai-table tr:last-child td {
  border-bottom: none;
}

.ai-table tr:hover td {
  background: color-mix(in srgb, var(--ai-accent-dim) 40%, transparent);
}

.ai-td-content {
  display: inline-block;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .ai-table th,
  .ai-table td {
    padding: 10px 12px;
    font-size: 0.8rem;
  }
  .ai-td-content {
    max-width: 140px;
  }
}

/* ── Tool Running Badge (v2 stream) ─────────────────────────────────────── */
.tool-running-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--ai-muted);
  background: color-mix(in srgb, var(--ai-card) 92%, var(--ai-bg) 8%);
  border: 1px solid
    color-mix(in srgb, var(--ai-border) 70%, transparent);
  border-radius: 20px;
  padding: 3px 10px;
  margin-top: 6px;
  animation: none;
}

.tool-running-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ai-accent);
  opacity: 0.9;
}

/* ═══════════════════════════════════════════════════════════ */
/* FASE 1: LAZY LOADING DE GRÁFICOS                         */
/* ═══════════════════════════════════════════════════════════ */

.chart-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  background: var(--ai-card);
  border: 2px dashed var(--ai-border);
  border-radius: var(--ai-radius-sm);
  padding: 20px;
  margin-top: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chart-placeholder:hover {
  border-color: var(--ai-accent);
  background: var(--ai-card-hover);
}

.chart-placeholder-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  opacity: 0.6;
}

.chart-placeholder-text {
  font-size: 0.85rem;
  color: var(--ai-muted);
  text-align: center;
}

.chart-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 300px;
  margin-top: 16px;
  margin-bottom: 16px;
  background: var(--ai-user-bg);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  animation: fadeUp 0.3s ease-out;
}

@media (max-width: 768px) {
  .chart-container {
    height: 240px;
    padding: 12px;
  }
}

/* ═══════════════════════════════════════════════════════════ */
/* FASE 2: VIRTUALIZAÇÃO DA LISTA                           */
/* ═══════════════════════════════════════════════════════════ */

.virtual-spacer {
  /* Spacer elements para manter scroll height */
}

.virtual-visible-wrapper {
  will-change: transform;
  contain: strict;
}

/* Otimizações mobile para virtualização */
@media (max-width: 768px) {
  .chat-messages {
    contain: layout style paint;
  }

  .message {
    contain: layout style;
  }
}

/* ═══════════════════════════════════════════════════════════ */
/* FASE 4: MENSAGENS DE ERRO HUMANIZADAS                    */
/* ═══════════════════════════════════════════════════════════ */

.error-card {
  background: color-mix(in srgb, var(--ai-card) 92%, #fee2e2 8%);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--ai-radius-sm);
  padding: 16px;
  margin-top: 8px;
  animation: fadeUp 0.3s ease-out;
}

[data-theme="dark"] .error-card {
  background: color-mix(in srgb, var(--ai-card-hover) 92%, #7f1d1d 8%);
  border-color: rgba(239, 68, 68, 0.4);
}

.orc-list-card {
  width: 100%;
  max-width: min(520px, 100%);
  border: 1px solid var(--ai-border);
  border-radius: 14px;
  background: var(--ai-card);
  box-shadow: var(--ai-shadow-sm);
  overflow: hidden;
  margin-top: 10px;
}

.orc-list-card__header {
  padding: 12px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--ai-border) 70%, transparent);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.orc-list-card__title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ai-text);
}

.orc-list-card__meta {
  font-size: 0.76rem;
  color: var(--ai-muted);
}

.orc-list-card__body {
  padding: 8px 10px;
}

.orc-list-card__item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-radius: 10px;
}

.orc-list-card__item + .orc-list-card__item {
  border-top: 1px solid color-mix(in srgb, var(--ai-border) 45%, transparent);
}

.orc-list-card__item-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ai-text);
}

.orc-list-card__item-sub {
  font-size: 0.74rem;
  color: var(--ai-muted);
  margin-top: 2px;
}

.orc-list-card__item-value {
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--ai-accent-dark);
}

.orc-list-card__footer {
  padding: 10px 14px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.orc-list-card__status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.orc-list-card__status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ai-muted);
  background: color-mix(in srgb, var(--ai-bg) 82%, var(--ai-card) 18%);
}

.orc-list-card__load-more {
  border: 1px solid color-mix(in srgb, var(--ai-accent) 28%, var(--ai-border));
  background: color-mix(in srgb, var(--ai-accent) 10%, var(--ai-card) 90%);
  color: var(--ai-accent-dark);
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
}

.orc-list-empty {
  border: 1px dashed var(--ai-border);
  border-radius: 12px;
  padding: 14px;
  color: var(--ai-muted);
  font-size: 0.82rem;
  text-align: center;
  margin-top: 6px;
}

.error-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #dc2626;
  margin-bottom: 8px;
}

[data-theme="dark"] .error-card-header {
  color: #f87171;
}

.error-card-icon {
  font-size: 1.2rem;
}

.error-card-body {
  font-size: 0.85rem;
  color: var(--ai-text);
  line-height: 1.5;
  margin-bottom: 12px;
}

.error-card-suggestion {
  background: rgba(255, 255, 255, 0.5);
  border-left: 3px solid var(--ai-accent);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--ai-text);
  margin-bottom: 12px;
}

[data-theme="dark"] .error-card-suggestion {
  background: rgba(255, 255, 255, 0.05);
}

.error-card-suggestion-title {
  font-weight: 600;
  color: var(--ai-accent-dark);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.error-retry-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--ai-accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.error-retry-btn:hover {
  background: var(--ai-accent-dark);
  transform: translateY(-1px);
}

.error-retry-btn:active {
  transform: translateY(0);
}

.error-details-toggle {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--ai-muted);
  cursor: pointer;
  margin-top: 8px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.error-details-toggle:hover {
  color: var(--ai-text);
}

.error-technical-details {
  display: none;
  margin-top: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  font-size: 0.7rem;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  color: var(--ai-muted);
  word-break: break-all;
}

[data-theme="dark"] .error-technical-details {
  background: rgba(255, 255, 255, 0.05);
}

.error-technical-details.show {
  display: block;
  animation: fadeUp 0.2s ease-out;
}

/* Mensagens de erro específicas por código HTTP */
.error-session-expired {
  border-color: rgba(245, 158, 11, 0.4);
}

.error-session-expired .error-card-header {
  color: #d97706;
}

.error-rate-limit {
  border-color: rgba(168, 85, 247, 0.4);
}

.error-rate-limit .error-card-header {
  color: #9333ea;
}

.error-network {
  border-color: rgba(59, 130, 246, 0.4);
}

.error-network .error-card-header {
  color: #2563eb;
}

/* Mobile otimizações para error cards */
@media (max-width: 768px) {
  .error-card {
    padding: 14px;
  }

  .error-card-header {
    font-size: 0.85rem;
  }

  .error-card-body {
    font-size: 0.8rem;
  }

  .error-retry-btn {
    width: 100%;
    justify-content: center;
    padding: 10px;
  }
}

/* Latency indicator */
.latency-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--ai-muted);
  margin-top: 4px;
  opacity: 0.7;
}

.latency-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ai-green);
}

.latency-dot.slow {
  background: #f59e0b;
}

.latency-dot.very-slow {
  background: #ef4444;
}

/* ── Card de Orçamento v2 (estilo 011.png) ────────────────────────── */
.orc-card-v2 {
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.10);
  background: var(--ai-card);
  border: 1px solid var(--ai-border);
  width: 100%;
  max-width: min(380px, 100%);
  margin-top: 12px;
}

.orc-card-v2__banner {
  background: color-mix(in srgb, var(--ai-accent) 12%, white 88%);
  color: var(--ai-accent-dark, #0d7a6e);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.orc-card-v2__banner--update {
  background: color-mix(in srgb, #6366f1 10%, white 90%);
  color: #4f46e5;
}

.orc-card-v2__banner--preview {
  background: color-mix(in srgb, #6366f1 10%, white 90%);
  color: #4338ca;
}

.orc-card-v2__banner--warning {
  background: color-mix(in srgb, #f59e0b 12%, white 88%);
  color: #92400e;
}

.orc-card-v2__banner-icon {
  background: var(--ai-accent);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
  line-height: 1;
}

.orc-card-v2__body {
  padding: 16px;
}

.orc-card-v2__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  gap: 10px;
}

.orc-card-v2__num-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ai-muted);
  margin-bottom: 4px;
}

.orc-card-v2__client {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ai-text);
  line-height: 1.25;
}

.orc-card-v2__doc-btn {
  background: color-mix(in srgb, var(--ai-border) 50%, var(--ai-card) 50%);
  border: 1px solid var(--ai-border);
  border-radius: 10px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

.orc-card-v2__doc-btn:hover {
  background: var(--ai-border);
}

.orc-card-v2__items {
  background: color-mix(in srgb, var(--ai-bg) 70%, var(--ai-border) 30%);
  border-radius: 10px;
  padding: 4px 12px;
  margin-bottom: 14px;
}

.orc-card-v2__item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  font-size: 0.85rem;
  border-bottom: 1px solid color-mix(in srgb, var(--ai-border) 55%, transparent);
  color: var(--ai-text);
  gap: 8px;
}

.orc-card-v2__item-row:last-child {
  border-bottom: none;
}

.orc-card-v2__item-row span:last-child {
  font-weight: 600;
  white-space: nowrap;
}

.orc-card-v2__item-row span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.orc-card-v2__total {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 16px;
  padding-top: 2px;
}

.orc-card-v2__total-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ai-text);
}

.orc-card-v2__total-value {
  text-align: right;
}

.orc-card-v2__valor-final-label {
  display: block;
  font-size: 0.68rem;
  color: var(--ai-muted);
  margin-bottom: 2px;
  text-align: right;
}

.orc-card-v2__valor-final {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--ai-accent);
  line-height: 1;
}

.orc-card-v2__actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 12px;
}

.orc-card-v2__actions--inline {
  margin-top: 14px;
  margin-bottom: 0;
}

.orc-card-v2__action-row {
  display: flex;
  gap: 8px;
  width: 100%;
  flex-wrap: wrap;
}

.orc-card-v2__icon-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.orc-card-v2__icon-btns--compact {
  flex: 1 1 220px;
}

.orc-card-v2__icon-btns--center {
  justify-content: center;
}

.orc-card-v2__icon-btn {
  min-width: 0;
  height: 34px;
  border-radius: 999px;
  padding: 0 10px;
  background: color-mix(in srgb, var(--ai-border) 40%, var(--ai-card) 60%);
  border: 1px solid var(--ai-border);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.2s ease;
  line-height: 1.2;
  white-space: nowrap;
}

.orc-card-v2__icon-btn:hover:not(:disabled) {
  background: var(--ai-border);
  transform: translateY(-1px);
}

.orc-card-v2__icon-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.orc-card-v2__icon-btn span {
  font-size: 0.69rem;
  letter-spacing: 0.01em;
}

.orc-card-v2__aprovar-btn {
  flex: 1 1 120px;
  height: 42px;
  background: var(--ai-accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s, transform 0.15s;
  white-space: nowrap;
}

.orc-card-v2__aprovar-btn--compact {
  height: 34px;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 0.75rem;
  gap: 4px;
}

.orc-card-v2__aprovar-btn:hover {
  background: var(--ai-accent-dark, #0d7a6e);
  transform: translateY(-1px);
}

.orc-card-v2__preview-btn {
  width: 100%;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--ai-border);
  background: color-mix(in srgb, var(--ai-accent) 10%, var(--ai-card) 90%);
  color: var(--ai-accent-dark, #0d7a6e);
  font-size: 0.74rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
  white-space: nowrap;
}

.orc-card-v2__preview-btn:hover {
  background: color-mix(in srgb, var(--ai-accent) 16%, var(--ai-card) 84%);
  transform: translateY(-1px);
}

.orc-card-v2__compact-btn {
  flex: 1 1 120px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--ai-border);
  background: color-mix(in srgb, var(--ai-border) 35%, var(--ai-card) 65%);
  color: var(--ai-text);
  font-size: 0.74rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 10px;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.orc-card-v2__compact-btn:hover:not(:disabled) {
  background: var(--ai-border);
  transform: translateY(-1px);
}

.orc-card-v2__compact-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.orc-card-v2__compact-btn--ghost {
  background: transparent;
}

.orc-card-v2__footer {
  text-align: left;
  font-size: 0.7rem;
  color: var(--ai-muted);
  opacity: 0.8;
}

.message-bubble--v2card .feedback-bar {
  padding: 8px 14px 10px;
}

/* Neutraliza !important das classes btn-* herdadas no card v2 */
.orc-card-v2 .btn-aprovar {
  background: var(--ai-accent) !important;
  color: #fff !important;
  border-radius: 10px !important;
}
.orc-card-v2 .btn-link,
.orc-card-v2 .btn-whats,
.orc-card-v2 .btn-email {
  background: color-mix(in srgb, var(--ai-border) 45%, var(--ai-card) 55%) !important;
  color: var(--ai-text) !important;
}

/* Bubble transparente quando envolve card v2 (sem "card dentro de card") */
.message.ai .message-bubble--v2card {
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  overflow: visible;
  max-width: min(420px, 96vw);
  width: min(420px, 96vw);
  display: block;
}
.message.ai .message-bubble--v2card .orc-card-v2 {
  margin-top: 0;
  width: 100%;
  max-width: 100%;
}

/* Painel provisório de debug (?debug_ui=1) */
.ai-debug-ui {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--ai-radius-sm, 14px);
  border: 1px dashed color-mix(in srgb, var(--ai-accent) 35%, var(--ai-border));
  background: color-mix(in srgb, var(--ai-card) 92%, var(--ai-accent) 8%);
  font-size: 0.78rem;
  max-width: 100%;
}
.ai-debug-ui__summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ai-accent-dark, var(--ai-accent));
  list-style: none;
}
.ai-debug-ui__summary::-webkit-details-marker {
  display: none;
}
.ai-debug-ui__pre {
  margin: 8px 0 0;
  padding: 10px;
  max-height: 280px;
  overflow: auto;
  border-radius: 10px;
  background: color-mix(in srgb, var(--ai-bg) 88%, var(--ai-border));
  border: 1px solid var(--ai-border);
  color: var(--ai-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}
.ai-debug-ui__hint {
  margin: 8px 0 0;
  color: var(--ai-muted);
  font-size: 0.7rem;
}
.ai-debug-ui__hint code {
  font-size: 0.85em;
}

.semantic-printable-card {
  margin-top: 12px;
  border: 1px solid var(--ai-border, #e2e8f0);
  border-radius: 14px;
  background: var(--ai-card, #ffffff);
  padding: 12px;
}

.semantic-printable-card__head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.semantic-printable-card__icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--ai-accent, #06b6d4) 14%, white);
}

.semantic-printable-card__title {
  font-weight: 700;
  color: var(--ai-text, #0f172a);
}

.semantic-printable-card__sub {
  margin-top: 3px;
  color: var(--ai-muted, #64748b);
  font-size: 0.82rem;
  line-height: 1.45;
}

.semantic-printable-card__actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media print {
  body.page-assistente-ia .sidebar,
  body.page-assistente-ia .topbar,
  body.page-assistente-ia .chat-input,
  body.page-assistente-ia .chat-header,
  body.page-assistente-ia .quick-reply-area,
  body.page-assistente-ia .embed-assistant-toolbar,
  body.page-assistente-ia .feedback-bar,
  body.page-assistente-ia .sugestoes-container,
  body.page-assistente-ia .semantic-printable-card__actions {
    display: none !important;
  }

  body.page-assistente-ia .chat-messages {
    overflow: visible !important;
    height: auto !important;
    padding: 0 !important;
  }

  body.page-assistente-ia .message {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.page-assistente-ia .ai-table-wrapper {
    overflow: visible !important;
  }

  body.page-assistente-ia .ai-table th,
  body.page-assistente-ia .ai-table td {
    font-size: 11px !important;
    padding: 4px 6px !important;
  }
}

/* ── Inovação 3: card de rascunho ao vivo ───────────────────────────────── */
#draft-card-preview {
  padding: 0 8px 6px;
}
.draft-card {
  background: var(--surface-2, #f1f5f9);
  border: 1.5px dashed var(--accent, #6c63ff);
  border-radius: 12px;
  padding: 10px 14px;
  animation: fadeIn 0.18s ease;
}
.draft-card__label {
  font-size: 11px;
  color: var(--accent, #6c63ff);
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.draft-card__row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 2px 0;
  color: var(--text-secondary, #64748b);
}
.draft-card__row strong {
  color: var(--text-primary, #1e293b);
}

/* ── Inovação 2: sugestão por catálogo ──────────────────────────────────── */
.cat-sug__card {
  background: var(--surface-1, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 14px;
  overflow: hidden;
}
.cat-sug__header {
  background: var(--surface-2, #f8fafc);
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, #475569);
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.cat-sug__items {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.cat-sug__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light, #f1f5f9);
}
.cat-sug__item:last-child {
  border-bottom: none;
}
.cat-sug__info {
  flex: 1;
  min-width: 0;
}
.cat-sug__nome {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary, #1e293b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-sug__meta {
  font-size: 11px;
  color: var(--text-muted, #94a3b8);
  margin-top: 1px;
}
.cat-sug__preco {
  font-size: 14px;
  font-weight: 600;
  color: var(--success, #059669);
  white-space: nowrap;
}
.cat-sug__btn-usar {
  background: var(--accent, #6c63ff);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.cat-sug__btn-usar:hover { opacity: 0.85; }
.cat-sug__btn-outro {
  width: 100%;
  background: none;
  border: none;
  border-top: 1px solid var(--border, #e2e8f0);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--accent, #6c63ff);
  cursor: pointer;
  text-align: left;
}
.cat-sug__btn-outro:hover { background: var(--surface-2, #f8fafc); }

/* Token usage badge */
.token-usage-badge {
  font-size: 0.68rem;
  color: var(--ai-muted, #9ca3af);
  margin-top: 4px;
  display: block;
  opacity: 0.7;
  letter-spacing: 0.02em;
}

/* ── Cards de Cliente para Mobile (Layout responsivo) ── */

/* Por padrão: mostrar tabela, esconder cards */
.cliente-lista-mobile {
  display: none;
}

.cliente-lista-desktop {
  display: block;
}

/* Em telas pequenas: esconder tabela, mostrar cards */
@media (max-width: 640px) {
  .cliente-lista-desktop {
    display: none !important;
  }

  .cliente-lista-mobile {
    display: flex !important;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
  }
}

/* Card mobile individual */
.cliente-card-mobile {
  background: var(--ai-card);
  border: 1px solid var(--ai-border);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.cliente-card-mobile:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .cliente-card-mobile:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.cliente-card-mobile__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--ai-accent) 8%, transparent);
  border-bottom: 1px solid var(--ai-border);
}

.cliente-card-mobile__id {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ai-accent);
  background: color-mix(in srgb, var(--ai-accent) 12%, transparent);
  padding: 2px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.cliente-card-mobile__nome {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ai-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cliente-card-mobile__body {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cliente-card-mobile__row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.cliente-card-mobile__label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ai-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 70px;
  flex-shrink: 0;
}

.cliente-card-mobile__value {
  font-size: 0.82rem;
  color: var(--ai-text);
  word-break: break-word;
}

.cliente-card-mobile__value--truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cliente-card-mobile__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 8px 14px;
  background: color-mix(in srgb, var(--ai-bg) 50%, var(--ai-card) 50%);
  border-top: 1px solid var(--ai-border);
}

.cliente-card-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--ai-border);
  background: var(--ai-card);
  color: var(--ai-text);
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cliente-card-action:hover {
  background: var(--ai-accent);
  border-color: var(--ai-accent);
  color: #fff;
  transform: scale(1.05);
}

.cliente-card-action:active {
  transform: scale(0.95);
}

/* === Tour de Onboarding === */
#assistente-tour {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 1.5rem 1rem 1rem;
  width: 100%;
  animation: fadeInUp 0.3s ease;
}

.tour-card {
  background: var(--ai-card, #fff);
  border: 1px solid var(--ai-border, #e0e0e0);
  border-radius: 16px;
  padding: 1.5rem;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.07);
  position: relative;
}

.tour-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.tour-step-label {
  font-size: 0.78rem;
  color: var(--ai-text-muted, #888);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.tour-skip-btn {
  background: none;
  border: none;
  color: var(--ai-text-muted, #888);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.tour-skip-btn:hover {
  background: var(--ai-hover, #f5f5f5);
  color: var(--ai-text, #333);
}

.tour-body {
  text-align: center;
  padding: 0.5rem 0 1rem;
}

.tour-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  display: block;
}

.tour-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ai-text, #1a1a1a);
  margin-bottom: 0.5rem;
}

.tour-desc {
  font-size: 0.9rem;
  color: var(--ai-text-secondary, #555);
  line-height: 1.55;
  margin-bottom: 1rem;
}

.tour-example {
  background: var(--ai-bg-muted, #f8f9fa);
  border: 1px dashed var(--ai-border, #ddd);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  color: var(--ai-text-secondary, #555);
  font-style: italic;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
}

.tour-example:hover {
  background: var(--ai-accent-light, #eef4ff);
  border-color: var(--ai-accent, #4a80f5);
  color: var(--ai-accent, #4a80f5);
}

.tour-example::before {
  content: '"';
}
.tour-example::after {
  content: '"';
}

.tour-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.25rem;
}

.tour-dots {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.tour-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ai-border, #ddd);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, transform 0.15s;
}

.tour-dot.active {
  background: var(--ai-accent, #4a80f5);
  transform: scale(1.25);
}

.tour-nav {
  display: flex;
  gap: 0.5rem;
}

.tour-nav-btn {
  padding: 0.45rem 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--ai-border, #ddd);
  background: var(--ai-card, #fff);
  color: var(--ai-text, #333);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.tour-nav-btn:hover {
  background: var(--ai-hover, #f5f5f5);
}

.tour-nav-btn.primary {
  background: var(--ai-accent, #4a80f5);
  border-color: var(--ai-accent, #4a80f5);
  color: #fff;
}

.tour-nav-btn.primary:hover {
  background: var(--ai-accent-dark, #2d62e0);
  border-color: var(--ai-accent-dark, #2d62e0);
}

@media (prefers-reduced-motion: reduce) {
  #assistente-tour { animation: none; }
  .tour-example, .tour-skip-btn, .tour-nav-btn, .tour-dot { transition: none; }
}
