/* Shared modal shell, forms, and modal actions */
.modal-shell {
  width: min(100vw - 1.5rem, 44rem);
  max-width: 44rem;
  margin: auto;
  border: none;
  background: transparent;
}

.modal-shell-sm {
  width: min(100vw - 1.5rem, 34rem);
}

.modal-shell-lg {
  width: min(100vw - 1.5rem, 52rem);
}

.modal-panel {
  width: 100%;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 1.5rem;
  padding: 1.35rem;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.18);
  background: rgba(255, 255, 255, 0.96);
}

.modal-stack,
.modal-form-stack,
.modal-intro {
  display: flex;
  flex-direction: column;
}

.modal-stack,
.modal-form-stack {
  gap: 1rem;
}

.modal-intro {
  gap: 0.5rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.modal-header-spaced,
.modal-header-roomy {
  margin-bottom: 1rem;
}

.modal-title {
  color: #0f172a;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.2;
}

.modal-desc,
.modal-help,
.settings-note,
.settings-card-note {
  color: #64748b;
  font-size: 0.9rem;
  line-height: 1.6;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.modal-label {
  color: #334155;
  font-size: 0.9rem;
  font-weight: 700;
}

.modal-input {
  width: 100%;
  min-height: 3rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(203, 213, 225, 0.95);
  border-radius: 1rem;
  background: rgba(248, 250, 252, 0.85);
  color: #0f172a;
}

.modal-input:focus {
  outline: none;
  border-color: rgba(244, 63, 94, 0.4);
  box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.1);
  background: #fff;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.modal-actions-wrap {
  flex-wrap: wrap;
}

.modal-actions-spacious {
  padding-top: 0.25rem;
}

.modal-action-btn {
  min-width: 7rem;
}

.modal-submit-btn {
  flex: 1 1 10rem;
}

.modal-close,
.settings-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  color: #64748b;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.modal-close:focus-visible,
.settings-modal-close:focus-visible {
  outline: 2px solid rgba(244, 63, 94, 0.35);
  outline-offset: 2px;
}

.modal-close:hover,
.settings-modal-close:hover {
  background: rgba(241, 245, 249, 0.95);
  color: #0f172a;
}

@media (max-width: 767px) {
  .modal-panel {
    padding: 1.1rem;
    border-radius: 1.25rem;
  }

  .modal-actions {
    justify-content: stretch;
  }
}
