/* kaib-chat.css — Kaib Web FAB + chat overlay + action cards (PR1)
 * Carregado lazy via preload+swap (padrão CSS non-critical Scout).
 */

/* ── FAB ───────────────────────────────────────────────────────────────── */
.kaib-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent, #0d7);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  cursor: pointer;
  z-index: 89; /* abaixo de modais (90+), acima de conteúdo (1-88) */
  font-family: inherit;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.3px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kaib-fab:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.24); }
.kaib-fab:active { transform: translateY(0); }
.kaib-fab[hidden] { display: none !important; }

/* ── Overlay (full-screen mobile, side panel desktop) ─────────────────── */
.kaib-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 95;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  animation: kaib-fade-in 0.18s ease;
}
.kaib-overlay[hidden] { display: none !important; }
@keyframes kaib-fade-in { from { opacity: 0 } to { opacity: 1 } }

.kaib-panel {
  background: var(--bg, #fff);
  width: 100%;
  max-width: 480px;
  height: 100%;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.2);
}
@media (min-width: 700px) {
  .kaib-panel {
    height: 80vh;
    max-height: 720px;
    margin: auto 20px 20px auto;
    border-radius: 12px;
  }
  .kaib-overlay { align-items: flex-end; }
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.kaib-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  background: var(--bg-soft, #f9fafb);
}
.kaib-header__title { font-weight: 700; font-size: 15px; }
.kaib-header__sub { font-size: 11px; color: var(--text-muted, #6b7280); font-weight: 400; }
.kaib-header__actions { display: flex; align-items: center; gap: 4px; }
.kaib-header__reset,
.kaib-header__close {
  background: transparent; border: none; cursor: pointer; padding: 4px 8px;
  font-size: 18px; line-height: 1; color: var(--text-muted, #6b7280);
}
.kaib-header__close { font-size: 20px; }
.kaib-header__reset:hover,
.kaib-header__close:hover { color: var(--text, #111); }

/* ── Stream (messages) ──────────────────────────────────────────────────── */
.kaib-stream {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg, #fff);
}
.kaib-msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}
.kaib-msg--user {
  background: var(--accent, #0d7);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.kaib-msg--kaib {
  background: var(--bg-soft, #f3f4f6);
  color: var(--text, #111);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.kaib-msg--system {
  align-self: center;
  background: transparent;
  color: var(--text-muted, #9ca3af);
  font-size: 12px;
  font-style: italic;
}

/* ── Action cards (preview + confirm) ───────────────────────────────────── */
.kaib-action-card {
  background: var(--bg, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-left: 3px solid var(--accent, #0d7);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  align-self: stretch;
}
.kaib-action-card--write { border-left-color: #f59e0b; } /* amarelo write Orbit */
.kaib-action-card--destructive { border-left-color: #ef4444; } /* vermelho destructive */

.kaib-action-card__tier {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 2px 6px;
  border-radius: 3px;
  background: #fef3c7;
  color: #92400e;
  margin-bottom: 6px;
}
.kaib-action-card__preview {
  font-size: 13px;
  color: var(--text, #111);
  margin-bottom: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.kaib-action-card__actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.kaib-action-card__btn {
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid var(--border, #d1d5db);
  background: var(--bg, #fff);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
}
.kaib-action-card__btn--confirm {
  background: var(--accent, #0d7);
  color: #fff;
  border-color: var(--accent, #0d7);
}
.kaib-action-card__btn--confirm:hover { filter: brightness(1.08); }
.kaib-action-card__btn:disabled { opacity: 0.5; cursor: not-allowed; }
.kaib-action-card__status { font-size: 11px; color: var(--text-muted, #6b7280); margin-top: 6px; }
.kaib-action-card__status--ok { color: #059669; }
.kaib-action-card__status--err { color: #dc2626; }

/* ── Contact match list (ambíguo) ───────────────────────────────────────── */
.kaib-match-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.kaib-match-item {
  padding: 6px 8px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 4px;
  font-size: 12px;
  background: var(--bg, #fff);
  cursor: pointer;
}
.kaib-match-item:hover { background: var(--bg-soft, #f3f4f6); }
.kaib-match-item__name { font-weight: 600; }
.kaib-match-item__meta { color: var(--text-muted, #6b7280); font-size: 11px; }

/* ── Composer ────────────────────────────────────────────────────────────── */
.kaib-composer {
  padding: 10px 12px;
  border-top: 1px solid var(--border, #e5e7eb);
  background: var(--bg-soft, #f9fafb);
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.kaib-composer__textarea {
  flex: 1;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 14px;
  resize: none;
  min-height: 36px;
  max-height: 100px;
  background: var(--bg, #fff);
  color: var(--text, #111);
}
.kaib-composer__textarea:focus { outline: 2px solid var(--accent, #0d7); outline-offset: -1px; }
.kaib-composer__btn {
  background: var(--accent, #0d7);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
}
.kaib-composer__btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Loading indicator ──────────────────────────────────────────────────── */
.kaib-typing {
  align-self: flex-start;
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  font-style: italic;
  padding: 4px 8px;
}
.kaib-typing::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-left: 4px;
  animation: kaib-dot 1s infinite;
}
@keyframes kaib-dot {
  0%, 80%, 100% { opacity: 0.2 }
  40% { opacity: 1 }
}

/* ── Error banner ──────────────────────────────────────────────────────── */
.kaib-error {
  margin: 8px 12px;
  padding: 8px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: #991b1b;
  font-size: 12px;
}
