.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 20px;
  align-items: start;
}

.profile-main,
.profile-sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.profile-hero-card {
  position: relative;
  overflow: hidden;
}

.profile-cover {
  height: 138px;
  background:
    radial-gradient(circle at 16% 20%, rgba(213, 78, 89, .22), transparent 28rem),
    linear-gradient(115deg, rgba(105, 32, 38, .76), rgba(35, 10, 12, .94));
  border-bottom: 1px solid var(--line);
}

.profile-hero-body {
  position: relative;
  display: flex;
  gap: 22px;
  padding: 0 26px 24px;
}

.profile-avatar-wrap {
  width: 132px;
  height: 132px;
  flex: 0 0 132px;
  margin-top: -56px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 25px;
  box-shadow: 0 16px 35px rgba(0, 0, 0, .28);
}

.profile-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 20px;
}

.profile-identity {
  min-width: 0;
  flex: 1;
  padding-top: 19px;
}

.profile-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.profile-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.profile-title-row h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(27px, 4vw, 38px);
  line-height: 1.05;
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
}

.profile-owner-chip {
  flex: 0 0 auto;
  padding: 7px 10px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid rgba(211, 72, 84, .22);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.profile-role-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}

.profile-role-badge {
  min-height: 25px;
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  color: #e8a8ad;
  background: rgba(211, 72, 84, .08);
  border: 1px solid rgba(211, 72, 84, .19);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.profile-role-badge.role-agare,
.profile-role-dot.role-agare { color: #ffd783; background-color: #d8a84c; }
.profile-role-badge.role-delagare,
.profile-role-dot.role-delagare { color: #e7baff; background-color: #b871db; }
.profile-role-badge.role-admin,
.profile-role-dot.role-admin { color: #ffadb9; background-color: #e56c7e; }
.profile-role-badge.role-ledning,
.profile-role-dot.role-ledning { color: #9bcfff; background-color: #58a8ef; }
.profile-role-badge.role-head-mod,
.profile-role-dot.role-head-mod { color: #ffd09b; background-color: #e99b4a; }
.profile-role-badge.role-mod,
.profile-role-dot.role-mod { color: #b6d7ff; background-color: #6f9ed5; }
.profile-role-badge.role-helper,
.profile-role-dot.role-helper { color: #e8a9ae; background-color: #c94853; }
.profile-role-badge.role-medlemskapsansvarig,
.profile-role-dot.role-medlemskapsansvarig { color: #f0c5ff; background-color: #b57acb; }
.profile-role-badge.role-user,
.profile-role-dot.role-user { color: var(--text-soft); background-color: #7c899a; }

.profile-role-badge.role-agare,
.profile-role-badge.role-delagare,
.profile-role-badge.role-admin,
.profile-role-badge.role-ledning,
.profile-role-badge.role-head-mod,
.profile-role-badge.role-mod,
.profile-role-badge.role-helper,
.profile-role-badge.role-medlemskapsansvarig,
.profile-role-badge.role-user {
  background: color-mix(in srgb, currentColor 9%, transparent);
  border-color: color-mix(in srgb, currentColor 22%, transparent);
}

.profile-meta-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.profile-meta-row span {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--text-soft);
  font-size: 12px;
}

.profile-meta-row b {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .014);
}

.profile-stat {
  padding: 17px;
  text-align: center;
  border-right: 1px solid var(--line);
}

.profile-stat:last-child { border-right: 0; }
.profile-stat b { display: block; color: var(--text); font-size: 20px; }
.profile-stat span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; text-transform: uppercase; }

.profile-bio-text {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.8;
}

.profile-login-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px;
  background: rgba(255, 255, 255, .02);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.profile-login-note b { display: block; font-size: 13px; }
.profile-login-note span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }

.profile-comment-form {
  padding-bottom: 20px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.profile-comment-submit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 11px;
}

.profile-comment-submit span { color: var(--muted); font-size: 10px; }
.profile-comment-list { display: flex; flex-direction: column; gap: 11px; }

.profile-comment-item {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 15px;
  background: rgba(255, 255, 255, .018);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.profile-comment-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
}

.profile-comment-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-comment-content { min-width: 0; flex: 1; }
.profile-comment-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.profile-comment-author { color: var(--text); font-size: 13px; font-weight: 800; }
.profile-comment-author:hover { color: var(--accent-strong); }
.profile-comment-head time { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.profile-comment-delete-form { margin: 0; }
.profile-comment-body { margin-top: 11px; color: var(--text-soft); font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }

.profile-role-panel { display: flex; flex-direction: column; }
.profile-role-row { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.profile-role-row:first-child { padding-top: 0; }
.profile-role-row:last-child { padding-bottom: 0; border-bottom: 0; }
.profile-role-dot { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; }
.profile-role-row b { display: block; color: var(--text-soft); font-size: 12px; }
.profile-role-row span { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }

.profile-side-list,
.profile-activity-list { display: flex; flex-direction: column; }
.profile-side-item { display: block; padding: 11px 0; border-bottom: 1px solid var(--line); }
.profile-side-item:first-child { padding-top: 0; }
.profile-side-item:last-child { padding-bottom: 0; border-bottom: 0; }
.profile-side-item b { display: block; color: var(--text-soft); font-size: 12px; line-height: 1.4; }
.profile-side-item:hover b { color: var(--accent-strong); }
.profile-side-item span { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }

.profile-activity-item { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.profile-activity-item:first-child { padding-top: 0; }
.profile-activity-item:last-child { padding-bottom: 0; border-bottom: 0; }
.profile-activity-icon { width: 26px; height: 26px; display: grid; place-items: center; flex: 0 0 26px; color: var(--accent-strong); background: var(--accent-soft); border-radius: 8px; font-size: 11px; }
.profile-activity-item div { min-width: 0; }
.profile-activity-item b { display: block; color: var(--text-soft); font-size: 11px; line-height: 1.4; }
.profile-activity-item:hover b { color: var(--accent-strong); }
.profile-activity-item p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.profile-activity-item time { display: block; margin-top: 4px; color: rgba(141, 155, 176, .7); font-size: 8px; }

@media (max-width: 980px) {
  .profile-layout { grid-template-columns: 1fr; }
  .profile-sidebar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-sidebar .card:first-child { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  .profile-cover { height: 110px; }
  .profile-hero-body { flex-direction: column; gap: 12px; padding: 0 18px 20px; }
  .profile-avatar-wrap { width: 104px; height: 104px; flex-basis: 104px; margin-top: -45px; border-radius: 20px; }
  .profile-avatar-image { border-radius: 16px; }
  .profile-identity { padding-top: 0; }
  .profile-title-row { align-items: flex-start; flex-direction: column; gap: 10px; }
  .profile-meta-row { flex-direction: column; gap: 10px; }
  .profile-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-stat:nth-child(2) { border-right: 0; }
  .profile-stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .profile-sidebar { grid-template-columns: 1fr; }
  .profile-sidebar .card:first-child { grid-column: auto; }
  .profile-login-note { align-items: stretch; flex-direction: column; }
  .profile-comment-submit { align-items: stretch; flex-direction: column; }
  .profile-comment-submit .btn { width: 100%; }
}