/* Centrar el contenido principal */
main.container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 2rem 1rem;
  background: #eaf1fb;
  border-radius: 1rem;
  box-shadow: 0 2px 16px rgba(0,0,64,0.08);
}

/* Cabecera */
header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 2rem;
}

header h1 {
  flex: 1 1 100%;
  margin-bottom: 0.5rem;
  font-size: 2rem;
  text-align: center;
  color: #1a237e;
}

#buscador {
  flex: 2 1 60%;
  min-width: 180px;
  background: #e3eafc;
  border: 1px solid #90caf9;
  color: #1a237e;
}

#btnAgregar {
  flex: 1 1 30%;
  min-width: 100px;
  background: #1976d2;
  color: #fff;
  border: none;
  border-radius: 0.5rem;
  transition: background 0.2s;
}
#btnAgregar:hover {
  background: #1565c0;
}

/* Tarjetas de contacto */
#listado {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.2rem;
}

@media (min-width: 600px) {
  #listado {
    grid-template-columns: 1fr 1fr;
  }
}
@media (min-width: 900px) {
  #listado {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.card {
  padding: 1rem;
  border-radius: 0.7rem;
  background: #f5f6fa;
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.10);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 140px;
  border: 1px solid #90caf9;
}

.card header strong {
  font-size: 1.1rem;
  color: h;
}

.card p {
  margin: 0.5rem 0 1rem 0;
  color: lch(0% 0 0);
  font-size: 0.98rem;
}

.card footer {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.card button {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform 0.1s, color 0.2s;
  padding: 0.2rem 0.5rem;
}

.card button.editar {
  color: #1976d2;
}
.card button.editar:hover {
  color: #0d47a1;
  transform: scale(1.2);
}

.card button.borrar {
  color: #90caf9;
}
.card button.borrar:hover {
  color: #c1121f;
  transform: scale(1.2);
}

/* Diálogo */
dialog[open] {
  border-radius: 1rem;
  box-shadow: 0 4px 32px rgba(33, 150, 243, 0.18);
  padding: 2rem 1.5rem;
  max-width: 350px;
  background: #e3f2fd;
  border: 1px solid #90caf9;
}

#formContacto label {
  margin-bottom: 0.7rem;
  color: #1565c0;
}

#formContacto input {
  margin-top: 0.2rem;
  background: #eaf1fb;
  border: 1px solid #90caf9;
  color: #1a237e;
}

#formContacto menu {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1.2rem;
}

#guardar {
  background: #1976d2;
  color: #fff;
  border: none;
  border-radius: 0.5rem;
  transition: background 0.2s;
}
#guardar:hover {
  background: #0d47a1;
}

#cancelar {
  background: #e3eafc;
  color: #1976d2;
  border: none;
  border-radius: 0.5rem;
}
#cancelar:hover {
  background: #bbdefb;
}