.profile-page {
  --profile-surface: rgba(242, 245, 246, 0.82);
  --profile-surface-strong: rgba(250, 252, 252, 0.94);
  --profile-border: rgba(27, 40, 47, 0.14);
  --profile-text: #172027;
  --profile-muted: #68767e;
  --profile-accent: #d32383;
  display: grid;
  gap: 14px;
  color: var(--profile-text);
}

html[data-resolved-theme="dark"] .profile-page {
  --profile-surface: rgba(16, 25, 30, 0.8);
  --profile-surface-strong: rgba(20, 30, 35, 0.94);
  --profile-border: rgba(180, 205, 213, 0.14);
  --profile-text: #edf4f4;
  --profile-muted: #93a2a8;
}

.profile-identity,
.profile-section,
.profile-metrics article {
  border: 1px solid var(--profile-border);
  background: var(--profile-surface);
  box-shadow: 0 16px 42px rgba(8, 18, 24, 0.09);
  backdrop-filter: blur(18px);
}

.profile-identity {
  min-height: 150px;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  gap: 18px;
  position: relative;
  overflow: hidden;
  border-radius: 14px;
}

.profile-identity::after {
  content: "UBUNTU";
  position: absolute;
  right: 24px;
  bottom: -24px;
  color: var(--profile-text);
  font-size: 78px;
  font-weight: 900;
  opacity: 0.025;
  pointer-events: none;
}

.profile-main-avatar {
  width: 84px;
  height: 84px;
  flex: 0 0 84px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 20px;
  color: white;
  background: linear-gradient(145deg, #d72b88, #7657d7 52%, #189b70);
  box-shadow: 0 14px 30px rgba(105, 47, 135, 0.24);
  font-size: 27px;
  font-weight: 900;
}

.profile-identity-copy { min-width: 0; }
.profile-identity-copy > span,
.profile-section header > div > span {
  color: var(--profile-accent);
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
}
.profile-identity-copy h3 { margin: 5px 0 4px; color: var(--profile-text); font-size: 30px; }
.profile-identity-copy p { margin: 0; color: var(--profile-muted); font-size: 13px; }
.profile-identity-state { margin-left: auto; display: grid; justify-items: end; gap: 9px; z-index: 1; }
.profile-identity-state small { color: var(--profile-muted); font-size: 10px; }

.profile-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.profile-metrics article {
  min-height: 98px;
  padding: 17px 18px;
  display: grid;
  align-content: space-between;
  border-radius: 12px;
}
.profile-metrics span { color: var(--profile-muted); font-size: 9px; font-weight: 900; text-transform: uppercase; }
.profile-metrics strong { color: var(--profile-text); font-size: 25px; }
.profile-metrics small { color: var(--profile-muted); font-size: 9px; }

.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
  align-items: start;
}

.profile-section {
  min-width: 0;
  padding: 20px;
  border-radius: 14px;
}

.profile-section > header {
  min-height: 48px;
  margin-bottom: 14px;
  padding-bottom: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--profile-border);
}
.profile-section header h3 { margin: 3px 0 0; color: var(--profile-text); font-size: 19px; }
.profile-section header > small { color: var(--profile-muted); font-size: 9px; }

.profile-info-list { margin: 0; display: grid; grid-template-columns: 1fr 1fr; }
.profile-info-list > div {
  min-width: 0;
  min-height: 62px;
  padding: 11px 8px;
  border-bottom: 1px solid var(--profile-border);
}
.profile-info-list > div:nth-child(odd) { padding-left: 0; padding-right: 16px; border-right: 1px solid var(--profile-border); }
.profile-info-list > div:nth-child(even) { padding-left: 16px; }
.profile-info-list dt { margin-bottom: 5px; color: var(--profile-muted); font-size: 9px; font-weight: 900; text-transform: uppercase; }
.profile-info-list dd { min-width: 0; margin: 0; display: flex; align-items: center; gap: 7px; overflow-wrap: anywhere; color: var(--profile-text); font-size: 12px; font-weight: 750; }
.profile-copy-button {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  padding: 0;
  border: 1px solid var(--profile-border);
  border-radius: 7px;
  color: var(--profile-muted);
  background: var(--profile-surface-strong);
  cursor: pointer;
}
.profile-copy-button:hover { color: var(--profile-accent); border-color: var(--profile-accent); }

.profile-edit-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.profile-edit-form label { min-width: 0; }
.profile-edit-form label > span,
.profile-edit-form label > small { display: block; }
.profile-edit-form label > span { margin-bottom: 6px; color: var(--profile-muted); font-size: 9px; font-weight: 900; text-transform: uppercase; }
.profile-edit-form label > small { margin-top: 5px; color: var(--profile-muted); font-size: 9px; }
.profile-edit-form input {
  width: 100%;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid var(--profile-border);
  border-radius: 8px;
  color: var(--profile-text);
  background: var(--profile-surface-strong);
  font: inherit;
}
.profile-edit-form input:focus { outline: 2px solid rgba(211, 35, 131, 0.18); border-color: var(--profile-accent); }
.profile-edit-form input:disabled { opacity: 0.62; cursor: not-allowed; }
.profile-password-field,
.profile-edit-actions { grid-column: 1 / -1; }
.profile-edit-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }

.profile-board-card {
  min-height: 210px;
  padding: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  border: 1px solid var(--profile-border);
  border-radius: 10px;
  background: var(--profile-surface-strong);
}
.profile-board-card > div { padding: 11px; border-left: 2px solid rgba(211, 35, 131, 0.34); background: rgba(211, 35, 131, 0.035); }
.profile-board-card .profile-board-level { grid-column: 1 / -1; }
.profile-board-card span,
.profile-board-card small { display: block; margin-bottom: 5px; color: var(--profile-muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.profile-board-card strong { color: var(--profile-text); font-size: 16px; }
.profile-board-card code { align-self: center; color: var(--profile-muted); font-size: 10px; }
.profile-board-card .secondary-action { justify-self: end; min-height: 38px; border-radius: 8px; }

.profile-security-section,
.profile-history-section { grid-column: 1 / -1; }
.profile-session-list,
.profile-activity-list { margin: 0; padding: 0; list-style: none; }
.profile-session-list { max-height: 310px; display: grid; gap: 7px; overflow: auto; }
.profile-session {
  min-height: 62px;
  padding: 9px 12px;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--profile-border);
  border-radius: 9px;
  background: var(--profile-surface-strong);
}
.profile-session.is-current { border-color: rgba(32, 165, 106, 0.35); }
.profile-session-icon { width: 30px; height: 30px; border: 1px solid var(--profile-border); border-radius: 8px; position: relative; }
.profile-session-icon::before { content: ""; position: absolute; inset: 7px 5px; border: 2px solid var(--profile-muted); border-radius: 2px; }
.profile-session strong,
.profile-session small,
.profile-session-expiry span { display: block; }
.profile-session strong { color: var(--profile-text); font-size: 12px; }
.profile-session small { margin-top: 3px; color: var(--profile-muted); font-size: 9px; }
.profile-session-expiry { text-align: right; }
.profile-session-expiry span { color: #20a56a; font-size: 9px; font-weight: 850; text-transform: uppercase; }

.profile-activity-list { max-height: 430px; overflow: auto; }
.profile-activity-item {
  min-height: 67px;
  padding: 11px 6px;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  border-bottom: 1px solid var(--profile-border);
}
.profile-activity-mark { width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: #20a56a; box-shadow: 0 0 0 4px rgba(32, 165, 106, 0.1); }
.profile-activity-mark.is-audit { background: var(--profile-accent); box-shadow: 0 0 0 4px rgba(211, 35, 131, 0.1); }
.profile-activity-item strong { color: var(--profile-text); font-size: 11px; }
.profile-activity-item p { margin: 4px 0 0; color: var(--profile-muted); font-size: 10px; line-height: 1.4; }
.profile-activity-item time { color: var(--profile-muted); font-size: 9px; white-space: nowrap; }

.profile-menu-action { width: 100%; margin-bottom: 7px; }

@media (max-width: 900px) {
  .profile-metrics { grid-template-columns: 1fr 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .profile-security-section,
  .profile-history-section { grid-column: auto; }
}

@media (max-width: 620px) {
  .profile-page { gap: 10px; }
  .profile-identity { min-height: 124px; padding: 17px; gap: 12px; }
  .profile-main-avatar { width: 60px; height: 60px; flex-basis: 60px; border-radius: 15px; font-size: 21px; }
  .profile-identity-copy h3 { font-size: 21px; }
  .profile-identity-state small { display: none; }
  .profile-metrics { gap: 8px; }
  .profile-metrics article { min-height: 82px; padding: 12px; }
  .profile-metrics strong { font-size: 20px; }
  .profile-section { padding: 14px; border-radius: 10px; }
  .profile-info-list { grid-template-columns: 1fr; }
  .profile-edit-form { grid-template-columns: 1fr; }
  .profile-password-field,
  .profile-edit-actions { grid-column: auto; }
  .profile-info-list > div:nth-child(odd),
  .profile-info-list > div:nth-child(even) { padding: 10px 0; border-right: 0; }
  .profile-board-card { grid-template-columns: 1fr; }
  .profile-board-card .profile-board-level { grid-column: auto; }
  .profile-board-card .secondary-action { justify-self: stretch; }
  .profile-session { grid-template-columns: 30px minmax(0, 1fr); }
  .profile-session-expiry { grid-column: 2; text-align: left; }
  .profile-activity-item { grid-template-columns: 8px minmax(0, 1fr); }
  .profile-activity-item time { grid-column: 2; }
  .profile-security-section header { align-items: flex-start; }
  .profile-security-section header .secondary-action { min-width: 120px; padding: 0 9px; font-size: 9px; }
}
