.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  margin-bottom: 2rem;
}
.profile-avatar-lg {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 2rem;
  color: #fff;
  flex-shrink: 0;
  background: var(--glass-border);
}
.profile-avatar-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 50%;
  cursor: pointer;
  overflow: visible;
}
.profile-avatar-wrap .profile-avatar-lg {
  width: 100%;
  height: 100%;
}
.profile-avatar-wrap .profile-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.profile-avatar-edit {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  border: 2px solid var(--bg-primary);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.25s, transform 0.25s;
}
.profile-avatar-wrap:hover .profile-avatar-edit,
.profile-avatar-wrap:focus-visible .profile-avatar-edit {
  opacity: 1;
  transform: scale(1);
}

/* Avatar Setting (inside Settings tab) */
.profile-avatar-setting {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: var(--bg-card);
  cursor: pointer;
  margin-bottom: 1.5rem;
  transition: border-color 0.25s, background 0.25s;
}
.profile-avatar-setting:hover {
  border-color: var(--accent-3);
  background: rgba(58,180,233,0.04);
}
.profile-avatar-setting-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.4rem;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.profile-avatar-setting-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.profile-avatar-setting-label {
  font-weight: 600;
  font-size: 0.9rem;
}
.profile-avatar-setting-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.profile-avatar-setting-btn {
  padding: 0.4rem 1rem;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  background: linear-gradient(135deg, rgba(58,180,233,0.15), rgba(42,235,235,0.08));
  color: var(--accent-3);
  border: 1px solid rgba(58,180,233,0.2);
  transition: background 0.25s;
}
.profile-avatar-setting:hover .profile-avatar-setting-btn {
  background: linear-gradient(135deg, rgba(58,180,233,0.25), rgba(42,235,235,0.12));
}
.profile-info h2 {
  font-family: 'Space Grotesk', sans-serif;
  margin-bottom: 0.25rem;
}
.profile-info p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.profile-stats {
  display: flex;
  gap: 2rem;
  margin-top: 0.75rem;
}
.profile-stat-val {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent-3);
}
.profile-stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.profile-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 0;
}
.profile-tab {
  background: none;
  border: none;
  padding: 0.6rem 1.2rem;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.25s;
  margin-bottom: -1px;
}
.profile-tab:hover { color: var(--text-primary); }
.profile-tab.active {
  color: var(--accent-3);
  border-bottom-color: var(--accent-3);
}
.profile-section { display: none; }
.profile-section.active { display: block; }
.profile-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 600px) {
  .profile-header { flex-direction: column; text-align: center; }
  .profile-stats { justify-content: center; }
  .profile-edit-grid { grid-template-columns: 1fr; }
}

/* ── Profile Hero (redesigned v2) ── */
.profile-hero {
  position: relative;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  background: var(--glass-bg);
  overflow: hidden;
  margin-bottom: 1.75rem;
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
}
.profile-hero-cover {
  position: relative;
  height: 100px;
  background:
    radial-gradient(circle at 18% 30%, rgba(58,180,233,0.55), transparent 55%),
    radial-gradient(circle at 78% 22%, rgba(42,235,235,0.42), transparent 60%),
    radial-gradient(circle at 50% 110%, rgba(167,139,250,0.25), transparent 60%),
    linear-gradient(125deg, #061427 0%, #0e3957 38%, #1e7bb0 72%, #2aebeb 110%);
  border-bottom: 1px solid var(--glass-border);
}
.profile-hero-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(rgba(255,255,255,0.07) 1px, transparent 1px);
  background-size: 14px 14px;
  opacity: 0.55;
  pointer-events: none;
}
.profile-hero-cover::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 60px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.25));
  pointer-events: none;
}
.profile-hero-body {
  display: flex;
  padding: 0 2rem 1.75rem;
  margin-top: -72px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  position: relative;
}
.profile-hero-left {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
}
.profile-hero-right {
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 0;
  transform: translateY(-22px);
}
.profile-avatar-wrap--xl {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  border: 4px solid var(--bg-primary);
  box-shadow:
    0 0 0 2px rgba(58,180,233,0.45),
    0 10px 28px rgba(0,0,0,0.45);
  overflow: hidden;
  background: var(--glass-border);
  flex-shrink: 0;
  position: relative;
  transform: translateY(-8px);
}
.profile-avatar-wrap--xl .profile-avatar-img,
.profile-avatar-wrap--xl .profile-avatar-lg {
  width: 100%;
  height: 100%;
  font-size: 2.6rem;
  border-radius: 0;
}
.profile-hero-meta {
  flex: 1;
  min-width: 240px;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding-bottom: 0.5rem;
}
.profile-hero-titlerow {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  transform: translateY(-5px);
}
.profile-hero-name {
  font-size: 1.85rem;
  margin: 0;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.profile-hero-handle {
  color: var(--accent-3);
  font-size: 0.88rem;
  margin-top: 0.05rem;
  transform: translateY(-5px);
  font-family: var(--font-mono, monospace);
  font-weight: 500;
}
.profile-hero-bio {
  color: var(--text-secondary);
  margin: 0.75rem 0 0;
  font-size: 0.92rem;
  line-height: 1.5;
  width: 100%;
  max-width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  background: rgba(255,255,255,0.045);
  overflow-wrap: anywhere;
}
.profile-hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.95rem;
  width: 100%;
  align-content: flex-start;
}
/* Hero stat panel (right side) */
.profile-hero-stat-panel {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  background: linear-gradient(180deg, rgba(8,13,22,0.94), rgb(255, 255, 255));
  border: 1px solid rgba(5, 14, 19, 0.28);
  border-radius: 14px;
  padding: 0.15rem;
  backdrop-filter: blur(6px);
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0,0,0,0.22);
}
.profile-hero-stat-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, #012d41, #ffffff);
  opacity: 1;
}
.profile-hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.85rem 1.1rem;
  min-width: 84px;
  cursor: default;
  position: relative;
  box-shadow: inset 0 2px 0 rgba(42,235,235,0.95);
  background: linear-gradient(180deg, rgba(12,22,34,0.92), rgba(5,10,18,0.82));
  transition: background 0.2s;
}
.profile-hero-stat + .profile-hero-stat::before {
  content: "";
  position: absolute;
  left: 0; top: 22%; bottom: 22%;
  width: 1px;
  background: rgba(255,255,255,0.26);
}
.profile-hero-stat:hover {
  background: linear-gradient(180deg, rgba(15,35,51,0.96), rgba(7,16,26,0.88));
}
.phstat-value {
  font-weight: 700;
  font-size: 1.5rem;
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  color: #2aebeb;
  line-height: 1;
  text-shadow: 0 1px 8px rgba(10,126,126,0.35);
}
.phstat-label {
  font-size: 0.66rem;
  color: rgba(42,235,235,0.95);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.4rem;
  font-weight: 600;
}
.profile-signout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  width: 100%;
  padding: 0.55rem 1rem;
  border: 1px solid rgba(244, 67, 54, 0.35);
  background: rgba(244, 67, 54, 0.07);
  color: #f44336;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  letter-spacing: 0.01em;
}
.profile-signout-btn:hover {
  background: rgba(244, 67, 54, 0.15);
  border-color: rgba(244, 67, 54, 0.6);
  transform: translateY(-1px);
}
.profile-signout-btn svg { flex-shrink: 0; }
.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 1 auto;
  min-width: 0;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.03);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
}
.profile-chip-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-chip--bio { max-width: min(100%, 420px); }
.profile-chip svg { opacity: 0.7; flex-shrink: 0; }
.profile-chip--muted { color: var(--text-muted); }

.profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-secondary);
  text-transform: uppercase;
}
.profile-badge--admin {
  background: rgba(245,158,11,0.15);
  border-color: rgba(245,158,11,0.4);
  color: #f59e0b;
}
.profile-badge--support {
  background: rgba(58,180,233,0.15);
  border-color: rgba(58,180,233,0.4);
  color: #3ab4e9;
}

/* Activity feed */
.profile-activity-item {
  display: flex;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: var(--glass-bg);
  margin-bottom: 0.6rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, transform 0.15s;
}
.profile-activity-item:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.profile-activity-icon {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
}
.profile-activity-body { flex: 1; min-width: 0; }
.profile-activity-title { font-size: 0.92rem; }
.profile-activity-snippet {
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-top: 0.25rem;
  line-height: 1.4;
}
.profile-activity-time {
  color: var(--text-muted);
  font-size: 0.72rem;
  margin-top: 0.35rem;
}

@media (max-width: 760px) {
  .profile-hero-body { flex-direction: column; align-items: stretch; gap: 1.25rem; }
  .profile-hero-right { width: 100%; transform: none; }
  .profile-hero-stat-panel { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 640px) {
  .profile-hero-cover { height: 120px; }
  .profile-hero-body { padding: 0 1.25rem 1.25rem; gap: 1rem; }
  .profile-hero-left { gap: 1rem; flex-direction: column; align-items: flex-start; }
  .profile-avatar-wrap--xl { width: 96px; height: 96px; }
  .profile-hero-name { font-size: 1.4rem; }
  .profile-hero-stat { padding: 0.55rem 0.4rem; min-width: 0; }
  .phstat-value { font-size: 1.15rem; }
  .phstat-label { font-size: 0.6rem; letter-spacing: 0.04em; }
}