/* Central de Atendimento IA — Admin */
.sai-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
@media (max-width: 860px) { .sai-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sai-kpi {
  background: var(--card, #111827);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 13px;
  padding: 13px 15px;
}
.sai-kpi span { display: block; font-size: 11.5px; color: #94a3b8; margin-bottom: 4px; font-weight: 600; }
.sai-kpi strong { font-size: 22px; font-weight: 800; color: #f8fafc; }
.sai-kpi small { display: block; font-size: 11px; color: #64748b; margin-top: 2px; }
.sai-kpi.is-warn { border-color: rgba(245, 158, 11, 0.35); background: rgba(245, 158, 11, 0.06); }
.sai-kpi.is-warn strong { color: #fbbf24; }
.sai-kpi.is-urgent { border-color: rgba(239, 68, 68, 0.35); background: rgba(239, 68, 68, 0.07); }
.sai-kpi.is-urgent strong { color: #f87171; }
.sai-kpi.is-ok { border-color: rgba(16, 185, 129, 0.35); background: rgba(16, 185, 129, 0.07); }
.sai-kpi.is-ok strong { color: #34d399; }

.sai-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.sai-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.sai-tab {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #0f172a;
  color: #cbd5e1;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.sai-tab.active {
  background: rgba(16, 185, 129, 0.18);
  border-color: #10b981;
  color: #6ee7b7;
}
.sai-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #34d399;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.28);
}
.sai-live-dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; }

.sai-inbox-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
@media (max-width: 960px) { .sai-inbox-grid { grid-template-columns: 1fr; } }

.sai-box {
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  overflow: hidden;
}
.sai-list-head { padding: 10px; border-bottom: 1px solid rgba(148, 163, 184, 0.14); }
.sai-search {
  width: 100%;
  background: #0b1220;
  border: 1px solid rgba(148, 163, 184, 0.24);
  color: #f1f5f9;
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 12.5px;
}
.sai-list { max-height: 580px; overflow-y: auto; display: flex; flex-direction: column; }
.sai-item {
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border: 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  background: transparent;
  color: #e2e8f0;
  cursor: pointer;
}
.sai-item:hover { background: rgba(148, 163, 184, 0.06); }
.sai-item.active { background: rgba(16, 185, 129, 0.12); border-left: 3px solid #10b981; }
.sai-item-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 4px; }
.sai-item-name { font-size: 13px; font-weight: 800; color: #f8fafc; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sai-item-time { font-size: 11px; color: #94a3b8; flex-shrink: 0; }
.sai-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 5px; }
.sai-badge {
  font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 999px; letter-spacing: 0.2px;
}
.sai-badge.urgent { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.4); }
.sai-badge.human { background: rgba(245, 158, 11, 0.2); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.4); }
.sai-badge.ai { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.35); }
.sai-badge.code { background: rgba(56, 189, 248, 0.15); color: #7dd3fc; border: 1px solid rgba(56, 189, 248, 0.3); font-family: ui-monospace, monospace; }
.sai-badge.paused { background: rgba(168, 85, 247, 0.18); color: #d8b4fe; border: 1px solid rgba(168, 85, 247, 0.35); }
.sai-badge.ok { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; }
.sai-item-prev { font-size: 12px; color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sai-thread-head {
  padding: 13px 15px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}
.sai-thread-meta { font-size: 12px; color: #94a3b8; margin-top: 3px; }
.sai-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.sai-btn {
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: #1e293b;
  color: #f1f5f9;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.sai-btn:hover { border-color: rgba(16, 185, 129, 0.5); }
.sai-btn.primary { background: #059669; border-color: #10b981; color: #fff; }
.sai-btn.ai-sug { background: rgba(99, 102, 241, 0.2); border-color: rgba(129, 140, 248, 0.5); color: #c7d2fe; }
.sai-btn.warn { background: rgba(245, 158, 11, 0.16); border-color: rgba(245, 158, 11, 0.45); color: #fcd34d; }
.sai-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.sai-order-card {
  margin: 10px 14px 0;
  padding: 11px 13px;
  border-radius: 11px;
  background: #0b1220;
  border: 1px solid rgba(148, 163, 184, 0.18);
  font-size: 12px;
  color: #cbd5e1;
}
.sai-order-row { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.sai-carrier-form { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(148, 163, 184, 0.14); }
.sai-carrier-form input {
  background: #111827; border: 1px solid rgba(148, 163, 184, 0.24); color: #f1f5f9;
  border-radius: 8px; padding: 5px 9px; font-size: 11.5px; min-width: 130px; flex: 1;
}

.sai-log {
  max-height: 360px;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.sai-msg {
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.sai-msg.customer { align-self: flex-start; background: #1e293b; color: #f8fafc; border: 1px solid rgba(148, 163, 184, 0.2); }
.sai-msg.assistant { align-self: flex-end; background: rgba(56, 189, 248, 0.1); color: #e0f2fe; border: 1px solid rgba(56, 189, 248, 0.3); }
.sai-msg.admin { align-self: flex-end; background: rgba(16, 185, 129, 0.16); color: #d1fae5; border: 1px solid rgba(16, 185, 129, 0.4); }
.sai-msg-head { display: flex; justify-content: space-between; gap: 10px; font-size: 10.5px; color: #94a3b8; margin-bottom: 4px; font-weight: 700; }

.sai-reply-box { padding: 12px 14px; border-top: 1px solid rgba(148, 163, 184, 0.14); background: #0b1220; }
.sai-macros { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.sai-macro {
  padding: 4px 9px; border-radius: 999px; border: 1px solid rgba(148, 163, 184, 0.22);
  background: #111827; color: #cbd5e1; font-size: 11px; font-weight: 700; cursor: pointer;
}
.sai-macro:hover { border-color: #10b981; color: #6ee7b7; }
.sai-reply-row { display: flex; gap: 8px; align-items: flex-end; }
.sai-textarea {
  flex: 1; min-height: 64px; resize: vertical;
  background: #111827; border: 1px solid rgba(148, 163, 184, 0.25); color: #f8fafc;
  border-radius: 10px; padding: 9px 11px; font-size: 13px; font-family: inherit;
}
.sai-empty { padding: 36px 20px; text-align: center; color: #94a3b8; font-size: 13px; }

.sai-cfg-card {
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 14px;
}
.sai-cfg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 720px) { .sai-cfg-grid { grid-template-columns: 1fr; } }
.sai-field label { display: block; font-size: 12px; color: #94a3b8; margin-bottom: 5px; font-weight: 600; }
.sai-field input, .sai-field select, .sai-field textarea {
  width: 100%; background: #0b1220; border: 1px solid rgba(148, 163, 184, 0.24);
  color: #f1f5f9; border-radius: 10px; padding: 8px 11px; font-size: 13px; font-family: inherit;
}
.sai-span2 { grid-column: 1 / -1; }
.sai-status-msg { margin-top: 10px; font-size: 12.5px; font-weight: 700; }
.sai-test-box {
  margin-top: 10px; padding: 12px; border-radius: 10px;
  background: rgba(16, 185, 129, 0.08); border: 1px solid rgba(16, 185, 129, 0.3);
  color: #d1fae5; font-size: 13px; white-space: pre-wrap;
}
.sai-nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: #ef4444; color: #fff; font-size: 11px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}
