/* Modal Chamado IA — chat restrito (só consulta SQL + abrir chamado) */
.chamado-ia-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147482500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 8, 23, 0.72);
  backdrop-filter: blur(6px);
}

.chamado-ia-overlay.is-open {
  display: flex;
}

.chamado-ia-card {
  width: min(720px, 96vw);
  height: min(780px, 92vh);
  display: flex;
  flex-direction: column;
  background: #0b1220;
  border: 1px solid rgba(79, 140, 255, 0.28);
  border-radius: 16px;
  overflow: hidden;
  color: #e8eef8;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.chamado-ia-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  flex-shrink: 0;
}

.chamado-ia-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.chamado-ia-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(79, 70, 229, 0.25);
  color: #a5b4fc;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.chamado-ia-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.chamado-ia-header p {
  margin: 2px 0 0;
  font-size: 12px;
  color: #94a3b8;
}

.chamado-ia-close {
  border: 0;
  background: #334155;
  color: #e2e8f0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
}

.chamado-ia-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chamado-ia-status {
  padding: 8px 14px;
  font-size: 12px;
  color: #94a3b8;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  flex-shrink: 0;
}

.chamado-ia-status.is-warn { color: #fbbf24; }
.chamado-ia-status.is-ok { color: #86efac; }
.chamado-ia-status.is-err { color: #fca5a5; }

.chamado-ia-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chamado-ia-bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.chamado-ia-bubble.user {
  align-self: flex-end;
  background: #312e81;
  color: #e0e7ff;
}

.chamado-ia-bubble.assistant {
  align-self: flex-start;
  background: #1e293b;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.chamado-ia-bubble.typing {
  min-width: 56px;
  padding: 12px 16px;
}

.chamado-ia-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 16px;
}

.chamado-ia-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  animation: chamado-ia-typing-dot 1.2s infinite ease-in-out both;
}

.chamado-ia-typing span:nth-child(2) {
  animation-delay: 0.16s;
}

.chamado-ia-typing span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes chamado-ia-typing-dot {
  0%, 80%, 100% {
    opacity: 0.28;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.chamado-ia-bubble.error {
  align-self: stretch;
  background: #450a0a;
  border: 1px solid #7f1d1d;
  color: #fecaca;
}

.chamado-ia-bubble.system {
  align-self: center;
  background: transparent;
  color: #94a3b8;
  font-size: 12px;
  text-align: center;
}

.chamado-ia-composer {
  flex-shrink: 0;
  padding: 10px 12px 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  background: #0f172a;
}

.chamado-ia-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.chamado-ia-preview {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #334155;
}

.chamado-ia-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chamado-ia-preview button {
  position: absolute;
  top: 2px;
  right: 2px;
  border: 0;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 11px;
  cursor: pointer;
  line-height: 1;
}

.chamado-ia-input-shell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 14px;
  background: #111827;
  padding: 8px 10px 6px;
  box-sizing: border-box;
  overflow: hidden;
}

.chamado-ia-input-shell textarea {
  width: 100%;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: #e8eef8;
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  min-height: 44px;
  max-height: 140px;
}

.chamado-ia-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  margin: 0;
}

.chamado-ia-toolbar-left,
.chamado-ia-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.chamado-ia-tool-btn,
.chamado-ia-send-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 999px;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  box-sizing: border-box;
  flex-shrink: 0;
  background: #1e293b;
  color: #e2e8f0;
}

.chamado-ia-send-btn {
  background: #f8fafc;
  color: #0f172a;
  font-weight: 700;
}

.chamado-ia-tool-btn:disabled,
.chamado-ia-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chamado-ia-hint {
  margin: 8px 2px 0;
  font-size: 11px;
  color: #64748b;
  line-height: 1.35;
}
