.profile-page { font-family: var(--font-family-display); }
.profile-head { padding: 8px 4px 24px; }
.profile-title {
  font-family: var(--font-family-display); font-size: clamp(28px, 4vw, 44px);
  line-height: 0.98; letter-spacing: -0.03em; font-weight: 700; margin: 0;
  color: var(--color-text-primary);
}

.profile-card {
  background: var(--color-card-bg); border: 1px solid var(--color-card-border);
  border-radius: var(--radius-card); overflow: hidden; margin-bottom: 20px;
}
.profile-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 20px 24px; border-bottom: 1px solid var(--color-border); flex-wrap: wrap;
}
.profile-card-head h2 {
  margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.015em;
  font-family: var(--font-family-display); color: var(--color-text-primary);
}
.profile-card-actions { display: flex; gap: 8px; align-items: center; }
.profile-card-body { padding: 24px; }
.profile-view-all {
  font-size: 13px; font-weight: 600; color: var(--color-text-secondary);
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
}
.profile-view-all:hover { color: var(--color-primary); }

/* Profile details: the photo, the roles right under it (a grid item of their own; the third row
   takes the facts' extra height, so a tall list does not push the roles down) and the facts. */
.profile-row {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto 1fr;
  grid-template-areas: "avatar info" "roles info" ". info"; gap: 12px 32px; align-items: start;
}
.profile-row-avatar { grid-area: avatar; }
.profile-row-roles { grid-area: roles; }
.profile-row-info { grid-area: info; }
.profile-avatar {
  width: 130px; aspect-ratio: 1/1.05; border-radius: var(--radius-lg); overflow: hidden;
  flex: none; position: relative;
  background: repeating-linear-gradient(90deg, var(--color-surface-muted) 0 6px, var(--color-border-strong) 6px 12px);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; position: relative; z-index: 1; }
.profile-avatar-placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-family-mono); font-size: 10px; color: var(--color-text-muted);
  letter-spacing: 0.1em; text-transform: uppercase;
}
.profile-roles { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.profile-role-badge {
  font-size: 11px; font-weight: 600; padding: 4px 11px; border-radius: var(--radius-pill);
  background: var(--color-surface-muted); color: var(--color-text-secondary);
}
.profile-info-list { display: flex; flex-direction: column; gap: 16px; }
.profile-info-item { display: flex; align-items: center; gap: 13px; font-size: 15px; color: var(--color-text-primary); }
.profile-info-item i { color: var(--color-text-muted); width: 18px; text-align: center; flex: none; }
.profile-info-item a { color: var(--color-primary); }
.profile-info-item a:hover { color: var(--color-text-primary); }
.profile-info-item .mono { font-family: var(--font-family-mono); font-size: 13px; letter-spacing: 0.02em; }
.profile-info-item em { color: var(--color-text-muted); font-style: italic; }

/* Stats */
.profile-stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.profile-stat-cell { padding: 22px 24px; text-align: center; border-right: 1px solid var(--color-border); }
.profile-stat-cell:last-child { border-right: none; }
.profile-stat-lbl { font-size: 12px; color: var(--color-text-muted); margin-bottom: 8px; }
.profile-stat-val {
  font-family: var(--font-family-display); font-size: 22px; font-weight: 700;
  letter-spacing: -0.01em; color: var(--color-text-primary);
}
.profile-stat-val .u { font-family: var(--font-family-mono); font-size: 13px; color: var(--color-text-muted); font-weight: 500; margin-left: 3px; }
.profile-stat-empty { font-size: 15px; color: var(--color-text-muted); font-style: italic; }

/* Teams */
.profile-team-grid { display: flex; flex-wrap: wrap; gap: 14px; }
.profile-team-card {
  flex: 1 1 220px; max-width: 340px; border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: 18px 20px 20px; display: flex;
  flex-direction: column; gap: 14px; transition: border-color 160ms; position: relative;
}
/* The whole card opens the club: its name's link covers the card; the role buttons stay above it. */
.profile-team-name::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.profile-team-card:hover { border-color: var(--color-border-strong); }
.profile-team-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.profile-team-mark {
  width: 44px; height: 44px; border-radius: var(--radius-md); flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-clubs-tint); color: var(--color-clubs);
}
.profile-team-info { min-width: 0; }
.profile-team-name { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; overflow-wrap: break-word; }
.profile-team-meta { font-size: 12px; color: var(--color-text-muted); font-family: var(--font-family-mono); }
.profile-team-roles { display: flex; gap: 6px; margin-top: auto; flex-wrap: wrap; position: relative; z-index: 1; }
.team-pill {
  font-size: 12px; font-weight: 600; padding: 6px 13px; border-radius: var(--radius-pill);
  border-color: var(--color-border-input); color: var(--color-text-muted);
}
.team-pill:hover { border-color: var(--color-text-placeholder); color: var(--color-text-secondary); }
.team-pill-primary.active { background: var(--color-calendar); border-color: var(--color-calendar); color: var(--color-white); }
.team-pill-secondary.active { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-white); }

/* Races */
.profile-season-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.profile-season-tabs .nav-link {
  padding: 8px 16px; border-radius: var(--radius-pill); border: 1px solid var(--color-border);
  background: transparent; font-size: 13px; font-weight: 600; color: var(--color-text-secondary);
  transition: all 120ms; white-space: nowrap;
}
.profile-season-tabs .nav-link:hover { border-color: var(--color-text-primary); }
.profile-season-tabs .nav-link.active {
  background: var(--color-text-primary); color: var(--color-white); border-color: var(--color-text-primary);
}
.profile-race-date { display: flex; flex-direction: column; line-height: 1; }
.profile-race-day { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-family: var(--font-family-mono); color: var(--color-text-primary); }
.profile-race-mo { font-size: 11px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 3px; }

/* Tour group race timeline */
.tour-race-row { position: relative; padding: 0.5rem 1rem 0.5rem 64px; }
.tour-race-row + .tour-race-row {
  border-top: 1px solid var(--color-divider);
  border-image: linear-gradient(to right, transparent 64px, var(--color-divider) 0) 1;
}
.tour-race-row:hover { background: var(--color-surface-light); }
.tour-race-row::before {
  content: ""; position: absolute; left: 37px; top: -1px; bottom: 0;
  width: 2px; background: var(--color-surface-muted);
}
.tour-race-row:first-child::before { top: 50%; }
.tour-race-row:last-child::before { bottom: 50%; }
.tour-race-row::after {
  content: ""; position: absolute; left: 38px; top: 50%; transform: translate(-50%,-50%);
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--tour-dot, var(--color-success));
  box-shadow: 0 0 0 2px var(--color-card-bg);
}

/* A phone (the owner's mocks of 2026-10-24, `plans/plugins/profile-phone-layout/`): the card head
   stays a row, a long trailing part (the buttons, the season tabs) wrapping under the title on its
   own; tighter paddings; the photo and the facts side by side; the stats as rows, the label left
   and the value right. */
@media (max-width: 760px) {
  .profile-card-head { padding: 16px 18px; gap: 10px 14px; }
  .profile-card-body { padding: 18px; }
  .profile-row { grid-template-columns: fit-content(140px) 1fr; gap: 10px 18px; }
  .profile-avatar { width: 88px; margin: 0 auto; }
  .profile-info-list { gap: 10px; }
  .profile-info-item { font-size: 14px; }
  .profile-stat-grid { grid-template-columns: 1fr; }
  .profile-stat-cell {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    text-align: left; padding: 14px 18px; border-right: none; border-bottom: 1px solid var(--color-border);
  }
  .profile-stat-cell:last-child { border-bottom: none; }
  .profile-stat-lbl { margin-bottom: 0; }
  .profile-stat-val { font-size: 18px; text-align: right; }
  .profile-stat-val .u { font-size: 12px; }
  .profile-stat-empty { font-size: 14px; }
  .profile-team-card { max-width: none; }
}
.uf .form-control,
.uf .form-select {
  border: none;
  border-bottom: 2px dashed var(--color-border-input);
  border-radius: 0;
  background: transparent;
  padding-left: 0;
  padding-right: 0;
  box-shadow: none !important;
}
.uf .form-control:focus,
.uf .form-select:focus {
  border-bottom-color: var(--color-primary);
  border-bottom-style: solid;
  background: transparent;
}
.uf .form-control.is-invalid,
.uf .form-select.is-invalid {
  border-bottom-color: var(--color-danger);
  background-image: none;
}
/* The date of birth's three fields in one row: the day and the year as narrow as their digits,
   the month taking the rest. */
fieldset.default-profile-birth { display: flex; gap: 0.5rem; min-width: 0; }
.default-profile-birth-day { flex: 0 0 4.5rem; }
.default-profile-birth-month { flex: 1 1 auto; min-width: 0; }
.default-profile-birth-year { flex: 0 0 5.5rem; }

/* Moved from inline styles */
.default-profile-col { width: 100%; max-width: 520px; }
.default-profile-qr { max-width: 240px; margin: 0 auto; }
input.default-profile-code { letter-spacing: 0.5em; font-size: 1.75rem; }
div.default-profile-avatar-zone {
  width: 110px; height: 110px; border-radius: 50%; border: 2px dashed var(--color-border-input); cursor: pointer;
  overflow: hidden; flex-shrink: 0; position: relative; background: var(--color-surface-light);
  transition: border-color .15s, background .15s;
}
img.default-profile-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
img.default-profile-avatar-img.default-profile-avatar-img--off { display: none; }
div.default-profile-avatar-placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none;
}
div.default-profile-avatar-placeholder.default-profile-avatar-placeholder--off { display: none !important; }
i.default-profile-avatar-camera { font-size: 1.6rem; }
span.default-profile-avatar-hint { font-size: 0.65rem; margin-top: 2px; text-align: center; }

/* The profile form as rows (MOBILE-PUBLIC.md, C1): a field is one row — its name on the left (40 %, at most
   200 px) as a small upper-case mono caption, the value on the right — with one thin line under the row instead of
   the dashed line under the value. On every width. Below 576 px the two buttons are a full-width line each. */
.uf-rows > .mb-3 {
  display: grid; grid-template-columns: minmax(0, min(40%, 200px)) minmax(0, 1fr); align-items: center; column-gap: 10px;
  margin: 0 !important; padding: 4px 0 !important; border-bottom: 1px solid var(--color-border);
}
.uf-rows > .mb-3:focus-within { border-bottom-color: var(--color-primary); }
.uf-rows .uf-cap {
  grid-column: 1; margin: 0; display: block; font-family: var(--font-family-mono); font-size: 11px; font-weight: 500;
  line-height: 1.3; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-text-muted);
  overflow-wrap: normal; word-break: keep-all;
}
.uf-rows > .mb-3 > .form-control,
.uf-rows > .mb-3 > .form-select { grid-column: 2; min-height: 44px; border-bottom: 0 !important; font-size: 16px; }
.uf-rows > .mb-3 > .invalid-feedback { grid-column: 2; }
@media (max-width: 575.98px) {
  .uf-actions { flex-direction: column; }
  .uf-actions > .btn { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: center; }
  /* The date of birth's three fields do not fit beside the caption on a phone (the row's second
     column is about 170 px, which the day and the year alone take, and the month collapsed to
     nothing), so there the fieldset takes a full-width line of its own under the caption. */
  .uf-rows > .mb-3 > fieldset.default-profile-birth,
  .uf-rows > .mb-3 > fieldset.default-profile-birth ~ .invalid-feedback { grid-column: 1 / -1; }
}

/* The athlete's photo and initials remain centered beside the whole name and facts block. */
.athlete-head { display: flex; align-items: center; gap: 24px; padding: 8px 4px 28px; }
.athlete-avatar {
  width: 112px; height: 112px; flex: none; border-radius: 50%; overflow: hidden; position: relative;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-surface-muted);
}
.athlete-avatar img { width: 100%; height: 100%; object-fit: cover; }
.athlete-avatar-placeholder {
  font-size: 28px; color: var(--color-text-muted); font-weight: 500;
}
.athlete-head-text { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.athlete-facts { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.athlete-fact { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--color-text-secondary); text-decoration: none; }
.athlete-fact i { color: var(--color-text-muted); }
a.athlete-fact:hover { color: var(--color-primary); }
@media (max-width: 575.98px) {
  .athlete-head { gap: 16px; padding-bottom: 20px; }
  .athlete-avatar { width: 80px; height: 80px; }
}
