:root {
  --profile-ink: #1f2937;
  --profile-muted: #536176;
  /* Was #d6dde6, a third border colour competing with --border and the
   * dashboard's hardcoded #dbe8f4. Aliased so profile.css and
   * user-console.css inherit the shared edge instead of drifting. */
  --profile-border: var(--border-strong);
  --profile-accent: #1e88e5;
}

.profile-page {
  min-height: calc(100vh - var(--topbar-h));
  padding: clamp(2rem, 4vw, 4rem) 1rem 3.5rem;
}

.profile-shell {
  width: min(940px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 1.2rem;
}

.profile-header { margin-bottom: 0.5rem; }

.profile-eyebrow {
  margin: 0;
  color: var(--profile-muted);
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  font-weight: 700;
}

.profile-header h1,
.profile-header h2 {
  margin: 0.35rem 0 0.45rem;
  color: var(--profile-ink);
}

.profile-lead {
  margin: 0;
  max-width: 62ch;
  color: var(--profile-muted);
}

.profile-card {
  border: 1px solid var(--profile-border);
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff, #f8fbfd);
  box-shadow: 0 24px 38px rgba(38, 61, 89, 0.11);
  padding: clamp(1.25rem, 2.6vw, 2rem);
}

.profile-form {
  display: grid;
  gap: 1.5rem;
}

.profile-avatar-block {
  border: 1px dashed var(--profile-border);
  border-radius: 16px;
  background: linear-gradient(180deg, #f9fcff, #f4faf5);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
}

.avatar-wrap {
  width: 112px;
  height: 112px;
  border-radius: 999px;
  overflow: hidden;
  border: 3px solid #edf2f7;
  margin-bottom: 0.35rem;
  background: #ececec;
  flex-shrink: 0;
}

.profile-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-upload-label {
  font-weight: 700;
  color: var(--profile-ink);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--profile-border);
  background: #fff;
  cursor: pointer;
  font-size: 0.88rem;
  transition: background 0.15s;
}

.avatar-upload-label:hover { background: #f0f7ff; }

.avatar-help {
  margin: 0;
  color: var(--profile-muted);
  font-size: 0.82rem;
}

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

.field {
  display: grid;
  gap: 0.4rem;
}

.field span {
  font-weight: 700;
  color: var(--profile-ink);
  font-size: 0.9rem;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--profile-border);
  border-radius: 12px;
  padding: 0.72rem 0.85rem;
  background: #ffffff;
  color: var(--profile-ink);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.field input:focus,
.field select:focus {
  outline: 3px solid rgba(30, 136, 229, 0.18);
  border-color: #1e88e5;
}

.field input[readonly] {
  background: #f8fafc;
  color: var(--profile-muted);
  cursor: default;
}

.password-card { }

.password-card-header h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--profile-ink);
}

.password-card-header p {
  margin: 0.4rem 0 0;
  color: var(--profile-muted);
  font-size: 0.9rem;
}

.password-reset-actions { margin-top: 1rem; }

.profile-actions {
  display: flex;
  justify-content: flex-end;
}

.profile-status {
  min-height: 1.2rem;
  margin: 0.5rem 0 0;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--profile-muted);
}

.profile-status.is-success { color: #027a48; }
.profile-status.is-error   { color: #b42318; }
.profile-status.is-info    { color: #0d5ea4; }

/* Buttons */
.btn,
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.35rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
}

.btn:disabled,
.btn-primary:disabled,
.btn-secondary:disabled { opacity: 0.5; cursor: default; }

.btn:not(:disabled):hover,
.btn-primary:not(:disabled):hover,
.btn-secondary:not(:disabled):hover { opacity: 0.85; }

.btn:not(:disabled):active,
.btn-primary:not(:disabled):active,
.btn-secondary:not(:disabled):active { transform: scale(0.97); }

.btn-primary {
  background: var(--profile-accent);
  color: #fff;
  border-color: #1976d2;
}

.btn-secondary {
  background: #fff;
  color: var(--profile-ink);
  border: 1px solid var(--profile-border);
}

.btn-secondary:not(:disabled):hover { background: #f4f8ff; }

/* Passkeys */
.passkeys-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.passkey-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--profile-border);
  border-radius: 10px;
  background: #f8fafc;
  font-size: 0.85rem;
}

.passkey-row span { flex: 1; }
.passkey-row small { color: var(--profile-muted); font-size: 0.73rem; }

.passkey-del {
  background: none;
  border: none;
  color: #b42318;
  cursor: pointer;
  font-size: 0.78rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

.passkey-del:hover { background: #fef2f2; }

@media (max-width: 760px) {
  .profile-fields { grid-template-columns: 1fr; }
  .profile-actions { justify-content: stretch; }
  .profile-actions .btn,
  .password-reset-actions .btn { width: 100%; }
}
