/* 27.11.2026 (Lars, I) */
#athletesView .prep-um-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
  margin-block: 0 20px;
  border-block-end: 1px solid var(--prep-line);
}

#athletesView .prep-um-tabs > button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  text-align: start;
  line-height: 1.2;
  cursor: pointer;
}

#athletesView .prep-um-tabs > button[aria-selected="true"] {
  border-block-end-color: var(--prep-accent);
}

#athletesView .prep-um-tabs > button:hover { color: var(--prep-text); }

#athletesView :is(.prep-um-tabs button,.prep-um-panel,.prep-um-group,.prep-um-detail button,.prep-um-detail input,summary):focus-visible {
  outline: 2px solid var(--prep-accent);
  outline-offset: 2px;
}

#athletesView .prep-um-count {
  flex: none;
  width: max-content;
  min-width: 24px;
  background: var(--prep-bg2);
  color: var(--prep-text2);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  text-align: center;
}

#athletesView .prep-um-count.has-open-requests {
  background: color-mix(in srgb,var(--prep-warn) 14%,var(--prep-surface));
  color: var(--prep-warn);
}

#athletesView .prep-um-panel:not([hidden]) { display: grid; gap: 16px; }

#athletesView .prep-um-section-head,
#athletesView .prep-um-detail-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 16px;
}

#athletesView :is(.prep-um-section-head,.prep-um-detail-head) h2 {
  margin: 0;
  overflow-wrap: anywhere;
}

#umStaffPanel > section { min-width: 0; }
#umStaffPanel > section + section {
  margin: 0;
  padding-block-start: 16px;
  border-block-start: 1px solid var(--prep-line);
}

#umStaffPanel .stack-list { margin-block-start: 8px; }

#athletesView .prep-um-layout {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(0, 2fr);
  align-items: start;
  gap: 24px;
}

#athletesView .prep-um-group-list { min-width: 0; }
#athletesView .prep-um-group-list .prep-um-section-head { margin-block-end: 12px; }

#athletesView :is(.prep-um-groups,.prep-um-members,.prep-um-search-results) {
  margin: 0;
  padding: 0;
  list-style: none;
}

#athletesView .prep-um-groups { display: grid; gap: 4px; }

#athletesView .prep-um-group {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 3px 10px;
  align-items: center;
  width: 100%;
  min-height: 56px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--prep-text);
  box-shadow: none;
  text-align: start;
  overflow-wrap: anywhere;
  transition: background-color 120ms, border-color 120ms;
}

#athletesView .prep-um-group:hover { background: var(--prep-bg2); }

#athletesView .prep-um-group[aria-pressed="true"] {
  border-color: var(--prep-line);
  border-inline-start: 3px solid var(--prep-accent);
  background: var(--prep-surface);
}

#athletesView .prep-um-group small { grid-column: 1 / -1; }

#athletesView :is(.prep-um-group,.prep-um-member,.prep-um-search-results) small {
  font-size: .8125rem;
  font-weight: 400;
}

#athletesView .prep-um-archive {
  margin-block-start: 12px;
  border-block-start: 1px solid var(--prep-line);
}

#athletesView :is(.prep-um-archive,.prep-um-member-overflow) > summary {
  min-height: 44px;
  padding: 11px 12px;
  color: var(--prep-text2);
  cursor: pointer;
}

#athletesView .prep-um-detail:not([hidden]) {
  display: grid;
  min-width: 0;
  gap: 16px;
  padding: clamp(14px, 2.5vw, 24px);
  border: 1px solid var(--prep-line);
  border-radius: 14px;
  background: var(--prep-surface);
}

#athletesView .prep-um-detail-head { align-items: end; }
#athletesView .prep-um-detail-head h2 { margin-block-start: 6px; }
#athletesView .prep-um-active { color: var(--prep-ok); }
#athletesView .prep-um-back { display: none; }
#athletesView .prep-um-description { margin: 0; color: var(--prep-text2); overflow-wrap: anywhere; }

#athletesView .prep-um-team dl {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 8px 16px;
  margin: 0;
  padding: 12px;
  border-radius: var(--prep-field-radius,8px);
  background: var(--prep-bg2);
}

#athletesView .prep-um-team dt { color: var(--prep-text2); font-size: .8125rem; }
#athletesView .prep-um-team dd { margin: 3px 0 0; overflow-wrap: anywhere; }
#athletesView .prep-um-members-section h3 { margin: 0 0 8px; }

#athletesView .prep-um-add {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: end;
  gap: 8px;
  margin-block-end: 8px;
}

#athletesView .prep-um-add > label { min-width: 0; }
#athletesView .prep-um-add input { width: 100%; min-height: 44px; }

#athletesView .prep-um-search-results {
  grid-column: 1 / -1;
  max-height: 14rem;
  overflow: auto;
  border: 1px solid var(--prep-line);
  border-radius: var(--prep-field-radius,8px);
  background: var(--prep-bg2);
}

#athletesView .prep-um-search-results [role="option"] {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  width: 100%;
  min-height: 44px;
  padding: 6px 12px;
  border: 0;
  background: transparent;
  color: var(--prep-text);
  text-align: start;
  cursor: pointer;
}

#athletesView .prep-um-search-results [role="option"]:is(:hover,[aria-selected="true"]) { background: var(--prep-surface); }
#athletesView .prep-um-search-results [aria-selected="true"] { outline: 2px solid currentColor; outline-offset: -2px; }

#athletesView .prep-um-search-status { grid-column: 1 / -1; margin: 0; }
#athletesView .prep-um-search-status:empty { position: absolute; }

#athletesView .prep-um-member {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  column-gap: 10px;
  min-height: 54px;
  padding-block: 4px;
  border-block-start: 1px solid var(--prep-line);
  overflow-wrap: anywhere;
}

#athletesView .prep-um-member > div > small { display: block; }
#athletesView .prep-um-member-access { grid-column: 2; }
#athletesView .prep-um-member:has(.prep-um-member-access) > div { align-self: end; }
#athletesView .prep-um-member > .prep-athlete-avatar { grid-row: 1 / span 2; }

#athletesView .prep-um-remove {
  grid-area: 1 / 3 / span 2;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  color: var(--prep-text2);
}

#athletesView .prep-um-remove:hover { color: var(--prep-bad); }
#athletesView .prep-um-member-overflow { border-block-start: 1px solid var(--prep-line); }
#athletesView #prepAthleteRequests > h2 { margin-block: 0 8px; }
#athletesView #prepAthleteRequests > .prep-request-line { flex-wrap: wrap; }

@media (max-width: 700px) {
  #athletesView .prep-um-tabs {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    margin-block-end: 16px;
    gap: 2px 8px;
  }
  #athletesView .prep-um-tabs > button { overflow-wrap: anywhere; }
  #athletesView .prep-um-layout { grid-template-columns: minmax(0,1fr); gap: 16px; }
  #athletesView .prep-um-back {
    display: inline-flex;
    align-items: center;
    justify-self: start;
    min-height: 44px;
  }
  #umStaffPanel .stack-item { grid-template-columns: minmax(0,1fr); }
  #umStaffPanel .stack-item-actions { justify-content: flex-start; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  #athletesView :is(.prep-um-tabs button,.prep-um-group) { transition: none; }
}
