*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f0f4f8;
  color: #1a202c;
  line-height: 1.5;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

header {
  background: #1e40af;
  color: #fff;
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
}

header a {
  color: #bfdbfe;
  text-decoration: none;
  font-size: 0.95rem;
}

header a:hover {
  color: #fff;
  text-decoration: underline;
}

.card {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  margin-bottom: 1.5rem;
}

.card h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  color: #1e40af;
  border-bottom: 2px solid #dbeafe;
  padding-bottom: 0.5rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.form-group input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.15s;
}

.form-group input:focus {
  outline: none;
  border-color: #1e40af;
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.15);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead th {
  background: #eff6ff;
  color: #1e3a8a;
  padding: 0.6rem 0.5rem;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

tbody td {
  padding: 0.4rem 0.35rem;
  vertical-align: middle;
  border-bottom: 1px solid #e2e8f0;
}

tbody input {
  width: 100%;
  padding: 0.45rem 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 0.9rem;
}

tbody input:focus {
  outline: none;
  border-color: #1e40af;
}

tbody input.input-error {
  border-color: #dc2626;
  background: #fef2f2;
}

tbody input.input-ok {
  border-color: #16a34a;
}

.dni-hint {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.15rem;
}

.dni-hint.error {
  color: #dc2626;
}

.dni-hint.ok {
  color: #16a34a;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1.1rem;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: #1e40af;
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #1e3a8a;
}

.btn-danger {
  background: #fee2e2;
  color: #dc2626;
  padding: 0.35rem 0.6rem;
  font-size: 1rem;
  line-height: 1;
}

.btn-danger:hover:not(:disabled) {
  background: #fecaca;
}

.btn-add {
  background: #dbeafe;
  color: #1e40af;
  padding: 0.4rem 0.75rem;
  font-size: 1.2rem;
  line-height: 1;
  margin-top: 0.75rem;
}

.btn-add:hover {
  background: #bfdbfe;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.alert {
  padding: 0.85rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.alert-success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.equipo-item {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.equipo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: #f8fafc;
  cursor: pointer;
  user-select: none;
  gap: 0.5rem;
}

.equipo-header:hover {
  background: #eff6ff;
}

.equipo-header h3 {
  margin: 0;
  font-size: 1rem;
  color: #1e3a8a;
}

.equipo-meta {
  font-size: 0.8rem;
  color: #64748b;
  white-space: nowrap;
}

.equipo-body {
  display: none;
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid #e2e8f0;
}

.equipo-item.open .equipo-body {
  display: block;
}

.equipo-header .toggle {
  font-size: 1.1rem;
  color: #64748b;
  transition: transform 0.2s;
}

.equipo-item.open .equipo-header .toggle {
  transform: rotate(180deg);
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: #64748b;
}

.empty-state p {
  margin: 0.5rem 0 0;
}

.badge {
  display: inline-block;
  background: #dbeafe;
  color: #1e40af;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

@media (max-width: 640px) {
  header h1 {
    font-size: 1.2rem;
  }

  thead th,
  tbody td {
    font-size: 0.8rem;
    padding: 0.35rem 0.25rem;
  }
}
