:root {
  --border-default: #D1D5DA;
  --t-fast: 120ms;
  --t-base: 180ms;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(18, 35, 62, 0.6);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-base) var(--ease), visibility var(--t-base);
}
.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}
.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2.5rem;
  position: relative;
  transform: translateY(12px);
  transition: transform var(--t-base) var(--ease);
}
.modal-overlay.is-open .modal {
  transform: translateY(0);
}
.modal-close {
  position: absolute;
  top: 1rem; right: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--slate);
  padding: 0.4rem;
  transition: color var(--t-fast);
}
.modal-close:hover { color: var(--ink); }
.modal-close svg { width: 20px; height: 20px; }
.modal-title {
  font-family: 'Archivo', sans-serif;
  font-weight: 600;
  font-size: 1.4rem;
  color: var(--ink);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}
.modal-subtitle {
  font-size: 0.88rem;
  color: var(--slate);
  margin-bottom: 2rem;
  line-height: 1.5;
}
.modal-step { display: none; }
.modal-step.is-active { display: block; }

.modal-choice {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.modal-choice-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--rule);
  background: var(--bg-base);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.modal-choice-btn:hover {
  border-color: var(--cyan);
  background: var(--bg-brand-soft);
}
.modal-choice-btn .choice-icon {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg-brand-soft);
  color: var(--cyan);
}
.modal-choice-btn .choice-icon svg { width: 20px; height: 20px; }
.modal-choice-btn .choice-label {
  font-family: 'Archivo', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
}
.modal-choice-btn .choice-desc {
  font-size: 0.82rem;
  color: var(--slate);
  margin-top: 0.15rem;
}

.modal-legal {
  font-size: 0.78rem;
  color: var(--slate);
  line-height: 1.65;
  max-height: 280px;
  overflow-y: auto;
  padding: 1.25rem;
  border: 1px solid var(--rule);
  background: var(--bg-base);
  margin-bottom: 1.5rem;
}
.modal-legal a { color: var(--cyan); }
.modal-legal strong { color: var(--ink); font-weight: 600; }
.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}
.modal-actions .btn { font-size: 0.85rem; padding: 0.7rem 1.25rem; }

.modal-form { display: flex; flex-direction: column; gap: 1rem; }
.modal-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.modal-field label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate);
}
.modal-field label .req { color: var(--cyan); margin-left: 0.15em; }
.modal-field input:invalid:not(:placeholder-shown) {
  border-color: #DC2626;
}
.modal-field input,
.modal-field textarea {
  font-family: 'Manrope', sans-serif;
  font-size: 0.9rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border-default);
  background: var(--bg-base);
  color: var(--ink);
  outline: none;
  transition: border-color var(--t-fast);
}
.modal-field input:focus,
.modal-field textarea:focus { border-color: var(--cyan); }
.modal-field textarea { resize: vertical; min-height: 80px; }
.modal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.modal-success {
  text-align: center;
  padding: 2rem 0;
}
.modal-success .check-icon {
  width: 48px; height: 48px;
  margin: 0 auto 1rem;
  color: #10B981;
}
.modal-success p {
  font-size: 0.9rem;
  color: var(--slate);
  margin-top: 0.5rem;
}

@media (max-width: 520px) {
  .modal { padding: 1.5rem; }
  .modal-row { grid-template-columns: 1fr; }
}
