* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  padding: 0;
  background: #f3f4f6;
}

.page {
  max-width: 1200px;
  margin: 24px auto;
  background: #ffffff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

h1 {
  margin-top: 0;
  font-size: 1.6rem;
  text-align: center;
}

.subtitle {
  font-size: 0.9rem;
  color: #6b7280;
  text-align: center;
  margin-bottom: 20px;
}

textarea {
  width: 100%;
  border-radius: 8px;
  padding: 12px;
  border: 1px solid #d1d5db;
  resize: vertical;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.85rem;
  background: #f9fafb;
}

#rawInput {
  min-height: 220px;
}

#outputText {
  min-height: 160px;
  background: #f9fafb;
}

label {
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}

.row {
  margin-bottom: 16px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 8px;
  align-items: center;
}

button {
  border-radius: 999px;
  border: none;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: #2563eb;
  color: white;
}

.btn-secondary {
  background: #e5e7eb;
  color: #111827;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary:hover {
  background: #d1d5db;
}

/* Versão menor para botões de seleção em massa */
.btn-small {
  font-size: 0.8rem;
  padding: 4px 10px;
}

.status-text {
  font-size: 0.8rem;
  color: #6b7280;
}

.footer-note {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 16px;
  text-align: right;
}

/* =========================
   Filtros de exames
   ========================= */

.exam-filters {
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  padding: 10px 12px;
  background: #f9fafb;
  display: flex;
  flex-wrap: wrap;
  gap: 16px; /* espaço entre categorias */
}

.exam-group {
  min-width: 220px;
  padding: 6px 8px;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06); /* cartõezinhos suaves */
}

.exam-group-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #4b5563;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between; /* nome à esquerda, botões à direita */
  align-items: center;
  width: 100%;
}

.exam-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.exam-toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.exam-toggle input {
  display: none;
}

.exam-toggle span {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  font-size: 0.8rem;
  background: white;
  color: #111827;
}

.exam-toggle input:checked + span {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
}

.exam-mass-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.hint {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 4px;
}

/* --- Botões discretos de seleção por categoria --- */

.category-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.category-btn {
  background: #e5e7eb;
  border: none;
  padding: 2px 6px;
  font-size: 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  color: #374151;
  transition: 0.15s ease-in-out;
  line-height: 1;
}

.category-btn:hover {
  background: #d1d5db;
}

.category-btn:active {
  background: #9ca3af;
  transform: scale(0.95);
}

/* =========================
   Responsivo
   ========================= */

@media (max-width: 768px) {
  .page {
    margin: 8px;
    padding: 16px;
  }

  /* Em mobile, empilha as categorias em coluna */
  .exam-filters {
    flex-direction: column;
    flex-wrap: nowrap;
  }

  .exam-group {
    min-width: 100%;
  }
}

