.settings {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 3rem;
  align-items: stretch;
}

.settings-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3rem;
  align-items: stretch;
  min-width: 0;
}

@media (min-width: 820px) {
  .settings-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }
}

.settings-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 2rem 2.5rem 2.5rem;
  border-radius: 20px;
  border: 1px solid rgba(199, 212, 222, 0.6);
  box-shadow: 0 8px 32px -8px rgba(31, 39, 51, 0.12);
  transition: all 200ms ease;
  height: 100%;
  background: var(--surface);
  min-width: 0;
  overflow-wrap: break-word;
  overflow: hidden;
  box-sizing: border-box;
}

.settings-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 48px -8px rgba(31, 39, 51, 0.18);
  border-color: rgba(15, 173, 185, 0.2);
}

.settings-card__header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(199, 212, 222, 0.4);
  margin-bottom: 0.5rem;
  grid-row: 1;
  min-height: 5rem;
  justify-content: flex-start;
  overflow: hidden;
  box-sizing: border-box;
}

.settings-card h2 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.settings-lead {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: none;
  white-space: normal;
  box-sizing: border-box;
  max-width: 100%;
  width: 100%;
}

.settings-lead strong,
.settings-email {
  word-break: break-word;
  overflow-wrap: break-word;
  display: inline;
  max-width: 100%;
  hyphens: none;
  font-weight: 600;
  color: var(--text);
}

.settings-card__form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 0;
  min-height: 0;
  grid-row: 2;
  overflow: hidden;
  box-sizing: border-box;
  width: 100%;
}

.settings-card__form label {
  margin-top: 0;
  margin-bottom: 0.4rem;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text);
}

.settings-card__form .error-list {
  margin: 0;
}

.settings-card__form .hint {
  margin-top: 0.1rem;
  min-height: 3.5rem;
  display: flex;
  align-items: flex-start;
  flex-shrink: 0;
  line-height: 1.4;
  text-align: left;
  word-spacing: normal;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  box-sizing: border-box;
  max-width: 100%;
  width: 100%;
}

.settings-card__form button,
.settings-card__form .button {
  align-self: stretch;
  margin-top: auto;
  width: 100%;
  flex-shrink: 0;
  box-sizing: border-box;
  max-width: 100%;
}

.settings-card__form > *:not(button):not(.button) {
  flex-shrink: 0;
}

.settings-card__form > button:last-child,
.settings-card__form > .button:last-child {
  margin-top: auto;
}

.settings-card__form input[type="email"] {
  word-break: break-all;
  overflow-wrap: break-word;
  min-width: 0;
  box-sizing: border-box;
  max-width: 100%;
}

.settings-card__form input[type="text"] {
  word-break: break-all;
  overflow-wrap: break-word;
  min-width: 0;
  box-sizing: border-box;
  max-width: 100%;
}

.settings-card--full .settings-card__form .hint {
  margin-top: 0.1rem;
  margin-bottom: 0.5rem;
}

.settings-card--full .settings-card__form button {
  margin-top: 0;
}

.settings-card--deletion {
  border-color: rgba(196, 69, 54, 0.3);
  background: rgba(196, 69, 54, 0.02);
  position: relative;
}

.settings-card--deletion:hover {
  border-color: rgba(196, 69, 54, 0.5);
  background: rgba(196, 69, 54, 0.04);
  transform: translateY(-3px);
  box-shadow: 0 12px 48px -8px rgba(196, 69, 54, 0.15);
}

.settings-card__title--danger {
  color: var(--error) !important;
}

.hint--danger {
  color: var(--error) !important;
}

@media (max-width: 640px) {
  .settings {
    gap: 2.5rem;
  }

  .settings-stack {
    gap: 2.5rem;
  }

  .settings-card {
    padding: 1.75rem 2rem;
    border-radius: 16px;
  }

  .settings-card__header {
    padding-bottom: 1.25rem;
    gap: 0.4rem;
  }

  .settings-card h2 {
    font-size: 1.3rem;
  }
}
