/* NES — Histórico rápido de receitas */

.rx-hist-modal {
  width: 90vw;
  max-width: 90vw;
  height: 92vh;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  margin: auto;
}

.rx-hist-body {
  flex: 1 1 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  min-height: 0;
}

.rx-hist-toolbar {
  flex-shrink: 0;
  margin-bottom: 10px;
}

.rx-hist-busca {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  margin-bottom: 8px;
}

.rx-hist-filtros {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rx-hist-filtro-chip {
  border: 1px solid #d7e5e1;
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  cursor: pointer;
}

.rx-hist-filtro-chip.active {
  background: #eef9f5;
  border-color: #16846f;
  color: #0f4c66;
  font-weight: 600;
}

.rx-hist-split {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(260px, 380px) 1fr;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.rx-hist-lista {
  overflow-y: auto;
  border: 1px solid #d7e5e1;
  border-radius: 12px;
  padding: 8px;
  background: #f8fbfa;
}

.rx-hist-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
}

.rx-hist-item.active,
.rx-hist-item:hover {
  border-color: #16846f;
  background: #eef9f5;
}

.rx-hist-item-data {
  display: block;
  font-size: 0.75rem;
  color: #64748b;
}

.rx-hist-item-meta {
  display: block;
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 4px;
}

.rx-hist-origem {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.72rem;
  color: #0f6e56;
}

.rx-hist-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  margin-top: 4px;
}

.rx-hist-badge--liberada { background: #dcfce7; color: #166534; }
.rx-hist-badge--emitida { background: #dbeafe; color: #1e40af; }
.rx-hist-badge--rascunho { background: #fef3c7; color: #92400e; }

.rx-hist-preview {
  overflow-y: auto;
  border: 1px solid #d7e5e1;
  border-radius: 12px;
  padding: 16px;
  background: #fff;
}

.rx-hist-preview h4 { margin: 0 0 8px; color: #0f4c66; }
.rx-hist-preview h5 { margin: 14px 0 6px; font-size: 0.9rem; color: #0f6e56; }
.rx-hist-preview-meta { font-size: 0.85rem; color: #64748b; margin-bottom: 12px; }
.rx-hist-meds-list { margin: 0; padding-left: 18px; font-size: 0.88rem; }

.rx-hist-footer { flex-shrink: 0; gap: 8px; display: flex; flex-wrap: wrap; justify-content: flex-end; }

/* Prontuário card */
.rx-hist-pront-card {
  margin-top: 24px;
  padding: 16px;
  border: 1px solid #d7e5e1;
  border-radius: 12px;
  background: #f8fbfa;
}

.rx-hist-pront-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.rx-hist-pront-head h3 {
  margin: 0;
  font-size: 1rem;
  color: #0f4c66;
}

.rx-hist-pront-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #e2e8f0;
}

.rx-hist-pront-row:last-child { border-bottom: none; }

.rx-hist-pront-row-acoes {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.nes-dash-ultimas-receitas {
  margin-top: 1rem;
}

.nes-dash-ultimas-receitas .dash-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rx-hist-compact-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid #e8f0ee;
}

.rx-hist-compact-row:last-child {
  border-bottom: none;
}

.rx-hist-compact-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.rx-hist-compact-resumo {
  display: block;
  font-size: 0.92rem;
  color: #0f3f4f;
}

.rx-hist-compact-main {
  flex: 1 1 220px;
  min-width: 0;
}

.rx-hist-compact-acoes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.rx-hist-empty-inline {
  margin: 0;
  padding: 8px 0;
}

@media (max-width: 768px) {
  .rx-hist-modal {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .rx-hist-split {
    grid-template-columns: 1fr;
  }

  .rx-hist-footer .btn {
    min-height: 44px;
    flex: 1 1 auto;
  }

  .rx-hist-pront-row {
    flex-direction: column;
  }

  .rx-hist-pront-row-acoes {
    flex-direction: row;
    width: 100%;
  }

  .rx-hist-pront-row-acoes .btn {
    flex: 1;
    min-height: 44px;
  }
}

@media (max-width: 390px) {
  .rx-hist-modal {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .rx-hist-body {
    padding: 8px 10px;
  }

  .rx-hist-busca {
    font-size: 16px;
    padding: 8px 10px;
  }

  .rx-hist-filtro-chip {
    font-size: 0.72rem;
    padding: 3px 8px;
  }

  .rx-hist-item {
    padding: 8px 10px;
  }

  .rx-hist-preview {
    padding: 12px;
    max-height: 42vh;
  }

  .rx-hist-footer {
    padding: 8px 10px;
  }

  .rx-hist-footer .btn {
    min-height: 44px;
    font-size: 0.85rem;
  }

  .rx-hist-pront-head {
    flex-direction: column;
    align-items: stretch;
  }

  .rx-hist-pront-head .btn {
    width: 100%;
    min-height: 44px;
  }
}
