dialog[open], dialog[open]:not([hidden]) {
  display: flex !important;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
/* =========================
   Estilos globales
========================= */
body {
  font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
  background-color: #f3f4f6;
  margin: 0;
  padding: 0;
  
}

.container {
  max-width: 1200px;
  margin: 40px auto;
  padding: 20px;
}

h1 {
  margin-bottom: 24px;
  color: #3a3a3a;
  font-weight: 700;
  font-size: 2.2rem;
}

.top-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;

}

#buscador {
  width: 220px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 2px solid #e5e7eb;
  font-size: 1rem;
  transition: border-color 0.2s;
  font-size: 1rem;
  transition: border-color 0.2s;
}
#buscador:focus {
  border-color: #1976d2;
}

#btnAgregar {
  background-color: #21232a;
  color: #fff;
  border-radius: 8px;
  border: none;
  padding: 10px 22px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}
#btnAgregar:hover {
  background-color: #333;
}

#lista-contactos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}

@media (max-width: 900px) {
  #lista-contactos {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 600px) {
  #lista-contactos {
    grid-template-columns: 1fr;
  }
}


.contact-card {
  background: #fff !important;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.contact-card h4 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #3a3a3a;
  margin-bottom: 8px;
}
.contact-card p {
  margin: 5px 0;
  color: #444;
  font-size: 1rem;
}
.contact-card footer {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  background: #fff !important;

}
.contact-card button {
  background: #fff !important;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 6px;
  border-radius: 6px;
  transition: background 0.2s;
}
.contact-card button:hover {
  background: #e5e7eb;
}

dialog[open], dialog[open]:not([hidden]) {
  display: flex !important;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

#contactoDialog article {
  background: #fff;
  padding: 32px 28px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.10);
  width: 520px;
  max-width: 95vw;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
#dialogTitle {
  margin-top: 0;
  color: #3a3a3a;
  font-weight: 700;
  font-size: 1.5rem;
}
#contactoForm {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
#contactoForm label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 500;
  color: #444;
}
#contactoForm input[type="text"],
#contactoForm input[type="tel"],
#contactoForm input[type="email"] {
  padding: 10px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
  outline: none;
}
#contactoForm input:focus {
  border-color: #1976d2;
}
#contactoForm footer {
  grid-column: span 2;
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  margin-top: 18px;
}
#btnGuardar {
  background: #1976d2;
  color: #fff;
  border-radius: 8px;
  border: none;
  padding: 10px 28px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
#btnGuardar:hover {
  background: #1565c0;
}
#btnCancelar {
  background: #455a64;
  color: #fff;
  border-radius: 8px;
  border: none;
  padding: 10px 28px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
#btnCancelar:hover {
  background: #263238;
}

h1 {
  margin-bottom: 24px;
  color: #3a3a3a;
  font-weight: 700;
}

/* =========================
   Barra de búsqueda y botón
========================= */
.top-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

#buscar {
  padding: 10px 14px;
  border-radius: 8px;
  border: 2px solid #e5e7eb;
  width: 250px;
  font-size: 1rem;
  transition: border-color 0.2s;
}
#buscar:focus {
  border-color: #1976d2;
}

#btnAgregar {
  background-color: #21232a;
  color: #fff;
  border-radius: 8px;
  border: none;
  padding: 10px 22px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

#btnAgregar:hover {
  background-color: #333;
}

/* =========================
   Lista de contactos
========================= */
#listaContactos {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: flex-start;
}

.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  padding: 24px 20px;
  margin: 12px;
  min-width: 260px;
  flex: 1 1 260px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card h3 {
  margin: 0 0 8px 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: #3a3a3a;
}

.card p {
  margin: 5px 0;
  color: #444;
  font-size: 1rem;
}

.acciones {
  margin-top: 8px;
  display: flex;
  gap: 12px;
}

.acciones button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 6px;
  border-radius: 6px;
  transition: background 0.2s;
}

.acciones button:hover {
  background: #e5e7eb;
  transform: scale(1.2);
}

/* =========================
   Modal
========================= */
#modal {
  display: none; /* oculto por defecto */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: #fff;
  padding: 32px 28px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.10);
  width: 420px;
  max-width: 95%;
}

.modal-content h2 {
  margin-top: 0;
  color: #3a3a3a;
  font-weight: 700;
  font-size: 1.5rem;
}

.modal-content form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-content form input {
  padding: 10px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
  outline: none;
}
.modal-content form input:focus {
  border-color: #1976d2;
}
.modal-actions {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  margin-top: 18px;
}

#btnGuardar {
  background: #1976d2;
  color: #fff;
  border-radius: 8px;
  border: none;
  padding: 10px 28px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

#btnGuardar:hover {
  background: #1565c0;
}

#btnCancelar {
  background: #455a64;
  color: #fff;
  border-radius: 8px;
  border: none;
  padding: 10px 28px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

#btnCancelar:hover {
  background: #263238;
}