.profile-page {
  min-height: 100vh;
}

.profile-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
  padding: 0 3vw;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 5, 5, 0.9);
  backdrop-filter: blur(20px);
}

.profile-header-actions,
.profile-hero-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.profile-shell {
  width: min(1180px, calc(100% - 6vw));
  margin: 0 auto;
  padding: 2rem 0 5rem;
}

.profile-shell:not(.is-ready) #authView,
.profile-shell:not(.is-ready) #dashboardView {
  opacity: 0;
  pointer-events: none;
}

.profile-shell.is-ready #authView,
.profile-shell.is-ready #dashboardView {
  animation: profileFadeIn 400ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes profileFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.profile-auth-card {
  min-height: calc(100vh - 150px);
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 0.7fr);
  align-items: center;
  gap: clamp(1.5rem, 5vw, 4rem);
}

.profile-auth-copy h1,
.profile-hero-card h1,
.profile-content h2 {
  margin: 0;
  font-family: var(--display-font);
  font-weight: 650;
  line-height: 1;
}

.profile-auth-copy h1 {
  margin-top: 0.45rem;
  font-size: clamp(3rem, 7vw, 5rem);
}

.profile-auth-copy p,
.profile-hero-card p,
.profile-content p {
  color: var(--muted);
}

.profile-auth-copy p {
  max-width: 560px;
  font-size: 1.06rem;
}

.profile-auth-form {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 100% 0%, rgba(217, 189, 120, 0.14), transparent 15rem),
    rgba(255, 255, 255, 0.03);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.profile-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.7rem;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

.profile-divider::before,
.profile-divider::after {
  height: 1px;
  content: "";
  background: var(--line);
}

.primary-link.is-disabled {
  pointer-events: none;
  opacity: 0.58;
  box-shadow: none;
}

.profile-kicker {
  display: inline-flex;
  width: fit-content;
  min-height: 26px;
  align-items: center;
  border: 1px solid rgba(217, 189, 120, 0.22);
  border-radius: 999px;
  padding: 0 0.65rem;
  color: var(--cyan-2);
  background: rgba(217, 189, 120, 0.06);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.profile-dashboard {
  display: grid;
  gap: 1rem;
}

.profile-hero-card,
.profile-layout,
.profile-content {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.026);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
}

.profile-hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
}

.profile-hero-main {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
}

.profile-hero-card h1,
.profile-hero-card p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-hero-card h1 {
  margin-top: 0.35rem;
  font-size: clamp(2rem, 5vw, 3.6rem);
}

.profile-hero-card p {
  margin: 0.35rem 0 0;
}

.profile-avatar-xl {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(217, 189, 120, 0.08);
  color: var(--cyan-2);
  font-size: 1.35rem;
  font-weight: 950;
}

.profile-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem;
}

.profile-nav {
  display: grid;
  align-content: start;
  gap: 0.5rem;
}

.profile-nav button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 850;
  padding: 0 0.85rem;
  text-align: left;
}

.profile-nav button:hover,
.profile-nav button:focus-visible,
.profile-nav button.is-active {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
}

.profile-nav button.is-active {
  border-color: var(--line-strong);
  color: var(--cyan-2);
}

.profile-content {
  min-height: 460px;
  padding: 1rem;
}

.profile-content h2 {
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.profile-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.profile-stat-card,
.profile-order-card,
.profile-ledger-row,
.profile-reward-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
}

.profile-stat-card {
  min-height: 110px;
  display: grid;
  align-content: end;
  gap: 0.25rem;
  padding: 1rem;
}

.profile-stat-card strong {
  color: var(--text);
  font-family: var(--display-font);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 650;
  line-height: 1;
}

.profile-stat-card span,
.profile-order-card span,
.profile-ledger-row span,
.profile-reward-row span {
  color: var(--muted);
}

.profile-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.profile-order-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  padding: 1rem;
}

.profile-order-card h3,
.profile-ledger-row strong,
.profile-reward-row strong {
  margin: 0;
}

.profile-order-card p {
  margin: 0.35rem 0 0;
}

.profile-order-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.profile-reward-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.8rem;
  margin-top: 1rem;
}

.profile-ledger-row,
.profile-reward-row {
  display: grid;
  gap: 0.2rem;
  padding: 0.85rem;
}

.profile-empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  padding: 1rem;
}

@media (max-width: 820px) {
  .profile-shell {
    width: min(100% - 2rem, 1180px);
  }

  .profile-header-actions {
    gap: 0.45rem;
  }

  .profile-auth-card,
  .profile-layout,
  .profile-stat-grid,
  .profile-reward-form {
    grid-template-columns: 1fr;
  }

  .profile-hero-card,
  .profile-hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .profile-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-order-card {
    grid-template-columns: 1fr;
  }
}
