/**
 * NES — Biblioteca de Protocolos Terapêuticos
 */

.proto-bib-container {
  padding-bottom: 80px;
}

.proto-bib-header h2 {
  color: #0f3f4f;
}

.proto-bib-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid #d7e5e1;
}

.proto-bib-tab {
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid #b9d1cb;
  background: #fff;
  color: #0f3f4f;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
}

.proto-bib-tab.active,
.proto-bib-tab:hover {
  background: #f0fdfa;
  border-color: #16846f;
  color: #16846f;
}

.proto-bib-search-wrap {
  margin-bottom: 18px;
}

.proto-bib-search-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 8px;
}

.proto-bib-search {
  width: 100%;
  box-sizing: border-box;
  padding: 13px 14px;
  border: 2px solid rgba(200, 235, 224, 0.9);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #073b4c;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 4px 12px rgba(0, 0, 0, 0.06);
}

.proto-bib-search:focus {
  outline: none;
  border-color: #1d9e75;
  box-shadow: 0 0 0 3px rgba(29, 158, 117, 0.18);
}

.proto-bib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.proto-bib-card {
  background: #fff;
  border: 1px solid #d7e5e1;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(15, 76, 102, 0.06);
}

.proto-bib-card h4 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #0f3f4f;
}

.proto-bib-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.proto-bib-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e8f5f1;
  color: #0f6b5a;
}

.proto-bib-badge.tipo {
  background: #eef2ff;
  color: #3730a3;
}

.proto-bib-resumo {
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.45;
  margin: 8px 0 12px;
}

.proto-bib-empty,
.proto-bib-hint {
  color: #64748b;
  font-size: 0.88rem;
}

.proto-bib-form {
  display: grid;
  gap: 16px;
}

.proto-bib-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  background: #fff;
  border: 1px solid #d7e5e1;
  border-radius: 12px;
  overflow: hidden;
}

.proto-bib-table th,
.proto-bib-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #eef4f2;
}

.proto-bib-table th {
  background: #f8fafc;
  font-weight: 700;
}

.proto-bib-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.proto-bib-modal[hidden] {
  display: none !important;
}

.proto-bib-modal-card {
  width: 100%;
  max-width: 520px;
  background: #fff;
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.proto-bib-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
  font-size: 0.85rem;
}

.proto-bib-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.proto-bib-modal-actions button {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid #b9d1cb;
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}

.proto-bib-modal-actions button.primary {
  background: #16846f;
  color: #fff;
  border-color: #16846f;
}

@media (max-width: 768px) {
  .proto-bib-checks {
    grid-template-columns: 1fr;
  }
}

/* Biblioteca protocolos_terapeuticos — painel split (independente do paciente) */
.pt-bib-page {
  padding-bottom: 80px;
}

.pt-bib-header h2 {
  color: #0f3f4f;
}

.pt-bib-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f8fbfa;
  padding: 10px 0;
}

.pt-bib-search {
  flex: 1 1 280px;
  min-width: 200px;
  padding: 12px 14px;
  border: 2px solid rgba(200, 235, 224, 0.9);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
}

.pt-bib-filter {
  min-width: 140px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #b9d1cb;
  font-weight: 600;
}

.pt-bib-split {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 16px;
  min-height: 55vh;
}

.pt-bib-list-panel {
  border: 1px solid #d7e5e1;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pt-bib-list {
  overflow-y: auto;
  max-height: calc(100vh - 220px);
  padding: 8px;
}

.pt-bib-list-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 6px;
  background: #f8fbfa;
  cursor: pointer;
  font-family: inherit;
}

.pt-bib-list-item:hover,
.pt-bib-list-item.active {
  border-color: #16846f;
  background: #eef9f5;
}

.pt-bib-list-sub {
  display: block;
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 4px;
}

.pt-bib-main-panel {
  border: 1px solid #d7e5e1;
  border-radius: 14px;
  background: #fff;
  overflow-y: auto;
  max-height: calc(100vh - 220px);
}

.pt-bib-preview {
  padding: 20px;
}

.pt-bib-preview-head h3 {
  margin: 0 0 8px;
  color: #0f3f4f;
}

.pt-bib-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.pt-bib-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e8f5f1;
  color: #0f6b5a;
}

.pt-bib-badge--inativo { background: #fee2e2; color: #991b1b; }
.pt-bib-badge--rascunho { background: #fef3c7; color: #92400e; }
.pt-bib-badge--ativo { background: #e8f5f1; color: #0f6b5a; }

.pt-bib-itens-list {
  margin: 8px 0 16px;
  padding-left: 20px;
  font-size: 0.88rem;
}

.pt-bib-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

.pt-bib-form-wrap {
  padding: 16px;
}

.pt-bib-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.pt-bib-empty {
  padding: 16px;
}

@media (max-width: 900px) {
  .pt-bib-split {
    grid-template-columns: 1fr;
  }
  .pt-bib-list,
  .pt-bib-main-panel {
    max-height: none;
  }
}
