.profile-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, rgba(138,21,56,.08), transparent 28rem),
    var(--canvas);
}

.profile-topbar {
  grid-template-columns: minmax(210px,280px) 1fr auto;
}

.profile-brand { text-decoration: none; }
.profile-top-title {
  font-weight: 850;
  font-size: 16px;
  text-align: center;
  color: #4f474c;
}

.profile-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 30px auto 64px;
}

.profile-hero {
  background: linear-gradient(135deg, #fff, #fff 55%, #fbf4f7);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 26px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
}

.profile-avatar-wrap { position: relative; }
.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 24px;
  object-fit: cover;
  border: 4px solid white;
  box-shadow: 0 10px 25px rgba(55,25,36,.12);
}
.profile-avatar-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--qatar), var(--qatar-dark));
  color: white;
  font-weight: 900;
  font-size: 32px;
}
.verified-dot {
  position: absolute;
  inset-inline-end: -4px;
  bottom: 3px;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 3px solid white;
  background: var(--green);
  color: white;
  font-weight: 900;
  font-size: 13px;
}

.profile-kicker, .panel-eyebrow {
  color: var(--qatar);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.profile-identity h1 {
  margin: 5px 0 3px;
  font-size: clamp(24px,4vw,34px);
  letter-spacing: -.7px;
}
.profile-handle {
  color: var(--qatar);
  font-weight: 800;
  font-size: 14px;
}
.profile-meta-row {
  margin-top: 9px;
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.danger-soft-btn {
  border: 1px solid #ecd4dc;
  background: #fff7f9;
  color: #9b2145;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 800;
}

.profile-stats {
  margin: 14px 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.stat-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 12px;
  text-align: center;
}
.stat-card strong { display: block; font-size: 24px; color: var(--qatar); }
.stat-card span { color: var(--muted); font-size: 11.5px; font-weight: 700; }

.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 14px;
}
.profile-panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 8px 24px rgba(63,21,37,.045);
}
.panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.panel-heading h2 { margin: 4px 0 0; font-size: 20px; }
.verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #eaf7f0;
  color: #167a4e;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 850;
}

.profile-form { display: grid; gap: 15px; }
.profile-form label { display: grid; gap: 7px; font-size: 12px; font-weight: 800; color: #554c51; }
.profile-form input,
.profile-form select {
  width: 100%;
  min-width: 0;
  height: 44px;
  border: 1px solid #ddd5d9;
  border-radius: 12px;
  background: white;
  padding: 0 12px;
  color: var(--ink);
  outline: 0;
}
.profile-form input:focus,
.profile-form select:focus {
  border-color: var(--qatar);
  box-shadow: 0 0 0 3px rgba(138,21,56,.07);
}
.profile-form input[readonly] { background: #f8f6f7; color: #777075; }
.profile-form small { color: #8a8287; font-weight: 500; line-height: 1.45; }
.username-input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid #ddd5d9;
  border-radius: 12px;
  overflow: hidden;
  background: white;
}
.username-input-wrap:focus-within {
  border-color: var(--qatar);
  box-shadow: 0 0 0 3px rgba(138,21,56,.07);
}
.username-input-wrap > span { padding-inline-start: 12px; color: var(--qatar); font-weight: 900; }
.username-input-wrap input { border: 0; box-shadow: none !important; }
.profile-form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.save-status { color: var(--green); font-size: 12px; font-weight: 700; }

.text-link { color: var(--qatar); text-decoration: none; font-size: 12px; font-weight: 800; }
.profile-questions { display: grid; gap: 9px; }
.profile-question {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 13px 14px;
  transition: .18s ease;
}
.profile-question:hover { border-color: rgba(138,21,56,.3); transform: translateY(-1px); }
.profile-question-title { font-size: 14px; line-height: 1.55; font-weight: 850; }
.profile-question-meta {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 7px;
  color: var(--muted);
  font-size: 10.5px;
}
.profile-question-topic {
  color: var(--qatar);
  background: var(--qatar-soft);
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 800;
}
.profile-loading, .profile-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 18px 4px;
  text-align: center;
}

@media (max-width: 760px) {
  .profile-topbar {
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 0 14px;
  }
  .profile-top-title { display: none; }
  .profile-brand .brand-name { font-size: 18px; }
  .profile-shell { width: min(100% - 22px, 680px); margin-top: 16px; }
  .profile-hero {
    grid-template-columns: auto 1fr;
    padding: 18px;
    gap: 14px;
  }
  .profile-avatar { width: 68px; height: 68px; border-radius: 20px; }
  .profile-identity h1 { font-size: 22px; }
  .profile-meta-row { font-size: 10.5px; }
  .danger-soft-btn { grid-column: 1 / -1; width: 100%; }
  .profile-stats { grid-template-columns: repeat(3,1fr); }
  .profile-stats .stat-card:nth-child(4),
  .profile-stats .stat-card:nth-child(5) { grid-column: span 1; }
  .profile-grid { grid-template-columns: 1fr; }
  .profile-panel { padding: 17px; }
}

@media (max-width: 430px) {
  .profile-topbar .ghost-btn { display: none; }
  .profile-stats { grid-template-columns: repeat(2,1fr); }
  .profile-stats .stat-card:last-child { grid-column: 1 / -1; }
  .panel-heading { align-items: center; }
}

.profile-chat-link { text-decoration:none; }
@media (max-width: 520px) {
  .profile-chat-link span { display:none; }
  .profile-chat-link { padding-inline:10px; }
}
