/* ── Modal overlay ───────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  z-index: 500;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(5px);
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}
.modal-overlay.open { display: flex; animation: fade-in 0.18s var(--ease); }

/* ── Modal box ───────────────────────────────────────────────── */
.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-top: 3px solid var(--yellow);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  width: 480px;
  max-width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  animation: slide-up 0.25s var(--ease);
  box-shadow: var(--shadow-md);
  position: relative;
}

/* ── Modal header ────────────────────────────────────────────── */
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
  gap: var(--space-md);
}
.modal-header h3 {
  font-family: var(--font-title);
  font-size: 1.6rem;
  letter-spacing: 0.05em;
  line-height: 1.1;
}
.modal-header .subtitle { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.modal-close {
  background: var(--card);
  border: 1px solid var(--border2);
  color: var(--text-muted);
  width: 34px; height: 34px;
  padding: 0;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  line-height: 1;
}
.modal-close:hover {
  color: var(--text);
  border-color: var(--yellow);
  background: var(--yellow-dim);
}
.modal-close:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}

/* ── Form ────────────────────────────────────────────────────── */
.modal form { display: flex; flex-direction: column; gap: var(--space-md); }
.form-group { display: flex; flex-direction: column; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
.form-hint  { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

/* ── Footer ──────────────────────────────────────────────────── */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 540px) {
  .modal { padding: var(--space-lg); border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .form-row { grid-template-columns: 1fr; }
}
