.profile-section {
  --profile-bg: #000;
  --profile-panel: #090909;
  --profile-panel-raised: #0f0f0f;
  --profile-text: #fff;
  --profile-muted: rgba(255, 255, 255, 0.58);
  --profile-faint: rgba(255, 255, 255, 0.08);
  --profile-line: rgba(255, 255, 255, 0.2);
  --profile-good: #5dea62;
  --profile-warn: #f5c451;
  position: fixed;
  inset: 0;
  z-index: 950;
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--profile-bg);
  color: var(--profile-text);
  font-family: Monaco, "Courier New", monospace;
}

.profile-section.visible {
  display: block;
}

body[data-profile-open="true"] > .caption {
  opacity: 0 !important;
  pointer-events: none;
}

.profile-shell {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 104px 0 80px;
}

.profile-masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px;
  align-items: end;
  padding: 48px 0 52px;
  border-bottom: 1px solid var(--profile-line);
}

.profile-eyebrow,
.profile-label,
.profile-status,
.profile-quality,
.profile-tab,
.profile-field label,
.profile-card dt,
.profile-table th {
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.profile-eyebrow {
  margin: 0 0 20px;
  color: var(--profile-good);
}

.profile-masthead h1 {
  max-width: 980px;
  margin: 0;
  font-size: clamp(46px, 8vw, 118px);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.07em;
}

.profile-masthead p:not(.profile-eyebrow) {
  max-width: 780px;
  margin: 28px 0 0;
  color: var(--profile-muted);
  font-size: clamp(15px, 1.5vw, 19px);
  line-height: 1.7;
}

.profile-section p,
.profile-section h1,
.profile-section h2,
.profile-section h3,
.profile-section h4 {
  max-width: 100%;
  white-space: normal !important;
  overflow-wrap: anywhere;
}

.profile-close {
  align-self: start;
  min-width: 112px;
}

.profile-workspace {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 720px;
  border-bottom: 1px solid var(--profile-line);
}

.profile-masthead,
.profile-workspace,
.profile-panels,
.profile-panel {
  min-width: 0;
  max-width: 100%;
}

.profile-tabs {
  position: sticky;
  top: 84px;
  align-self: start;
  display: grid;
  gap: 0;
  padding: 32px 24px 32px 0;
}

.profile-tab {
  width: 100%;
  padding: 16px 0;
  border: 0 !important;
  border-bottom: 1px solid var(--profile-faint) !important;
  background: transparent !important;
  color: var(--profile-muted) !important;
  text-align: left;
  cursor: pointer;
}

.profile-tab:hover,
.profile-tab:focus-visible,
.profile-tab.active {
  color: var(--profile-text) !important;
}

.profile-tab.active::before {
  content: "●";
  margin-right: 10px;
  color: var(--profile-good);
}

.profile-panels {
  min-width: 0;
  padding: 32px 0 64px 40px;
  border-left: 1px solid var(--profile-line);
}

.profile-panel {
  display: none;
}

.profile-panel.active {
  display: block;
}

.profile-panel-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 28px;
}

.profile-panel-header h2,
.profile-card h3,
.profile-empty h3 {
  margin: 0;
  font-weight: 400;
  letter-spacing: -0.04em;
}

.profile-panel-header h2 {
  font-size: clamp(30px, 4vw, 58px);
}

.profile-panel-header p {
  max-width: 580px;
  margin: 0;
  color: var(--profile-muted);
  line-height: 1.6;
}

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

.profile-card {
  grid-column: span 6;
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--profile-line);
  background: var(--profile-panel);
}

.profile-card--wide {
  grid-column: 1 / -1;
}

.profile-card--third {
  grid-column: span 4;
}

.profile-card--compact {
  min-height: 170px;
}

.profile-card__header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
  margin-bottom: 28px;
}

.profile-card h3 {
  font-size: 22px;
}

.profile-card p {
  color: var(--profile-muted);
  line-height: 1.6;
}

.profile-status,
.profile-quality {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.profile-status::before,
.profile-quality::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--profile-warn);
}

.profile-status[data-state="ready"]::before,
.profile-quality[data-quality="verified"]::before {
  background: var(--profile-good);
}

.profile-quality[data-quality="partial"]::before {
  background: var(--profile-warn);
}

.profile-quality[data-quality="pending"]::before {
  background: var(--profile-muted);
}

.profile-metric {
  display: block;
  margin: 18px 0 8px;
  font-size: clamp(36px, 5vw, 68px);
  font-weight: 400;
  letter-spacing: -0.06em;
}

.profile-muted {
  color: var(--profile-muted);
}

.profile-form {
  display: grid;
  gap: 18px;
}

.profile-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.profile-field {
  display: grid;
  gap: 8px;
}

.profile-field label {
  color: var(--profile-muted);
}

.profile-field input,
.profile-field select,
.profile-field textarea {
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid var(--profile-line) !important;
  border-radius: 0;
  background: #000 !important;
  color: #fff !important;
  font: inherit;
}

.profile-field textarea {
  min-height: 130px;
  resize: vertical;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.profile-button {
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid #fff !important;
  background: #000 !important;
  color: #fff !important;
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.profile-button:hover,
.profile-button:focus-visible,
.profile-button.primary {
  background: #fff !important;
  color: #000 !important;
}

.profile-button.danger {
  border-color: #db6969 !important;
  color: #ff8d8d !important;
}

.profile-notice {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--profile-muted);
  font-size: 12px;
}

.profile-notice[data-tone="success"] {
  color: var(--profile-good);
}

.profile-notice[data-tone="error"] {
  color: #ff8d8d;
}

.profile-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.profile-list li,
.profile-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid var(--profile-faint);
}

.profile-list strong,
.profile-row strong {
  display: block;
  margin-bottom: 4px;
  font-weight: 400;
}

.profile-list small,
.profile-row small {
  color: var(--profile-muted);
}

.profile-address {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 18px 0;
  border-top: 1px solid var(--profile-faint);
}

.profile-toggle strong {
  display: block;
  margin-bottom: 5px;
  font-weight: 400;
}

.profile-toggle small {
  color: var(--profile-muted);
}

.profile-toggle input {
  width: 20px;
  height: 20px;
  accent-color: var(--profile-good);
}

.profile-achievements {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.profile-achievement {
  min-height: 150px;
  padding: 18px;
  border: 1px solid var(--profile-faint);
  background: #050505;
}

.profile-achievement[data-earned="true"] {
  border-color: var(--profile-good);
}

.profile-achievement span {
  color: var(--profile-muted);
  font-size: 11px;
  text-transform: uppercase;
}

.profile-achievement h4 {
  margin: 48px 0 6px;
  font-size: 17px;
  font-weight: 400;
}

.profile-achievement p {
  margin: 0;
  font-size: 12px;
}

.profile-table-wrap {
  overflow-x: auto;
}

.profile-table {
  width: 100%;
  border-collapse: collapse;
}

.profile-table th,
.profile-table td {
  padding: 14px 12px;
  border-top: 1px solid var(--profile-faint);
  text-align: left;
  vertical-align: top;
}

.profile-table th {
  color: var(--profile-muted);
  font-weight: 400;
}

.profile-empty {
  padding: 46px 0;
  color: var(--profile-muted);
}

.profile-empty h3 {
  color: var(--profile-text);
}

.profile-segments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.profile-segment {
  padding: 7px 10px;
  border: 1px solid var(--profile-line);
  color: var(--profile-muted);
  font-size: 11px;
  text-transform: uppercase;
}

.profile-segment.active {
  border-color: var(--profile-good);
  color: var(--profile-text);
}

.profile-footer-note {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 30px 0;
  color: var(--profile-muted);
  font-size: 12px;
  line-height: 1.6;
}

.profile-footer-note p {
  max-width: 680px;
  margin: 0;
}

@media (max-width: 980px) {
  .profile-workspace {
    grid-template-columns: 1fr;
  }

  .profile-tabs {
    position: static;
    display: flex;
    overflow-x: auto;
    padding: 18px 0;
  }

  .profile-tab {
    flex: 0 0 auto;
    width: auto;
    min-width: 124px;
    padding: 13px 10px;
    border: 1px solid var(--profile-faint) !important;
  }

  .profile-panels {
    padding: 32px 0 64px;
    border-left: 0;
    border-top: 1px solid var(--profile-line);
  }

  .profile-card,
  .profile-card--third {
    grid-column: span 6;
  }
}

@media (max-width: 680px) {
  .profile-shell {
    width: min(100% - 24px, 1440px);
    max-width: calc(100vw - 24px);
    padding-top: 118px;
  }

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

  .profile-close {
    grid-row: auto;
    justify-self: start;
  }

  .profile-panel-header {
    display: block;
  }

  .profile-panel-header p {
    margin-top: 14px;
  }

  .profile-card,
  .profile-card--third {
    grid-column: 1 / -1;
  }

  .profile-card__header {
    flex-direction: column;
  }

  .profile-status,
  .profile-quality {
    white-space: normal;
  }

  .profile-form-grid,
  .profile-achievements {
    grid-template-columns: 1fr;
  }

  .profile-footer-note {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-section {
    scroll-behavior: auto;
  }
}
