.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(20,20,35,0.5); z-index: 1000;
  padding: 2rem 1rem; overflow-y: auto;
  align-items: flex-start; justify-content: center;
}
.modal-backdrop.show { display: flex; }

.modal-card {
  background: white; border-radius: 12px; width: 100%;
  max-width: 720px; padding: 1.5rem;
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
}

.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem; padding-bottom: 1rem;
  border-bottom: 1px solid #f0f0f5;
}
.modal-header h2 { font-size: 1.1rem; font-weight: 600; color: #1a1a2e; }
.modal-close { background: transparent; border: none; font-size: 1.5rem; cursor: pointer; color: #888; line-height: 1; padding: 0 0.4rem; }
.modal-close:hover { color: #1a1a2e; }

.modal-form .form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem 1rem;
}
.modal-form .form-grid .full { grid-column: 1 / -1; }

.modal-form label.lbl {
  display: block; font-size: 0.78rem; color: #555;
  font-weight: 500; margin-bottom: 0.25rem;
}
.modal-form input[type=text], .modal-form input[type=email], .modal-form input[type=tel] {
  width: 100%; padding: 0.55rem 0.75rem; border: 1px solid #ddd;
  border-radius: 8px; font-size: 0.95rem; font-family: inherit; background: white;
}
.modal-form input:focus { outline: 2px solid #1a1a2e; outline-offset: 0; border-color: #1a1a2e; }

.modal-form .radio-row, .modal-form .check-row { display: flex; align-items: center; gap: 1rem; }
.modal-form .radio-row label, .modal-form .check-row label {
  font-size: 0.9rem; color: #1a1a2e; display: flex; align-items: center;
  gap: 0.4rem; cursor: pointer; font-weight: 500;
}

.modal-form .section-title {
  grid-column: 1 / -1;
  font-size: 0.72rem; color: #888; text-transform: uppercase;
  font-weight: 600; letter-spacing: 0.5px;
  margin-top: 0.5rem; padding-top: 1rem;
  border-top: 1px solid #f0f0f5;
}
.modal-form .form-grid .section-title:first-child { margin-top: 0; padding-top: 0; border-top: none; }

.modal-actions {
  display: flex; justify-content: flex-end; gap: 0.6rem;
  margin-top: 1.25rem; padding-top: 1.25rem;
  border-top: 1px solid #f0f0f5;
}
.modal-actions button {
  padding: 0.55rem 1.25rem; border: none; border-radius: 8px;
  font-size: 0.9rem; font-weight: 500; cursor: pointer; font-family: inherit;
}
.modal-actions .cancel { background: #e5e5ea; color: #1a1a2e; }
.modal-actions .cancel:hover { background: #d5d5da; }
.modal-actions .save { background: #1a1a2e; color: white; }
.modal-actions .save:hover { background: #2d2d54; }
.modal-actions .save:disabled { background: #888; cursor: not-allowed; }

.modal-error {
  display: none; padding: 0.6rem 1rem;
  background: #ffeded; border-left: 3px solid #b40000;
  border-radius: 4px; margin-bottom: 1rem;
  font-size: 0.9rem; color: #5a0000;
}

.nif-feedback { font-size: 0.8rem; margin-top: 0.25rem; min-height: 1em; }
.nif-feedback.ok { color: #1f7a1f; }
.nif-feedback.bad { color: #b40000; }

.combo-wrap { position: relative; }
.combo-wrap input.combo-selected { background: #f0f8ff; border-color: #1e54b7; }
.combo-dropdown {
  position: absolute; top: calc(100% + 2px); left: 0; right: 0;
  background: white; border: 1px solid #ddd; border-radius: 8px;
  max-height: 240px; overflow-y: auto; z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.combo-item {
  padding: 0.5rem 0.75rem; cursor: pointer; font-size: 0.9rem;
  display: flex; justify-content: space-between; align-items: center;
}
.combo-item:hover, .combo-item.active { background: #f0f8ff; }
.combo-code {
  font-size: 0.72rem; color: #888; font-family: monospace;
  background: #f0f0f5; padding: 0.1rem 0.4rem; border-radius: 4px;
}
.combo-empty { padding: 0.75rem; color: #999; font-style: italic; font-size: 0.85rem; }
