/* ════════════════════════════════════════════════════════════════
   NES Central de Inteligência Clínica — Fase 13.2
   Score explicável · Domínios clicáveis · Melhorias · Justificativas
   ════════════════════════════════════════════════════════════════ */

.nes-ci-root {
  font-family: var(--font-body, 'Inter', system-ui, sans-serif);
  padding: 1rem;
  max-width: 1100px;
  margin: 0 auto;
}

/* ── Header ─────────────────────────────────────────────────── */

.nes-ci-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #e2e8f0;
}
.nes-ci-header-icon { font-size: 2rem; line-height: 1; }
.nes-ci-title  { font-size: 1.1rem; font-weight: 700; color: #1e293b; margin: 0 0 0.1rem; }
.nes-ci-subtitle { font-size: 0.82rem; color: #64748b; margin: 0; }

/* ── Grid ────────────────────────────────────────────────────── */

.nes-ci-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

/* ── Card base ───────────────────────────────────────────────── */

.nes-ci-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.nes-ci-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.nes-ci-card-icon  { font-size: 1.1rem; }
.nes-ci-card-title { font-size: 0.9rem; font-weight: 600; color: #334155; flex: 1; }
.nes-ci-badge-count {
  background: #3b82f6; color: #fff;
  font-size: 0.72rem; font-weight: 700;
  border-radius: 9999px; padding: 0.1rem 0.45rem;
  min-width: 1.3rem; text-align: center;
}

/* ── Score card ──────────────────────────────────────────────── */

.nes-ci-score-num {
  font-size: 3rem; font-weight: 800; line-height: 1;
  margin: 0.4rem 0 0.6rem; text-align: center;
}
.nes-ci-score-max { font-size: 1rem; color: #94a3b8; font-weight: 400; }

/* ── Classificação badge ─────────────────────────────────────── */

.nes-ci-classi-badge {
  font-size: 0.72rem; font-weight: 700;
  border-radius: 9999px; padding: 0.2rem 0.65rem;
  letter-spacing: 0.02em;
}
.nes-ci-classi--excelente { background: #dcfce7; color: #166534; }
.nes-ci-classi--bom        { background: #d1fae5; color: #065f46; }
.nes-ci-classi--atencao    { background: #fef9c3; color: #92400e; }
.nes-ci-classi--moderado   { background: #ffedd5; color: #9a3412; }
.nes-ci-classi--alto       { background: #fee2e2; color: #991b1b; }

/* Badge legado (baixo/moderado/alto) mantido para compat */
.nes-ci-badge { font-size: 0.72rem; font-weight: 700; border-radius: 9999px; padding: 0.2rem 0.65rem; }
.badge-baixo   { background: #dcfce7; color: #166534; }
.badge-moderado { background: #fef9c3; color: #92400e; }
.badge-alto    { background: #fee2e2; color: #991b1b; }

/* ── Barra de progresso ──────────────────────────────────────── */

.nes-ci-progress-wrap { margin: 0.25rem 0 0.9rem; }

.nes-ci-progress-bar {
  height: 8px; background: #e2e8f0; border-radius: 9999px; overflow: hidden;
  margin-bottom: 0.3rem;
}
.nes-ci-progress-fill {
  height: 100%; border-radius: 9999px;
  transition: width 0.6s cubic-bezier(.4,0,.2,1);
}
.nes-ci-progress-blocos {
  font-family: 'Courier New', monospace; font-size: 0.7rem;
  letter-spacing: 0.01em; line-height: 1; user-select: none;
}

/* ── Domínios (clicáveis) ────────────────────────────────────── */

.nes-ci-dominios {
  border-top: 1px solid #f1f5f9;
  padding-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.nes-ci-dominio { border-radius: 6px; overflow: hidden; }

.nes-ci-dom-btn {
  width: 100%; display: flex; align-items: center; gap: 0.5rem;
  background: transparent; border: none; cursor: pointer;
  padding: 0.35rem 0.5rem; border-radius: 6px;
  text-align: left; transition: background 0.15s;
}
.nes-ci-dom-btn:hover:not([disabled]) { background: #f8fafc; }
.nes-ci-dom-btn[disabled] { cursor: default; }

.nes-ci-dom-label { flex: 1; font-size: 0.8rem; color: #334155; font-weight: 500; }
.nes-ci-dom-score { font-size: 0.9rem; font-weight: 700; min-width: 2rem; text-align: right; }
.nes-ci-dom-arrow { font-size: 0.75rem; color: #94a3b8; transition: transform 0.2s; }

.nes-ci-dom-detail {
  padding: 0.4rem 0.5rem 0.5rem;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
}
.nes-ci-dom-regras { list-style: none; padding: 0; margin: 0; }
.nes-ci-dom-regra  { font-size: 0.78rem; padding: 0.2rem 0; }
.nes-ci-dom-regra--ok  { color: #166534; }
.nes-ci-dom-regra--nok { color: #92400e; }
.nes-ci-dom-sem-regra  { font-size: 0.78rem; color: #94a3b8; margin: 0; }

/* ── Justificativas (Por que esse Score?) ────────────────────── */

.nes-ci-just-list { list-style: none; padding: 0; margin: 0; }
.nes-ci-just-item {
  display: flex; align-items: flex-start; gap: 0.4rem;
  font-size: 0.82rem; padding: 0.3rem 0;
  border-bottom: 1px solid #f1f5f9;
}
.nes-ci-just-item:last-child { border-bottom: none; }
.nes-ci-just--ok  { color: #166534; }
.nes-ci-just--nok { color: #334155; }
.nes-ci-just-impacto {
  font-size: 0.72rem; font-weight: 700; color: #ef4444;
  background: #fee2e2; border-radius: 4px; padding: 0.05rem 0.35rem;
  margin-left: auto; white-space: nowrap;
}

/* ── Melhorias (Como Melhorar) ───────────────────────────────── */

.nes-ci-melhoria-list { list-style: none; padding: 0; margin: 0; }
.nes-ci-melhoria-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0;
}
.nes-ci-melhoria-sep { border-bottom: 1px solid #f1f5f9; }
.nes-ci-melhoria-acao { flex: 1; font-size: 0.82rem; color: #334155; }
.nes-ci-melhoria-pontos {
  font-size: 0.8rem; font-weight: 700; color: #22c55e;
  background: #dcfce7; border-radius: 4px; padding: 0.1rem 0.4rem;
  white-space: nowrap;
}
.nes-ci-melhoria-ev { font-size: 0.9rem; cursor: help; }

/* ── Alertas ─────────────────────────────────────────────────── */

.nes-ci-alerta {
  border-radius: 8px; padding: 0.65rem 0.75rem;
  margin-bottom: 0.5rem; border-left: 4px solid transparent;
}
.nes-ci-alerta--amarelo  { background: #fffbeb; border-left-color: #f59e0b; }
.nes-ci-alerta--vermelho { background: #fff1f2; border-left-color: #ef4444; }
.nes-ci-alerta--azul     { background: #eff6ff; border-left-color: #3b82f6; }
.nes-ci-alerta-header {
  font-size: 0.82rem; font-weight: 600; color: #1e293b;
  margin-bottom: 0.25rem; display: flex; align-items: center; gap: 0.35rem;
}
.nes-ci-alerta-msg  { font-size: 0.82rem; color: #334155; margin: 0 0 0.2rem; }
.nes-ci-alerta-acao { font-size: 0.78rem; color: #64748b; margin: 0; }

/* ── Medicamentos ────────────────────────────────────────────── */

.nes-ci-med-list { list-style: none; padding: 0; margin: 0; }
.nes-ci-med-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.4rem 0; border-bottom: 1px solid #f1f5f9; font-size: 0.82rem;
}
.nes-ci-med-item:last-child { border-bottom: none; }
.nes-ci-med-nome   { font-weight: 600; color: #1e293b; text-transform: capitalize; }
.nes-ci-med-motivo { font-size: 0.72rem; color: #f59e0b; background: #fffbeb; padding: 0.1rem 0.4rem; border-radius: 4px; }

/* ── Monitorizações ──────────────────────────────────────────── */

.nes-ci-monit-list { list-style: none; padding: 0; margin: 0; }
.nes-ci-monit-item { font-size: 0.82rem; color: #334155; padding: 0.35rem 0; border-bottom: 1px solid #f1f5f9; }
.nes-ci-monit-item:last-child { border-bottom: none; }

/* ── Sugestões ───────────────────────────────────────────────── */

.nes-ci-sug-list { list-style: none; padding: 0; margin: 0; }
.nes-ci-sug-item { font-size: 0.82rem; color: #0f172a; padding: 0.35rem 0; border-bottom: 1px solid #f1f5f9; }
.nes-ci-sug-item:last-child { border-bottom: none; }

/* ── Checklist ───────────────────────────────────────────────── */

.nes-ci-check-list { list-style: none; padding: 0; margin: 0; }
.nes-ci-check-item { padding: 0.35rem 0; border-bottom: 1px solid #f1f5f9; }
.nes-ci-check-item:last-child { border-bottom: none; }
.nes-ci-check-label {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.82rem; color: #334155; cursor: pointer; user-select: none;
}
.nes-ci-checkbox { width: 1rem; height: 1rem; accent-color: #22c55e; cursor: pointer; flex-shrink: 0; }
.nes-ci-check-label:has(.nes-ci-checkbox:checked) span { text-decoration: line-through; color: #94a3b8; }

/* ── Empty state ─────────────────────────────────────────────── */

.nes-ci-empty {
  display: flex; align-items: center; gap: 0.6rem;
  color: #64748b; font-size: 0.88rem; padding: 1.25rem;
  background: #f8fafc; margin-bottom: 0.75rem;
}
.nes-ci-empty-icon { font-size: 1.4rem; }

/* ── Rodapé ──────────────────────────────────────────────────── */

.nes-ci-rodape {
  font-size: 0.7rem; color: #cbd5e1; text-align: center;
  margin-top: 1.25rem; padding-top: 0.75rem; border-top: 1px solid #f1f5f9;
}

/* ── Responsivo ──────────────────────────────────────────────── */

@media (max-width: 700px) {
  .nes-ci-grid { grid-template-columns: 1fr; }
  .nes-ci-score-num { font-size: 2.4rem; }
  .nes-ci-header { flex-direction: column; align-items: flex-start; }
  .nes-ci-progress-blocos { font-size: 0.6rem; }
}

@media (max-width: 480px) {
  .nes-ci-root { padding: 0.5rem; }
  .nes-ci-melhoria-item { flex-wrap: wrap; }
  .nes-ci-melhoria-pontos { margin-left: auto; }
}
