.profile-page {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(38px, 7vw, 76px) 0 80px;
}

.profile-hero {
  max-width: 760px;
  margin-bottom: 28px;
}

.profile-hero h1 {
  max-width: 690px;
  margin: 8px 0 14px;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 6vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.profile-lede {
  max-width: 660px;
  color: var(--text-secondary);
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.profile-status-card,
.profile-card,
.profile-explainer {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.profile-status-card {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 620px;
  margin-top: 24px;
  padding: 14px 16px;
}

.profile-status-card p,
.profile-card p {
  margin: 4px 0 0;
  color: var(--text-secondary);
}

.profile-status-dot {
  width: 12px;
  height: 12px;
  flex: none;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--muted) 16%, transparent);
}

.profile-status-dot.is-connected {
  background: var(--green);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--green) 17%, transparent);
}

.profile-status-dot.is-error {
  background: var(--danger);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--danger) 17%, transparent);
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.profile-card,
.profile-explainer {
  padding: clamp(20px, 4vw, 30px);
}

.profile-card h2,
.profile-explainer h2 {
  margin: 6px 0 10px;
  font-family: var(--font-display);
  line-height: 1.1;
}

.profile-step {
  color: var(--accent) !important;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.profile-card .btn {
  margin-top: 18px;
}

.profile-card form {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.profile-card label {
  font-size: 0.82rem;
  font-weight: 750;
}

.profile-key-input {
  width: 100%;
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: 700 0.9rem/1.2 var(--font-mono, monospace);
  letter-spacing: 0.035em;
}

.profile-key-input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 34%, transparent);
  outline-offset: 2px;
  border-color: var(--accent);
}

.profile-connected {
  margin-top: 18px;
}

.profile-connected-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.profile-sync-time {
  color: var(--muted);
  font-size: 0.78rem;
}

.profile-key-row,
.profile-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.profile-key-row code {
  flex: 1 1 340px;
  overflow-wrap: anywhere;
  padding: 12px 14px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
}

.profile-key-row .btn,
.profile-actions .btn {
  margin-top: 0;
}

.profile-danger {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.profile-danger summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 750;
}

.profile-explainer {
  margin-top: 18px;
}

.profile-explainer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.profile-explainer-grid div {
  display: grid;
  gap: 4px;
}

.profile-explainer-grid span,
.profile-privacy-link {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.profile-message {
  min-height: 1.5em;
  margin: 16px 2px 0;
  color: var(--text-secondary);
}

.profile-message.is-error {
  color: var(--danger);
}

@media (max-width: 680px) {
  .profile-grid,
  .profile-explainer-grid {
    grid-template-columns: 1fr;
  }

  .profile-page {
    width: min(100% - 22px, 960px);
    padding-top: 28px;
  }

  .profile-connected-heading {
    display: block;
  }

  .profile-sync-time {
    display: block;
    margin-top: 8px;
  }
}

@media (forced-colors: active) {
  .profile-status-dot {
    border: 2px solid CanvasText;
  }
}
