/* ═══════════════════════════════════════════════════════════════════════════
   IA REVIEW — Toolbar, Modal de revisão e Modal de configuração
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Buscador de máscaras na mask-bar ──────────────────────────────────────── */
.maskbar-search {
  position: absolute;   /* fora do fluxo flex — não compete com o centramento */
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  z-index: 10;
}
.maskbar-search-field {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(99,162,255,0.07);
  border: 1px solid rgba(99,162,255,0.18);
  border-radius: 20px;
  padding: 0 10px 0 9px;
  transition: background 0.22s, border-color 0.22s;
}
.maskbar-search-field:focus-within {
  background: rgba(99,162,255,0.13);
  border-color: rgba(99,162,255,0.45);
}
.maskbar-search-icon {
  font-size: 0.78rem;
  line-height: 1;
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 2px 3px;
  cursor: pointer;
  opacity: 0.55;
  color: #94a3b8;
  border-radius: 6px;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.maskbar-search-icon:hover { opacity: 1; color: #63a2ff; background: rgba(99,162,255,0.10); }
.maskbar-search-icon.is-open { opacity: 1; color: #63a2ff; background: rgba(99,162,255,0.14); }
.maskbar-search-input {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 4px 0;
  color: #94a3b8;
  font-size: 0.72rem;
  width: 120px;
  transition: width 0.22s, color 0.15s;
  outline: none;
}
.maskbar-search-input::placeholder { color: rgba(148,163,184,0.55); }
.maskbar-search-input:focus {
  width: 190px;
  color: #e2e8f0;
}
.maskbar-search-results {
  display: none;
  position: fixed;   /* sai de qualquer overflow clipping */
  min-width: 230px;
  max-height: 260px;
  overflow-y: auto;
  background: #0f1e30;
  border: 1px solid rgba(99,162,255,0.22);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 9999;
}
.maskbar-search-results.is-open { display: block; }
.maskbar-search-item {
  padding: 7px 14px;
  cursor: pointer;
  font-size: 0.72rem;
  color: #94a3b8;
  border-bottom: 1px solid rgba(99,162,255,0.07);
  display: flex;
  flex-direction: column;
  gap: 1px;
  transition: background 0.1s;
}
.maskbar-search-item:last-child { border-bottom: none; }
.maskbar-search-item:hover,
.maskbar-search-item.is-focused {
  background: rgba(99,162,255,0.12);
  color: #e2e8f0;
}
.maskbar-search-item-label { font-weight: 600; color: #cbd5e1; }
.maskbar-search-item-meta  { font-size: 0.67rem; color: #64748b; }
/* Padrão — destaque no buscador da mask-bar */
.maskbar-search-item--padrao { border-left: 2px solid rgba(251,191,36,0.55); padding-left: 12px; background: rgba(251,191,36,0.04); }
.maskbar-search-item--padrao .maskbar-search-item-label { color: #fbbf24; }
.maskbar-search-item--padrao:hover { background: rgba(251,191,36,0.10); }
.maskbar-search-empty {
  padding: 12px 14px;
  color: #475569;
  font-size: 0.72rem;
  text-align: center;
}

/* ── Modal de todas as máscaras — Constellation Theme ──────────────────────── */
.masks-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  /* Overlay menos opaco: as estrelas Three.js ficam visíveis ao redor do modal */
  background: rgba(3,8,20,0.62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}
.masks-modal-overlay.is-open { display: flex; }

.masks-modal {
  /* Painel de vidro: mostra a constelação real por trás */
  background: rgba(6,13,30,0.78);
  backdrop-filter: blur(18px) saturate(1.8) brightness(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.8) brightness(1.15);
  /* Camada de gradiente sobre o vidro para profundidade */
  background-image:
    radial-gradient(ellipse 85% 55% at 50% 0%,   rgba(50,110,255,0.22) 0%, transparent 65%),
    radial-gradient(ellipse 45% 75% at   0% 110%, rgba(20,65,190,0.14)  0%, transparent 60%),
    radial-gradient(ellipse 45% 75% at 100% 110%, rgba(20,65,190,0.14)  0%, transparent 60%);
  border: 1px solid rgba(90,165,255,0.32);
  border-top-color: rgba(150,215,255,0.62);
  border-radius: 16px;
  width: min(760px, 92vw);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow:
    /* Anel externo */
    0 0 0 1px rgba(50,130,255,0.12),
    /* Glow azul externo — identifica como elemento da constelação */
    0 0 40px rgba(50,125,255,0.28),
    0 0 90px rgba(25,90,220,0.16),
    /* Sombra de profundidade */
    0 28px 80px rgba(0,0,5,0.88),
    /* Brilho interno no topo */
    inset 0 1px 0 rgba(170,225,255,0.18),
    inset 0 0 50px rgba(15,50,160,0.10);
  overflow: hidden;
  animation: masksModalIn 0.28s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes masksModalIn {
  from { opacity:0; transform: scale(0.92) translateY(12px); }
  to   { opacity:1; transform: scale(1)    translateY(0);    }
}

.masks-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(80,150,255,0.22);
  flex-shrink: 0;
  background: rgba(8,18,44,0.55);
}
.masks-modal-title {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #63a2ff 0%, #b2e0ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 6px rgba(99,162,255,0.4));
}
.masks-modal-close {
  background: rgba(77,158,255,0.06);
  border: 1px solid rgba(77,158,255,0.14);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #3d5270;
  font-size: 0.75rem;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.masks-modal-close:hover { background: rgba(248,113,113,0.12); border-color: rgba(248,113,113,0.28); color: #f87171; }

/* Tabs de modalidade — estilo constelação */
.masks-modal-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 20px 0;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(60,130,255,0.15);
  background: rgba(5,10,24,0.45);
}
.masks-modal-tab {
  padding: 6px 18px;
  border-radius: 8px 8px 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  color: #3d5c84;
  background: rgba(8,18,38,0.5);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  position: relative;
  bottom: -1px;
  letter-spacing: 0.06em;
}
.masks-modal-tab:hover { color: #6b8db8; background: rgba(20,34,60,0.8); border-color: rgba(77,158,255,0.12); }
.masks-modal-tab.is-active {
  color: #63a2ff;
  background: rgba(6,13,30,0.78);
  border-color: rgba(90,165,255,0.28);
  border-bottom-color: transparent;
  text-shadow: 0 0 10px rgba(99,162,255,0.6);
}
.masks-modal-tab[data-mod="TC"].is-active  { color: #818cf8; text-shadow: 0 0 10px rgba(129,140,248,0.6); }
.masks-modal-tab[data-mod="RM"].is-active  { color: #34d399; text-shadow: 0 0 10px rgba(52,211,153,0.6); }
.masks-modal-tab[data-mod="USG"].is-active { color: #fbbf24; text-shadow: 0 0 10px rgba(251,191,36,0.6); }
.masks-modal-tab[data-mod="RX"].is-active  { color: #94a3b8; text-shadow: 0 0 8px rgba(148,163,184,0.45); }

/* Conteúdo — lista de máscaras por grupo */
.masks-modal-content {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
  align-content: start;
}
.masks-modal-content::-webkit-scrollbar { width: 4px; }
.masks-modal-content::-webkit-scrollbar-track { background: transparent; }
.masks-modal-content::-webkit-scrollbar-thumb { background: rgba(77,158,255,0.22); border-radius: 2px; }
.masks-modal-content::-webkit-scrollbar-thumb:hover { background: rgba(99,162,255,0.40); }

.mm-grupo-header {
  grid-column: 1 / -1;
  font-size: 0.67rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 12px 8px 5px 10px;
  margin-bottom: 2px;
  border-left: 2px solid currentColor;
  color: #63a2ff;
  text-shadow: 0 0 8px rgba(99,162,255,0.7), 0 0 22px rgba(99,162,255,0.35);
}
.mm-grupo-header:first-child { padding-top: 4px; }

/* Neon por modalidade */
.masks-modal-content[data-mod="TC"] .mm-grupo-header {
  color: #a5b4fc;
  text-shadow: 0 0 8px rgba(165,180,252,0.8), 0 0 24px rgba(129,140,248,0.4);
}
.masks-modal-content[data-mod="RM"] .mm-grupo-header {
  color: #6ee7b7;
  text-shadow: 0 0 8px rgba(110,231,183,0.8), 0 0 24px rgba(52,211,153,0.4);
}
.masks-modal-content[data-mod="USG"] .mm-grupo-header {
  color: #fcd34d;
  text-shadow: 0 0 8px rgba(252,211,77,0.8), 0 0 24px rgba(251,191,36,0.4);
}
.masks-modal-content[data-mod="RX"] .mm-grupo-header {
  color: #cbd5e1;
  text-shadow: 0 0 8px rgba(203,213,225,0.6), 0 0 18px rgba(148,163,184,0.3);
}

.mm-item {
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 0.73rem;
  color: #4b6a96;
  cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s, box-shadow 0.14s;
  border: 1px solid transparent;
}
.mm-item:hover {
  background: rgba(20,36,68,0.9);
  color: #94a3b8;
  border-color: rgba(77,158,255,0.18);
  box-shadow: 0 0 10px rgba(40,100,255,0.10);
}
.mm-item:active {
  background: rgba(40,80,180,0.18);
  color: #b2e0ff;
  border-color: rgba(99,162,255,0.30);
}
/* Máscaras Padrão — destaque na modal */
.mm-item--padrao {
  color: #c9920a;
  border-color: rgba(251,191,36,0.20);
  background: rgba(251,191,36,0.04);
}
.mm-item--padrao:hover {
  background: rgba(251,191,36,0.10);
  color: #fbbf24;
  border-color: rgba(251,191,36,0.35);
  box-shadow: 0 0 10px rgba(251,191,36,0.12);
}
/* Subgrupo — cabeçalho de subdivisão dentro de um grupo (ex: Arterial/Venoso) */
.mm-subgrupo {
  grid-column: 1 / -1;
  padding: 6px 10px 2px;
  font-size: 0.60rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #63a2ff;
  opacity: 0.65;
  border-top: 1px solid rgba(99,162,255,0.10);
  margin-top: 4px;
}

/* Campo destaca quando o modal de máscaras está aberto */
.maskbar-search-field:has(#maskbar-all-btn.is-open) {
  border-color: rgba(99,162,255,0.45);
  background: rgba(99,162,255,0.13);
}

/* Painel de todas as máscaras por seção */
.maskbar-all-panel {
  display: none;
  position: fixed;
  min-width: 280px;
  max-width: 340px;
  max-height: 70vh;
  overflow-y: auto;
  background: #0f1e30;
  border: 1px solid rgba(99,162,255,0.22);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  z-index: 9999;
  padding-bottom: 6px;
}
.maskbar-all-panel.is-open { display: block; }

/* ── Botão DITAR — ghost outline, ícone âmbar, waveform no recording ───── */
.etb-voz-v3 {
  width: auto !important;
  height: 32px !important;
  padding: 0 13px 0 11px !important;
  border-radius: 8px !important;
  background: rgba(255,255,255,0.04) !important;
  border: 1px solid rgba(255,255,255,0.12) !important;
  color: rgba(148,163,184,0.75) !important;
  font-size: 0.73rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.01em !important;
  display: flex !important;
  align-items: center !important;
  gap: 7px !important;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.16s cubic-bezier(0.4,0,0.2,1),
              border-color 0.16s cubic-bezier(0.4,0,0.2,1),
              color 0.16s cubic-bezier(0.4,0,0.2,1),
              transform 0.14s cubic-bezier(0.4,0,0.2,1),
              filter 0.16s !important;
}
/* Ícone âmbar em standby */
.etb-voz-v3 .etb-voz-mic {
  flex-shrink: 0;
  color: rgba(251,191,36,0.85);
  animation: mic-standby 2.5s ease-in-out infinite;
  transition: color 0.16s, filter 0.16s;
}
@keyframes mic-standby {
  0%, 100% { transform: scale(1);    opacity: 0.85; }
  50%       { transform: scale(1.05); opacity: 1;    }
}
/* Waveform bars — ocultas em standby */
.etb-voz-wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 14px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.etb-voz-wave span {
  display: block;
  width: 2px;
  height: 100%;
  border-radius: 2px;
  background: #ef4444;
  transform: scaleY(0.25);
  animation: none;
}
/* Hover */
.etb-voz-v3:hover:not(:disabled):not(.is-recording) {
  background: rgba(251,191,36,0.08) !important;
  border-color: rgba(251,191,36,0.30) !important;
  color: rgba(203,213,225,0.90) !important;
  transform: translateY(-1px);
}
.etb-voz-v3:hover:not(:disabled):not(.is-recording) .etb-voz-mic {
  color: rgba(251,191,36,1);
  filter: drop-shadow(0 0 4px rgba(251,191,36,0.4));
}
/* Active */
.etb-voz-v3:active:not(:disabled) {
  background: rgba(251,191,36,0.12) !important;
  transform: translateY(0);
}
/* Focus */
.etb-voz-v3:focus-visible {
  outline: 2px solid rgba(251,191,36,0.60);
  outline-offset: 2px;
}
/* Recording */
.etb-voz-v3.is-recording {
  background: rgba(239,68,68,0.12) !important;
  border-color: rgba(239,68,68,0.50) !important;
  color: #fca5a5 !important;
}
.etb-voz-v3.is-recording .etb-voz-mic {
  color: #ef4444;
  animation: mic-standby 1s ease-in-out infinite;
}
.etb-voz-v3.is-recording .etb-voz-wave {
  opacity: 1;
}
.etb-voz-v3.is-recording .etb-voz-wave span {
  animation: wave-bar 0.8s ease-in-out infinite alternate;
}
.etb-voz-v3.is-recording .etb-voz-wave span:nth-child(1) { animation-delay: 0s;    }
.etb-voz-v3.is-recording .etb-voz-wave span:nth-child(2) { animation-delay: 0.15s; }
.etb-voz-v3.is-recording .etb-voz-wave span:nth-child(3) { animation-delay: 0.30s; }
@keyframes wave-bar {
  0%   { transform: scaleY(0.20); }
  100% { transform: scaleY(1);    }
}
/* Disabled */
.etb-voz-v3:disabled { opacity: 0.35 !important; cursor: not-allowed !important; }

/* ── Botão REVISAR COM IA — gradient border + gradient text ────────────── */
.etb-ia {
  width: auto !important;
  height: 32px;
  padding: 0 15px !important;
  border-radius: 8px !important;
  /* Gradient border via background shorthand */
  background:
    rgba(8,16,36,0.85) padding-box,
    linear-gradient(135deg, rgba(34,211,238,0.65), rgba(139,92,246,0.65)) border-box !important;
  border: 1px solid transparent !important;
  font-size: 0.73rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.01em;
  display: flex !important;
  align-items: center !important;
  gap: 7px !important;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 0 18px rgba(139,92,246,0.12), 0 0 36px rgba(34,211,238,0.08) !important;
  transition: background 0.16s cubic-bezier(0.4,0,0.2,1),
              box-shadow 0.16s cubic-bezier(0.4,0,0.2,1) !important;
}
.etb-ia-icon {
  flex-shrink: 0;
  color: #22d3ee;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.etb-ia-label {
  background: linear-gradient(135deg, #22d3ee, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.etb-ia:hover:not(:disabled) {
  background:
    rgba(34,211,238,0.06) padding-box,
    linear-gradient(135deg, #22d3ee, #8b5cf6) border-box !important;
  box-shadow: 0 0 28px rgba(139,92,246,0.22), 0 0 56px rgba(34,211,238,0.14) !important;
}
.etb-ia:hover .etb-ia-icon { transform: rotate(72deg) scale(1.15); }
.etb-ia:focus-visible { outline: 2px solid #22d3ee; outline-offset: 2px; }
.etb-ia:disabled {
  background: rgba(10,18,40,0.5) padding-box,
              rgba(99,102,120,0.25) border-box !important;
  box-shadow: none !important;
  cursor: not-allowed !important;
  opacity: 0.45;
}
.etb-ia:disabled .etb-ia-label {
  background: #475569;
  -webkit-background-clip: text;
  background-clip: text;
}

/* ── Overlay base ───────────────────────────────────────────────────────── */
.ia-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* ── Modal base ─────────────────────────────────────────────────────────── */
.ia-modal {
  background: #1e2433;
  border: 1px solid #2d3748;
  border-radius: 12px;
  width: 96vw;
  max-width: 1400px;
  height: 88vh;
  max-height: 900px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  color: #e2e8f0;
  font-family: 'Outfit', sans-serif;
}

.ia-modal-cfg {
  width: 480px;
  height: auto;
  max-height: 92vh;
}

.ia-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.25rem;
  border-bottom: 1px solid #2d3748;
  flex-shrink: 0;
}
.ia-modal-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: #e2e8f0;
}
.ia-close-btn {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.12s, background 0.12s;
}
.ia-close-btn:hover { color: #e2e8f0; background: #2d3748; }

.ia-modal-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ia-modal-footer {
  padding: 0.55rem 1.25rem;
  border-top: 1px solid #2d3748;
  font-size: 0.76rem;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.ia-footer-info  { flex-shrink: 0; }
.ia-footer-resumo { flex: 1; text-align: right; font-style: italic; color: #64748b; }

/* ── Loading ────────────────────────────────────────────────────────────── */
.ia-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 1.25rem;
}
.ia-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid #2d3748;
  border-top-color: #00d4ff;
  border-radius: 50%;
  animation: ia-spin 0.75s linear infinite;
}
@keyframes ia-spin { to { transform: rotate(360deg); } }
.ia-loading-msg { font-size: 0.88rem; color: #64748b; }

/* ── Error state ────────────────────────────────────────────────────────── */
.ia-error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
}
.ia-error-icon { font-size: 2.5rem; }
.ia-error-msg  { color: #f87171; font-size: 0.9rem; max-width: 420px; line-height: 1.5; }

/* ── 3 colunas ──────────────────────────────────────────────────────────── */
.ia-three-col {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.ia-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #2d3748;
  min-width: 0;
}
.ia-col:last-child { border-right: none; }

.ia-col-header {
  padding: 0.55rem 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  border-bottom: 1px solid #2d3748;
  background: #18202f;
  flex-shrink: 0;
  letter-spacing: 0.06em;
}
.ia-sug-count { font-weight: 400; color: #475569; }

.ia-col-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  font-size: 0.84rem;
  line-height: 1.65;
  color: #cbd5e1;
}
.ia-col-body-text { white-space: pre-wrap; word-break: break-word; }
.ia-col-body-cards {
  white-space: normal;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.ia-col-footer-btns {
  padding: 0.55rem 0.75rem;
  border-top: 1px solid #2d3748;
  display: flex;
  gap: 0.45rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.ia-nenhuma-sug {
  text-align: center;
  color: #4ade80;
  padding: 2rem 1rem;
  font-style: italic;
  font-size: 0.9rem;
}

/* ── Sugestão cards ─────────────────────────────────────────────────────── */
.ia-sug-card {
  background: #18202f;
  border-radius: 8px;
  padding: 0.7rem;
  border-left: 3px solid #475569;
  transition: opacity 0.15s;
}
.ia-sug-alta  { border-left-color: #f87171; }
.ia-sug-media { border-left-color: #fbbf24; }
.ia-sug-baixa { border-left-color: #60a5fa; }

.ia-card-rejeitada { opacity: 0.38; }
.ia-card-aceita    { background: rgba(74, 222, 128, 0.04); }

.ia-sug-card-hd {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}

/* Badges */
.ia-badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.05em;
  background: #2d3748;
  color: #94a3b8;
}
.ia-badge-gram  { background: rgba(248,113,113,0.15); color: #f87171; }
.ia-badge-clin  { background: rgba(251,191,36, 0.15); color: #fbbf24; }
.ia-badge-estil { background: rgba(96, 165,250, 0.15); color: #60a5fa; }
.ia-badge-estru { background: rgba(167,139,250,0.15); color: #a78bfa; }

.ia-sug-orig {
  font-size: 0.78rem;
  color: #f87171;
  background: rgba(248,113,113,0.08);
  padding: 3px 7px;
  border-radius: 4px;
  margin-bottom: 0.2rem;
  word-break: break-word;
}
.ia-sug-arrow {
  font-size: 0.75rem;
  color: #475569;
  text-align: center;
  margin: 0.1rem 0;
}
.ia-sug-novo {
  font-size: 0.78rem;
  color: #4ade80;
  background: rgba(74,222,128,0.08);
  padding: 3px 7px;
  border-radius: 4px;
  margin-bottom: 0.3rem;
  word-break: break-word;
}
.ia-sug-just {
  font-size: 0.74rem;
  color: #64748b;
  font-style: italic;
  margin-bottom: 0.45rem;
}
.ia-sug-btns { display: flex; gap: 0.4rem; }

/* ── Highlights texto ───────────────────────────────────────────────────── */
.ia-mark-orig {
  border-radius: 2px;
  padding: 0 1px;
  cursor: default;
}
.ia-mark-alta  { background: rgba(248,113,113,0.22); border-bottom: 2px solid #f87171; }
.ia-mark-media { background: rgba(251,191,36, 0.18); border-bottom: 2px solid #fbbf24; }
.ia-mark-baixa { background: rgba(96, 165,250,0.18); border-bottom: 2px solid #60a5fa; }

.ia-mark-aceito {
  background: rgba(74,222,128,0.18);
  border-bottom: 2px solid #4ade80;
  border-radius: 2px;
  padding: 0 1px;
}

.ia-realce-ativo {
  outline: 2px solid #00d4ff;
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── Botões IA ──────────────────────────────────────────────────────────── */
.ia-btn {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.38rem 0.8rem;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
  white-space: nowrap;
  line-height: 1.2;
}
.ia-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.ia-btn-primary {
  background: #00d4ff;
  color: #0c1222;
  font-weight: 600;
}
.ia-btn-primary:hover:not(:disabled) { background: #00bfe8; }

.ia-btn-secondary {
  background: #2d3748;
  color: #cbd5e1;
  border-color: #475569;
}
.ia-btn-secondary:hover:not(:disabled) { background: #374151; }

.ia-btn-aceitar {
  flex: 1;
  background: rgba(74,222,128,0.12);
  color: #4ade80;
  border-color: #4ade80;
}
.ia-btn-aceitar:hover { background: rgba(74,222,128,0.25); }
.ia-btn-aceitar.ia-btn-active { background: rgba(74,222,128,0.28); font-weight: 700; }

.ia-btn-rejeitar {
  flex: 1;
  background: rgba(248,113,113,0.1);
  color: #f87171;
  border-color: #f87171;
}
.ia-btn-rejeitar:hover { background: rgba(248,113,113,0.22); }
.ia-btn-rejeitar.ia-btn-active { background: rgba(248,113,113,0.22); font-weight: 700; }

.ia-btn-sm { padding: 0.22rem 0.55rem; font-size: 0.75rem; }

/* ── Config modal body ──────────────────────────────────────────────────── */
.ia-cfg-body {
  padding: 1.1rem 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: calc(92vh - 60px);
}

.ia-cfg-aviso {
  background: rgba(251,191,36,0.1);
  border: 1px solid rgba(251,191,36,0.3);
  color: #fbbf24;
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  font-size: 0.78rem;
  line-height: 1.4;
}

.ia-cfg-saved-hint {
  background: rgba(0,212,255,0.08);
  border: 1px solid rgba(0,212,255,0.25);
  color: #67e8f9;
  padding: 0.6rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.5;
}

.ia-cfg-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 500;
}
.ia-cfg-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.ia-cfg-input {
  width: 100%;
  padding: 0.42rem 0.65rem;
  background: #18202f;
  border: 1px solid #2d3748;
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 0.83rem;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}
.ia-cfg-input:focus { border-color: #00d4ff; }

.ia-cfg-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #94a3b8;
  cursor: pointer;
}
.ia-cfg-check input[type="checkbox"] { accent-color: #00d4ff; width: 14px; height: 14px; cursor: pointer; }

.ia-cfg-creds-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #94a3b8;
  background: #18202f;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
}
.ia-cfg-test-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.ia-cfg-footer-btns {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #2d3748;
  margin-top: 0.2rem;
}

/* ── Destaques legacy (mantidos para compatibilidade) ───────────────────── */
.ia-destaque-remover  { background: rgba(255,77,79,0.25); border-bottom: 2px solid #ff4d4f; }
.ia-destaque-adicionar { background: rgba(82,196,26,0.25); border-bottom: 2px solid #52c41a; }

/* ═══════════════════════════════════════════════════════════════════════════
   REVISÃO PROFUNDA v3 — 3 colunas (Original | Sugestões | Revisado)
   Prefixo: rev-
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Overlay ─────────────────────────────────────────────────────────────── */
.rev-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* ── Modal container ─────────────────────────────────────────────────────── */
.rev-modal {
  background: #1a2236;
  border: 1px solid #2d3748;
  border-radius: 12px;
  width: 97vw;
  max-width: 1440px;
  height: 90vh;
  max-height: 920px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 28px 72px rgba(0,0,0,0.6);
  color: #e2e8f0;
  font-family: 'Outfit', sans-serif;
}

/* ── Cabeçalho ───────────────────────────────────────────────────────────── */
.rev-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid #2d3748;
  flex-shrink: 0;
  background: #161e2e;
}
.rev-head-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.rev-head-count {
  font-weight: 400;
  font-size: 0.82rem;
  color: #64748b;
}
.rev-close {
  background: none;
  border: none;
  color: #64748b;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.12s, background 0.12s;
}
.rev-close:hover { color: #e2e8f0; background: #2d3748; }

/* ── Três colunas ────────────────────────────────────────────────────────── */
.rev-cols {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.rev-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #2d3748;
  min-width: 0;
}
.rev-col:last-child { border-right: none; }
.rev-col-sug { flex: 0 0 320px; max-width: 360px; }

.rev-col-head {
  padding: 0.48rem 0.9rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: #64748b;
  border-bottom: 1px solid #2d3748;
  background: #141c2e;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.rev-col-head-hint {
  font-weight: 400;
  font-size: 0.64rem;
  color: #475569;
  letter-spacing: 0;
}

/* Corpos das colunas de texto */
.rev-col-orig-body,
.rev-col-rev-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.1rem;
  font-size: 0.84rem;
  line-height: 1.7;
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-word;
}
.rev-col-orig-body p,
.rev-col-rev-body p {
  margin: 0;
  min-height: 1.2em;
}

/* Corpo da coluna de sugestões */
.rev-col-sug-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.65rem 0.7rem;
}

/* ── Destaques nas colunas de texto ──────────────────────────────────────── */
.dest {
  border-radius: 2px;
  padding: 0 2px;
}
.dest-estrutural         { background: rgba(167,139,250,0.18); border-bottom: 2px solid #a78bfa; }
.dest-clinico            { background: rgba(251,191,36, 0.15); border-bottom: 2px solid #fbbf24; }
.dest-gramatical         { background: rgba(248,113,113,0.16); border-bottom: 2px solid #f87171; }
.dest.preview            { background: rgba(74,222,128,0.12);  border-bottom: 2px solid #4ade80; }
.dest.aplicado           { background: rgba(74,222,128,0.22);  border-bottom: 2px solid #4ade80; }

/* ── Card de sugestão ────────────────────────────────────────────────────── */
.rev-card {
  background: #18202f;
  border-radius: 8px;
  border-left: 3px solid #475569;
  overflow: hidden;
  transition: border-color 0.12s, box-shadow 0.12s;
  cursor: pointer;
}
.rev-card-estrutural { border-left-color: #a78bfa; }
.rev-card-clinico    { border-left-color: #fbbf24; }
.rev-card-gramatical { border-left-color: #f87171; }
.rev-card-applied    { opacity: 0.45; cursor: default; border-left-color: #4ade80 !important; }
.rev-card-open       { box-shadow: 0 0 0 1px #2d3748; }
.rev-card-erro       { box-shadow: 0 0 0 2px #ef4444; }

.rev-card-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  user-select: none;
}
.rev-card-badge {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: 3px;
  flex-shrink: 0;
}
.rev-card-estrutural .rev-card-badge { background: rgba(167,139,250,0.15); color: #a78bfa; }
.rev-card-clinico    .rev-card-badge { background: rgba(251,191,36, 0.12); color: #fbbf24; }
.rev-card-gramatical .rev-card-badge { background: rgba(248,113,113,0.12); color: #f87171; }
.rev-card-applied    .rev-card-badge { background: rgba(74,222,128,0.12);  color: #4ade80; }

.rev-card-titulo {
  font-size: 0.82rem;
  font-weight: 500;
  color: #cbd5e1;
  flex: 1;
  line-height: 1.3;
}

/* ── Corpo expandido do card ─────────────────────────────────────────────── */
.rev-card-body {
  padding: 0 0.7rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  border-top: 1px solid #232d42;
}

.rev-diff-toggle {
  background: none;
  border: none;
  color: #475569;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.3rem 0;
  text-align: left;
  font-family: inherit;
  transition: color 0.12s;
  margin-top: 0.35rem;
}
.rev-diff-toggle:hover { color: #94a3b8; }

.rev-diff {
  background: #0f1623;
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.77rem;
  line-height: 1.4;
}
.rev-diff-old {
  color: #f87171;
  background: rgba(248,113,113,0.08);
  padding: 2px 5px;
  border-radius: 3px;
  word-break: break-word;
}
.rev-diff-new {
  color: #4ade80;
  background: rgba(74,222,128,0.08);
  padding: 2px 5px;
  border-radius: 3px;
  word-break: break-word;
}
.rev-diff-new.rev-diff-rm { color: #94a3b8; background: rgba(148,163,184,0.07); font-style: italic; }
.rev-diff-ctx {
  color: #475569;
  font-size: 0.71rem;
  font-style: italic;
  padding: 0 2px;
  word-break: break-word;
}

.rev-card-motivo {
  font-size: 0.74rem;
  color: #64748b;
  font-style: italic;
  line-height: 1.4;
}
.rev-card-pmid {
  font-size: 0.72rem;
  color: #00d4ff;
  text-decoration: none;
  opacity: 0.8;
}
.rev-card-pmid:hover { opacity: 1; }

.rev-card-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.1rem;
}

/* ── Botões de ação no card ──────────────────────────────────────────────── */
.rev-btn {
  flex: 1;
  padding: 0.3rem 0.5rem;
  font-size: 0.77rem;
  font-family: inherit;
  border-radius: 5px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.12s, border-color 0.12s;
  line-height: 1.2;
}
.rev-btn-accept {
  background: rgba(74,222,128,0.1);
  color: #4ade80;
  border-color: rgba(74,222,128,0.35);
}
.rev-btn-accept:hover { background: rgba(74,222,128,0.22); }
.rev-btn-reject {
  background: rgba(248,113,113,0.08);
  color: #f87171;
  border-color: rgba(248,113,113,0.3);
}
.rev-btn-reject:hover { background: rgba(248,113,113,0.2); }

/* ── Estado vazio ────────────────────────────────────────────────────────── */
.rev-vazio {
  text-align: center;
  color: #4ade80;
  padding: 2.5rem 1rem;
  font-style: italic;
  font-size: 0.88rem;
}

/* ── Loading ─────────────────────────────────────────────────────────────── */
.rev-modal-loading .rev-modal { height: auto; }
.rev-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  padding: 3rem 2rem;
}
.rev-loading-msg {
  font-size: 0.85rem;
  color: #64748b;
  text-align: center;
}
.rev-cancel-btn {
  background: none;
  border: 1px solid #2d3748;
  border-radius: 6px;
  color: #64748b;
  font-size: 0.78rem;
  padding: 0.3rem 0.85rem;
  cursor: pointer;
  font-family: inherit;
  margin-top: 0.3rem;
  transition: color 0.12s, border-color 0.12s;
}
.rev-cancel-btn:hover { color: #cbd5e1; border-color: #475569; }

/* ── Erro ────────────────────────────────────────────────────────────────── */
.rev-erro {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2.5rem 2rem;
  text-align: center;
}
.rev-erro-msg {
  font-size: 0.88rem;
  color: #fca5a5;
  white-space: pre-wrap;
  line-height: 1.6;
  max-width: 440px;
}

/* ── Rodapé ──────────────────────────────────────────────────────────────── */
.rev-foot-wrap {
  border-top: 1px solid #2d3748;
  flex-shrink: 0;
  background: #141c2e;
}
.rev-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 1.1rem;
  font-size: 0.75rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.rev-foot-meta { color: #475569; }
.rev-foot-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.rev-foot-prog { color: #64748b; }
.rev-prog-ok   { color: #4ade80 !important; }

.rev-apply-all {
  background: rgba(0,212,255,0.1);
  border: 1px solid rgba(0,212,255,0.3);
  color: #00d4ff;
  font-size: 0.77rem;
  font-family: inherit;
  border-radius: 5px;
  padding: 0.25rem 0.65rem;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.12s;
}
.rev-apply-all:hover { background: rgba(0,212,255,0.2); }

.rev-copy-btn {
  background: none;
  border: 1px solid #2d3748;
  border-radius: 5px;
  color: #64748b;
  font-size: 0.82rem;
  padding: 0.2rem 0.45rem;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
  line-height: 1.4;
}
.rev-copy-btn:hover { color: #cbd5e1; border-color: #475569; }

/* ── Responsivo ──────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .rev-modal {
    height: 95vh;
    max-height: none;
    border-radius: 8px;
  }
  .rev-cols { flex-direction: column; }
  .rev-col  { flex: none; min-height: 0; height: 33.3%; }
  .rev-col  { border-right: none; border-bottom: 1px solid #2d3748; }
  .rev-col:last-child { border-bottom: none; }
  .rev-col-sug { flex: none; max-width: none; height: 33.3%; }
}
