/* Settings page + profile pictures (settings-profile.js). */

.mp-avatar,
.royalty-payee-avatar.has-photo {
  --mp-size: 40px;
  flex: none;
  display: inline-grid;
  place-items: center;
  width: var(--mp-size);
  height: var(--mp-size);
  overflow: hidden;
  border-radius: 50%;
  background: hsl(var(--mp-hue, 24) 55% 92%);
  color: hsl(var(--mp-hue, 24) 45% 28%);
  font-size: calc(var(--mp-size) * 0.36);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  user-select: none;
}

.mp-avatar.has-photo,
.royalty-payee-avatar.has-photo { background: var(--canvas, #f4f5f7); }

.mp-avatar img,
.royalty-payee-avatar.has-photo img,
.account-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.account-avatar { overflow: hidden; }
.royalty-payee-readiness-copy { flex: 1; min-width: 0; }
.royalty-payee-readiness > div > button > .royalty-payee-avatar { width: 32px; height: 32px; }
.mp-avatar-md { --mp-size: 48px; }
.mp-avatar-lg { --mp-size: 64px; }
.mp-avatar-xl { --mp-size: 96px; }

/* ------------------------------------------------------------ page */

.st-page {
  --st-ink: var(--ink, #090a0d);
  --st-soft: var(--ink-secondary, #5b616c);
  --st-line: var(--border, #dde1e7);
  --st-card: var(--surface, #fff);
  --st-canvas: var(--canvas, #f4f5f7);
  --st-accent: var(--brand-orange, #f96302);
  --st-accent-soft: var(--brand-orange-soft, #fff1e8);
  display: grid;
  gap: 20px;
  min-width: 0;
}

.st-page * { min-width: 0; }

.st-head {
  display: flex;
  align-items: center;
  gap: 18px;
}

.st-head-avatar,
.st-photo-button {
  position: relative;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.st-head-avatar:focus-visible,
.st-photo-button:focus-visible,
.st-nav-item:focus-visible {
  outline: 2px solid var(--st-accent);
  outline-offset: 3px;
}

.st-head-copy h1 { margin: 0; font-size: clamp(24px, 3vw, 32px); line-height: 1.15; }
.st-head-copy p { margin: 2px 0 0; color: var(--st-soft); overflow-wrap: anywhere; }
.st-head-copy .overline { margin: 0 0 4px; }

.st-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.st-nav {
  position: sticky;
  top: calc(var(--ui-v2-header, 64px) + 16px);
  display: grid;
  gap: 2px;
}

.st-nav-label {
  margin: 14px 12px 6px;
  color: var(--st-soft);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.st-nav-label:first-child { margin-top: 0; }

.st-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--st-ink);
  font: inherit;
  font-size: 14.5px;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
}

.st-nav-item svg { width: 18px; height: 18px; color: var(--st-soft); }
.st-nav-item:hover { background: var(--st-canvas); }
.st-nav-item.is-active { background: var(--st-accent-soft); color: var(--st-ink); }
.st-nav-item.is-active svg { color: var(--st-accent); }

.st-panel { display: grid; gap: 16px; }
.st-system-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.st-panel > .form-surface,
.st-panel > .document-grid { margin: 0; }

.st-loading {
  height: 180px;
  border: 1px solid var(--st-line);
  border-radius: 18px;
  background: linear-gradient(90deg, var(--st-card), var(--st-canvas), var(--st-card));
  background-size: 200% 100%;
  animation: st-shimmer 1.2s ease-in-out infinite;
}

@keyframes st-shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) { .st-loading { animation: none; } }

.st-card {
  border: 1px solid var(--st-line);
  border-radius: 18px;
  background: var(--st-card);
}

.st-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px 0;
}

.st-card-head h2 { margin: 0; font-size: 17px; line-height: 1.3; }
.st-card-head p { margin: 4px 0 0; color: var(--st-soft); font-size: 13.5px; }
.st-card-actions { margin-left: auto; }

.st-card-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--st-canvas);
  color: var(--st-ink);
}

.st-card-icon svg { width: 18px; height: 18px; }

.st-card-body {
  display: grid;
  gap: 14px;
  padding: 16px 20px 20px;
}

.st-rows { display: grid; }

.st-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-top: 1px solid var(--st-line);
  font-size: 14px;
}

.st-row:first-child { border-top: 0; }
.st-row span { color: var(--st-soft); }
.st-row strong { font-weight: 600; text-align: right; overflow-wrap: anywhere; }

.st-text { margin: 0; color: var(--st-ink); line-height: 1.5; }
.st-hint { margin: -4px 0 0; color: var(--st-soft); font-size: 13px; line-height: 1.45; }
.st-field { max-width: 360px; }

.st-inline-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.st-photo {
  display: flex;
  align-items: center;
  gap: 20px;
}

.st-photo-copy { display: grid; gap: 6px; }
.st-photo-copy strong { font-size: 16px; }
.st-photo-copy p { margin: 0; color: var(--st-soft); font-size: 13.5px; line-height: 1.45; }

.st-photo-badge {
  position: absolute;
  right: 2px;
  bottom: 2px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 3px solid var(--st-card);
  border-radius: 50%;
  background: var(--st-ink);
  color: #fff;
}

.st-photo-badge svg { width: 14px; height: 14px; }

.st-artists {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.st-artist {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--st-line);
  border-radius: 14px;
}

.st-artist strong {
  flex: 1;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------ editor */

.mp-editor { display: grid; gap: 16px; }

.mp-editor-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--canvas, #f4f5f7);
}

.mp-editor-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--ink-secondary, #5b616c);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.mp-editor-tab svg { flex: none; width: 16px; height: 16px; }
.mp-editor-tab.is-active { background: var(--surface, #fff); color: var(--ink, #090a0d); box-shadow: 0 1px 2px rgb(9 10 13 / 0.08); }

.mp-editor-pane { display: grid; gap: 12px; }

.mp-auto-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--canvas, #f4f5f7);
  color: var(--ink-secondary, #5b616c);
  font-size: 13px;
  line-height: 1.45;
}
.mp-auto-note svg { flex: none; width: 16px; height: 16px; margin-top: 1px; color: var(--accent, #6d28d9); }

.mp-quick { display: grid; gap: 8px; }
.mp-quick[hidden] { display: none; }
.mp-quick-title { margin: 0; color: var(--ink-secondary, #5b616c); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.mp-quick-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}
.mp-pick {
  display: grid;
  flex: none;
  justify-items: center;
  gap: 6px;
  width: 84px;
  padding: 8px 4px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  background: none;
  color: var(--ink, #090a0d);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  scroll-snap-align: start;
}
.mp-pick > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-pick:hover { background: var(--canvas, #f4f5f7); }
.mp-pick:focus-visible { outline: 2px solid var(--accent, #6d28d9); outline-offset: 2px; }
.mp-pick.is-selected { border-color: var(--accent, #6d28d9); background: var(--canvas, #f4f5f7); }
.mp-pick-service { width: 112px; }
.mp-pick-service-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #1ed760;
  color: #fff;
}
.mp-pick-service-icon[data-service="apple_music"] { background: linear-gradient(135deg, #fa233b, #fb5c74); }
.mp-pick-service-icon svg { width: 22px; height: 22px; }

.mp-editor-pane[hidden] { display: none; }

.mp-drop {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 22px 16px;
  border: 1.5px dashed var(--border, #dde1e7);
  border-radius: 16px;
  text-align: center;
  cursor: pointer;
}

.mp-drop:hover,
.mp-drop.is-over { border-color: var(--brand-orange, #f96302); background: var(--brand-orange-soft, #fff1e8); }
.mp-drop:focus-within { outline: 2px solid var(--brand-orange, #f96302); outline-offset: 2px; }
.mp-drop strong { margin-top: 6px; }
.mp-drop small { color: var(--ink-secondary, #5b616c); }
.mp-drop.is-compact { grid-template-columns: auto 1fr; justify-items: start; padding: 10px 14px; text-align: left; }
.mp-drop.is-compact .mp-avatar { display: none; }
.mp-drop.is-compact strong { margin: 0; }
.mp-drop.is-compact small { grid-column: 1 / -1; }

.mp-crop { display: grid; justify-items: center; gap: 10px; }
.mp-crop[hidden] { display: none; }

.mp-crop-stage {
  position: relative;
  width: min(240px, 100%);
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 16px;
  background: var(--canvas, #f4f5f7);
  touch-action: none;
}

.mp-crop-stage canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.mp-crop-stage canvas:active { cursor: grabbing; }

.mp-crop-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgb(9 10 13 / 0.38);
  pointer-events: none;
}

.mp-zoom { display: flex; align-items: center; gap: 10px; width: min(240px, 100%); color: var(--ink-secondary, #5b616c); }
.mp-zoom input { flex: 1; accent-color: var(--brand-orange, #f96302); }
.mp-zoom svg { width: 16px; height: 16px; }
.mp-hint { margin: 0; color: var(--ink-secondary, #5b616c); font-size: 13px; line-height: 1.45; }
.mp-error { margin: 0; padding: 10px 12px; border-radius: 10px; background: #fdecec; color: #a12222; font-size: 13.5px; }
.mp-error[hidden] { display: none; }

.mp-editor-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mp-spacer { flex: 1; }
.mp-editor-actions .button[aria-busy="true"] { cursor: progress; }
.mp-remove { color: #a12222; }
.mp-remove svg { width: 16px; height: 16px; }

/* ------------------------------------------------------------ mobile */

@media (max-width: 860px) {
  .st-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }

  .st-nav {
    top: calc(var(--ui-v2-header, 56px));
    z-index: 5;
    display: flex;
    gap: 6px;
    margin: 0 -16px;
    padding: 8px 16px;
    overflow-x: auto;
    background: var(--st-canvas);
    scrollbar-width: none;
  }

  .st-nav::-webkit-scrollbar { display: none; }
  .st-nav-label { display: none; }

  .st-nav-item {
    flex: none;
    min-height: 36px;
    padding: 6px 12px;
    border: 1px solid var(--st-line);
    border-radius: 999px;
    background: var(--st-card);
    font-size: 14px;
  }

  .st-nav-item.is-active { border-color: transparent; background: var(--st-ink); color: #fff; }
  .st-nav-item.is-active svg { color: #fff; }
}

@media (max-width: 520px) {
  .st-head { gap: 14px; }
  .st-head .mp-avatar-lg { --mp-size: 52px; }
  .st-card-head { padding: 16px 16px 0; }
  .st-card-body { padding: 14px 16px 16px; }
  .st-photo { flex-direction: column; align-items: flex-start; gap: 14px; }
  .st-row { flex-direction: column; gap: 2px; }
  .st-row strong { text-align: left; }
  .st-field { max-width: none; }
  .st-inline-actions .button { flex: 1 1 auto; justify-content: center; }
  .st-artists { grid-template-columns: minmax(0, 1fr); }
  .mp-editor-tab span { font-size: 13px; }
  .mp-editor-actions .mp-spacer { display: none; }
  .mp-editor-actions .button { flex: 1 1 auto; justify-content: center; }
}
