body {
  --padding-bottom: 40px;
}

main {
  width: min(680px, 100%);
  padding-top: 8px;
}

h1 {
  margin: 0 0 4px;
  font-size: clamp(1.3rem, 6vw, 1.8rem);
  letter-spacing: -0.03em;
  font-weight: 1000;
}

.campo {
  margin-bottom: 16px;
}

.campo label {
  display: block;
  font-size: 0.82rem;
  font-weight: 800;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.campo .opcional {
  font-weight: 500;
  color: #64748b;
  text-transform: none;
}

.campo input,
.campo select,
.campo textarea {
  width: 100%;
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  font-family: inherit;
  resize: vertical;
}

.campo input:focus,
.campo select:focus,
.campo textarea:focus {
  outline: none;
  border-color: #bef264;
}

.campo-linha[hidden] {
  display: none;
}

.campo-linha {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

section.secao {
  margin-bottom: 20px;
}

section.secao h2 {
  margin: 0 0 10px;
  font-size: 1.02rem;
  font-weight: 900;
  color: #bef264;
}

.exercicio-lista {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.exercicio-item {
  background: rgba(15, 23, 42, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.exercicio-item-info {
  flex: 1;
  min-width: 0;
}

.exercicio-item-nome-linha {
  display: flex;
  align-items: center;
  gap: 6px;
}

.exercicio-item-nome {
  font-weight: 850;
  font-size: 0.96rem;
}

.exercicio-item-resumo {
  color: #94a3b8;
  font-size: 0.82rem;
  margin-top: 2px;
}

.exercicio-item-marcador {
  display: inline-block;
  background: rgba(190, 242, 100, 0.14);
  border: 1px solid rgba(190, 242, 100, 0.4);
  color: #bef264;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.exercicio-item-acoes {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.exercicio-item-acoes button {
  appearance: none;
  cursor: pointer;
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #e2e8f0;
  border-radius: 10px;
  width: 32px;
  height: 32px;
  font-size: 0.9rem;
}

.exercicio-item-acoes button:disabled {
  opacity: 0.35;
  cursor: default;
}

.exercicio-item-acoes button:not(:disabled):active {
  transform: translateY(1px) scale(0.99);
}

.adicionar-exercicio {
  display: block;
  width: 100%;
  text-align: center;
  background: rgba(148, 163, 184, 0.12);
  border: 1px dashed rgba(148, 163, 184, 0.4);
  border-radius: 14px;
  padding: 14px;
  font-weight: 800;
  color: #e2e8f0;
  cursor: pointer;
  appearance: none;
}

.adicionar-exercicio:active {
  transform: translateY(1px) scale(0.99);
}

button.primary {
  appearance: none;
  display: block;
  width: 100%;
  border: none;
  border-radius: 18px;
  padding: 17px 12px;
  font-size: 1.05rem;
  font-weight: 950;
  cursor: pointer;
  touch-action: manipulation;
  background: #bef264;
  color: #06110a;
}

button.primary:active {
  transform: translateY(1px) scale(0.99);
}

button.danger {
  appearance: none;
  display: block;
  width: 100%;
  margin-top: 12px;
  border: 1px solid rgba(248, 113, 113, 0.4);
  border-radius: 18px;
  padding: 15px 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
}

button.danger:active {
  transform: translateY(1px) scale(0.99);
}

.mensagem {
  margin-top: 14px;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.9rem;
  font-weight: 700;
}

.mensagem.erro {
  background: rgba(251, 113, 133, 0.14);
  border: 1px solid rgba(251, 113, 133, 0.4);
  color: #fb7185;
}

.mensagem.sucesso {
  background: rgba(190, 242, 100, 0.14);
  border: 1px solid rgba(190, 242, 100, 0.4);
  color: #bef264;
}

/* Modal de busca/prescrição */

.picker-card {
  position: relative;
  width: min(560px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.picker-cabecalho {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 10px;
}

.picker-cabecalho h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 1.02rem;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-fechar,
.picker-voltar {
  appearance: none;
  cursor: pointer;
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #e2e8f0;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-weight: 800;
  flex-shrink: 0;
}

.picker-fechar:active,
.picker-voltar:active {
  transform: translateY(1px) scale(0.99);
}

#pickerBusca[hidden] {
  display: none;
}

#pickerBusca {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.picker-filtros {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px 12px;
  flex-shrink: 0;
}

.picker-filtros input {
  width: 100%;
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
}

.filtro-toggle {
  width: 100%;
  appearance: none;
  text-align: left;
  cursor: pointer;
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #e2e8f0;
}

.filtro-toggle:active {
  transform: translateY(1px) scale(0.99);
}

.filtro-opcoes {
  margin-top: 6px;
  max-height: 160px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(2, 6, 23, 0.4);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filtro-opcoes[hidden] {
  display: none;
}

.filtro-opcao {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: #cbd5e1;
}

.filtro-opcao input {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.picker-limpar {
  appearance: none;
  cursor: pointer;
  background: transparent;
  border: none;
  color: #7dd3fc;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 4px 0;
  text-align: center;
}

.picker-limpar:active {
  opacity: 0.7;
}

.picker-resultados {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.picker-resultado-item {
  appearance: none;
  text-align: left;
  cursor: pointer;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  padding: 10px 12px;
  color: inherit;
}

.picker-resultado-item:active {
  transform: translateY(1px) scale(0.995);
}

.picker-resultado-item[aria-pressed="true"] {
  background: rgba(190, 242, 100, 0.16);
  border-color: rgba(190, 242, 100, 0.45);
}

.picker-resultado-item[aria-pressed="true"] .picker-resultado-nome {
  color: #bef264;
}

.picker-resultado-cabecalho {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.picker-resultado-nome {
  font-weight: 800;
  font-size: 0.92rem;
}

.picker-resultado-grupos {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.picker-resultado-grupos span {
  background: rgba(148, 163, 184, 0.16);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.68rem;
  color: #cbd5e1;
}

.picker-vazio {
  text-align: center;
  color: #94a3b8;
  padding: 30px 10px;
}

.picker-prescricao {
  flex: 1;
  min-height: 0;
  padding: 0 16px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.picker-prescricao .campo {
  margin-bottom: 12px;
}

.picker-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.picker-checkbox input {
  width: 18px;
  height: 18px;
}

.picker-checkbox label {
  margin: 0;
}

.picker-isometria-campos {
  background: rgba(2, 6, 23, 0.4);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 12px;
}

.picker-isometria-campos[hidden] {
  display: none;
}

.picker-agrupamento {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
