/* NES — Consulta Integrativa Ortomolecular — CSS v2.0 — 2026-06-27 */

/* ═══════════════════════════════════════════════════════════════
   LAYOUT DA PÁGINA DEDICADA
═══════════════════════════════════════════════════════════════ */

#tela-integrativa-dedicada.cie-page {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: #f1f5f9;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-sans, 'Inter', system-ui, sans-serif);
}

/* ── Topbar ──────────────────────────────────────────────────── */

.cie-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  height: 52px;
  min-height: 52px;
  background: #0f4c66;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  z-index: 10;
  flex-shrink: 0;
}

.cie-topbar-left  { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cie-topbar-center{ display: flex; align-items: center; gap: 8px; flex: 1; justify-content: center; min-width: 0; }
.cie-topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.cie-btn-voltar {
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: .78rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.cie-btn-voltar:hover { background: rgba(255,255,255,.22); }

.cie-pac-info { display: flex; flex-direction: column; min-width: 0; }
.cie-pac-nome {
  font-size: .87rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}
.cie-pac-meta { font-size: .7rem; color: rgba(255,255,255,.7); }

.cie-form-titulo { font-size: .88rem; font-weight: 600; white-space: nowrap; }
.cie-autosave-status { font-size: .7rem; color: rgba(255,255,255,.65); white-space: nowrap; }

.cie-btn {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: .77rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  white-space: nowrap;
}
.cie-btn-ghost   { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
.cie-btn-ghost:hover { background: rgba(255,255,255,.1); }
.cie-btn-outline { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.35); }
.cie-btn-outline:hover { background: rgba(255,255,255,.22); }
.cie-btn-success { background: #22c55e; color: #fff; border-color: #16a34a; }
.cie-btn-success:hover { background: #16a34a; }
.cie-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Body layout ─────────────────────────────────────────────── */

.cie-body-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────── */

.cie-sidebar {
  width: 240px;
  min-width: 240px;
  max-width: 240px;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.cie-pac-panel { border-bottom: 1px solid #e2e8f0; }
.cie-pac-panel-hdr {
  font-size: .71rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 8px 12px 4px;
  background: #f8fafc;
}
.cie-pac-panel-body { padding: 6px 12px 10px; font-size: .74rem; color: #334155; }
.cie-pac-bloco { margin-bottom: 8px; }
.cie-pac-bloco strong { display: block; color: #0f4c66; margin-bottom: 2px; font-size: .72rem; }
.cie-pac-bloco p { margin: 0; color: #475569; }
.cie-pac-bloco ul { margin: 0; padding-left: 14px; color: #475569; }
.cie-pac-bloco li { margin-bottom: 1px; }
.cie-pac-loading, .cie-pac-empty { font-size: .73rem; color: #94a3b8; padding: 4px 0; }

.cie-nav-hdr {
  font-size: .69rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #94a3b8;
  padding: 10px 12px 4px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.cie-nav-secoes { padding: 4px 0 16px; }

.cie-nav-item {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 6px 10px 6px 12px;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  font-size: .74rem;
  color: #475569;
  transition: background .12s, color .12s;
  border-left: 3px solid transparent;
}
.cie-nav-item:hover { background: #f1f5f9; color: #0f4c66; }
.cie-nav-item--ativo {
  background: #eff6ff;
  color: #0f4c66;
  font-weight: 600;
  border-left-color: #0f4c66;
}

.cie-nav-dot { font-size: .7rem; flex-shrink: 0; }
.cie-nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Main ────────────────────────────────────────────────────── */

.cie-main {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  min-width: 0;
  scroll-behavior: smooth;
}

/* ── Sections ─────────────────────────────────────────────────── */

.cie-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
  transition: box-shadow .15s;
}
.cie-section:focus-within { box-shadow: 0 0 0 2px rgba(15,76,102,.2); }

.cie-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  cursor: pointer;
  user-select: none;
}
.cie-section-header:hover { background: #f1f5f9; }

.cie-section-icon  { font-size: .95rem; flex-shrink: 0; }
.cie-section-label { flex: 1; font-size: .83rem; font-weight: 600; color: #0f4c66; }

.cie-section-dot {
  font-size: .7rem;
  flex-shrink: 0;
  color: #cbd5e1;
  transition: color .2s;
}
.cie-section-dot.cie-dot--ok { color: #22c55e; }

.cie-section-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: .7rem;
  color: #94a3b8;
  padding: 0 2px;
  flex-shrink: 0;
}

.cie-section-body {
  padding: 16px 18px;
  display: block;
}
.cie-section--open .cie-section-body { display: block; }

/* ═══════════════════════════════════════════════════════════════
   COMPONENTES DE FORMULÁRIO
═══════════════════════════════════════════════════════════════ */

.cio-body { color: #334155; }

.cio-grupo { margin-bottom: 14px; }

.cio-label {
  display: block;
  font-size: .77rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
}
.cio-req { color: #ef4444; margin-left: 2px; }

.cio-input, .cio-select, .cio-textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid #d1d5db;
  border-radius: 6px;
  font-size: .82rem;
  color: #1e293b;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
  box-sizing: border-box;
}
.cio-input:focus, .cio-select:focus, .cio-textarea:focus {
  outline: none;
  border-color: #0f4c66;
  box-shadow: 0 0 0 3px rgba(15,76,102,.12);
}

.cio-textarea {
  resize: vertical;
  min-height: 64px;
  line-height: 1.5;
}

.cio-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cio-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.cio-secao-sub {
  font-size: .73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #0f4c66;
  padding: 10px 0 6px;
  border-bottom: 1px solid #e0f0f7;
  margin-bottom: 10px;
  margin-top: 6px;
}

.cio-aviso {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 7px;
  padding: 8px 12px;
  font-size: .78rem;
  color: #92400e;
  margin-bottom: 14px;
}

.cio-info-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  padding: 8px 12px;
  font-size: .78rem;
  color: #1e40af;
  margin-bottom: 14px;
}

.cio-hint {
  display: block;
  font-size: .68rem;
  color: #94a3b8;
  margin-top: 2px;
  font-style: italic;
}

/* ── Checkboxes ──────────────────────────────────────────────── */

.cio-check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-bottom: 12px;
}

.cio-check-item {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  font-size: .77rem;
  color: #334155;
  cursor: pointer;
  padding: 3px 0;
  transition: color .1s;
}
.cio-check-item:hover { color: #0f4c66; }
.cio-check-item.grave { color: #b91c1c; }
.cio-check-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin-top: 1px;
  flex-shrink: 0;
  accent-color: #0f4c66;
}

/* ── Score buttons ───────────────────────────────────────────── */

.cio-score-group {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.cio-score-btn {
  width: 36px;
  height: 32px;
  border: 1.5px solid #d1d5db;
  border-radius: 6px;
  background: #f9fafb;
  font-size: .8rem;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  transition: all .12s;
}
.cio-score-btn:hover { border-color: #0f4c66; color: #0f4c66; background: #eff6ff; }
.cio-score-btn.selecionado {
  background: #0f4c66;
  border-color: #0f4c66;
  color: #fff;
}

/* ── Resumo ──────────────────────────────────────────────────── */

.cio-resumo-preview {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px;
  font-size: .78rem;
  color: #374151;
  white-space: pre-wrap;
  line-height: 1.6;
  min-height: 120px;
  font-family: 'Courier New', monospace;
}

.cio-resumo-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.cio-btn {
  padding: 6px 14px;
  border-radius: 7px;
  font-size: .78rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  font-family: inherit;
}
.cio-btn-outline {
  background: #fff;
  color: #0f4c66;
  border-color: #0f4c66;
}
.cio-btn-outline:hover { background: #eff6ff; }

/* ═══════════════════════════════════════════════════════════════
   IMPRESSÃO
═══════════════════════════════════════════════════════════════ */

@media print {
  #tela-integrativa-dedicada.cie-page {
    position: static;
    overflow: visible;
    background: #fff;
  }
  .cie-topbar, .cie-sidebar, .cie-section-toggle,
  .cie-btn-voltar, .cie-topbar-right, .cio-resumo-actions { display: none !important; }
  .cie-body-layout { display: block; }
  .cie-main { overflow: visible; padding: 0; }
  .cie-section { break-inside: avoid; border: 1px solid #ccc; }
  .cie-section-body { display: block !important; }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  .cie-sidebar { width: 190px; min-width: 190px; max-width: 190px; }
  .cie-topbar-center .cie-form-titulo { display: none; }
}

@media (max-width: 640px) {
  .cie-sidebar { display: none; }
  .cie-main { padding: 12px; }
  .cio-grid-2, .cio-grid-3 { grid-template-columns: 1fr; }
  .cie-topbar { height: auto; padding: 8px 10px; flex-wrap: wrap; }
  .cie-topbar-right .cie-btn-ghost { display: none; }
}
