:root {
  color-scheme: light;
  --cor-fundo: #f7f8fa;
  --cor-texto: #1c1f24;
  --cor-borda: #cfd4da;
  --cor-primaria: #0a5f9e;
  --cor-primaria-escura: #074a7b;
  --cor-erro: #b3261e;
  --cor-erro-fundo: #fbeaea;
  --cor-sucesso: #1a7f4b;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--cor-fundo);
  color: var(--cor-texto);
  line-height: 1.4;
}

header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: white;
  border-bottom: 1px solid var(--cor-borda);
}

header .marca { font-weight: 700; font-size: 1.1rem; margin-right: auto; }
header nav { display: flex; gap: 0.5rem; }

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--cor-primaria);
  background: var(--cor-primaria);
  color: white;
  border-radius: 6px;
  padding: 0.5rem 1rem;
}
button:hover { background: var(--cor-primaria-escura); }
button.secundario, .nav-botao {
  background: white;
  color: var(--cor-primaria);
}
button.secundario:hover, .nav-botao:hover { background: #eaf2f8; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

main { max-width: 1200px; margin: 0 auto; padding: 1.25rem; }

section { background: white; border: 1px solid var(--cor-borda); border-radius: 8px; padding: 1.25rem; margin-bottom: 1rem; }

h1 { font-size: 1.4rem; margin-top: 0; }
h2 { font-size: 1.15rem; }

label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  font-size: 0.9rem;
}

input, select {
  font: inherit;
  padding: 0.5rem;
  border: 1px solid var(--cor-borda);
  border-radius: 6px;
  font-weight: 400;
}

.erro {
  color: var(--cor-erro);
  background: var(--cor-erro-fundo);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  font-weight: 500;
  font-size: 0.9rem;
  min-height: 1px;
}
.erro:empty { display: none; }

.filtros { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1rem; }
.filtros label { margin-bottom: 0; }
.filtros button { align-self: flex-end; height: 2.6rem; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--cor-borda); }
td.acoes { display: flex; gap: 0.4rem; flex-wrap: wrap; }
td.acoes button { padding: 0.3rem 0.6rem; font-size: 0.85rem; }

.status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: #e5e9ef;
}
.status-confirmado { background: #dbeafe; color: #1e40af; }
.status-presente { background: #fef3c7; color: #92400e; }
.status-atendido { background: #dcfce7; color: #166534; }
.status-cancelado, .status-faltou { background: #fee2e2; color: #991b1b; }

.busca { display: flex; gap: 0.75rem; margin-bottom: 1rem; }
.busca input { flex: 1; }

.lista-resultados { list-style: none; padding: 0; margin: 0 0 1rem; max-height: 260px; overflow-y: auto; }
.lista-resultados li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  border: 1px solid var(--cor-borda);
  border-radius: 6px;
  margin-bottom: 0.4rem;
}

dialog {
  border: none;
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 480px;
  width: 92%;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.4); }

@media (max-width: 640px) {
  header { flex-wrap: wrap; }
  main { padding: 0.75rem; }
  .filtros { flex-direction: column; align-items: stretch; }
  table, thead, tbody, th, td, tr { display: block; }
  thead { display: none; }
  #agenda-tabela tr { border: 1px solid var(--cor-borda); border-radius: 6px; margin-bottom: 0.6rem; padding: 0.4rem; }
  #agenda-tabela td { border: none; padding: 0.25rem 0.4rem; }
}
