/* Profiles (athletes.html) list-detail. Tokens only — reuses .fk-btn, .fk-search,
   .fk-appnav, app bar + user popover from landing/studio CSS.
   App-like layout: a fixed sidebar list + a reading-width detail pane. */

.fk-ath {
  max-width: 1360px;
  margin: 0 auto;
  padding: calc(var(--appbar-h, 56px) + var(--s-7)) var(--s-7) var(--s-16);
}

.fk-ath__cols {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  align-items: start;
}

/* ---- list column (sidebar) ---------------------------------------------- */
.fk-ath__side {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding-right: var(--s-6);
  border-right: 1px solid var(--line);
  position: sticky;
  top: calc(var(--appbar-h, 56px) + var(--s-5));
}
/* THE FIX: .fk-search sets flex:0 0 200px (a toolbar WIDTH); in this vertical
   column that would become a 200px HEIGHT. Reset to content height. */
.fk-ath__search { flex: 0 0 auto; width: 100%; }
.fk-ath__search-count {
  flex: 0 1 auto;
  margin-left: auto;
  max-width: 48%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg-3);
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  pointer-events: none;
  user-select: none;
}

.fk-ath__list { display: flex; flex-direction: column; gap: 2px; }

.fk-ath__group-label {
  margin: var(--s-3) var(--s-2) var(--s-1);
  color: var(--fg-3);
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.fk-ath__group-label:first-child { margin-top: 0; }

.fk-ath__empty {
  color: var(--fg-3);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  padding: var(--s-3) var(--s-2);
}

.fk-ath__item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  padding: var(--s-2) var(--s-2-5, 10px);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--fg-1);
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}
.fk-ath__item:hover { background: rgba(255, 255, 255, 0.045); }
.fk-ath__item.is-active {
  background: var(--pulse-tint);
  border-color: rgba(63, 127, 221, 0.4);
}
.fk-ath__item-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.fk-ath__item-name {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fk-ath__item-sub { font-family: var(--font-sans); font-size: 11.5px; color: var(--fg-3); }
.fk-ath__item-sub.is-overdue { color: var(--suboptimal, #d8a24a); }

/* filled, id-hued avatar; initials from the client code */
.fk-ath__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: var(--r-pill);
  background: var(--fk-ath-hue, var(--pulse-400));
  color: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.03em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}
.fk-ath__avatar--lg { width: 52px; height: 52px; font-size: 17px; }

.fk-ath__side-foot { margin-top: var(--s-1); padding-top: var(--s-3); border-top: 1px solid var(--line); }
.fk-ath__newclient { width: 100%; justify-content: center; }
.fk-ath__newclient .fk-ic { width: 16px; height: 16px; }

/* Once profiles exist: New profile sits beside the search bar (same classes). */
.fk-ath.is-populated .fk-ath__side {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "search create"
    "list list";
  gap: var(--s-3) var(--s-2);
  align-items: start;
}
.fk-ath.is-populated .fk-ath__search {
  grid-area: search;
  width: auto;
  min-width: 0;
}
.fk-ath.is-populated .fk-ath__side-foot {
  grid-area: create;
  margin: 0;
  padding: 0;
  border: 0;
  align-self: stretch;
  display: flex;
  align-items: stretch;
}
.fk-ath.is-populated .fk-ath__list { grid-area: list; min-height: 0; }
.fk-ath.is-populated .fk-ath__newclient {
  width: auto;
  height: 100%;
  min-height: 36px;
  padding: 0 14px;
  white-space: nowrap;
}

.fk-ath__helper { margin: 0; color: var(--fg-3); font-family: var(--font-sans); font-size: 11.5px; line-height: 1.45; }

.fk-ath__input {
  width: 100%;
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--ink-850, rgba(0, 0, 0, 0.2));
  color: var(--fg-1);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  box-sizing: border-box;
}
.fk-ath__input:focus { outline: none; border-color: var(--pulse-500); }

/* ---- detail column (reading width) --------------------------------------- */
.fk-ath__main { padding-left: var(--s-8); }
.fk-ath__panel { max-width: 660px; }

.fk-ath__comparison { margin-top: var(--s-5); padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--r-md); background: rgba(255,255,255,.025); }
.fk-ath__comparison-head { display:flex; justify-content:space-between; gap:var(--s-3); font-family:var(--font-sans); font-size:var(--fs-sm); color:var(--fg-1); }
.fk-ath__comparison-head span,.fk-ath__comparison-copy,.fk-ath__comparison-status,.fk-ath__comparison-empty { color:var(--fg-3); font-size:12px; line-height:1.45; }
.fk-ath__comparison-copy,.fk-ath__comparison-status { margin:var(--s-2) 0 0; }
.fk-ath__comparison-members { display:flex; flex-wrap:wrap; gap:var(--s-2); margin-top:var(--s-3); }
.fk-ath__comparison-member { padding:4px 7px; border-radius:var(--r-sm); background:var(--pulse-tint); color:var(--fg-1); font:11px var(--font-mono); }
.fk-ath__comparison-actions { display:flex; flex-wrap:wrap; gap:var(--s-2); margin-top:var(--s-3); }

.fk-ath__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  min-height: 420px;
  color: var(--fg-3);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  text-align: center;
}
.fk-ath__placeholder .fk-ic { width: 30px; height: 30px; opacity: 0.55; }

/* First-visit empty library: keep sidebar chrome, fill the main pane. */
.fk-ath__empty-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  min-height: 460px;
  padding: clamp(32px, 6vw, 56px) 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--ink-850, rgba(0, 0, 0, 0.18));
  text-align: center;
}
.fk-ath__empty-pane__ico {
  width: 72px;
  height: 72px;
  border-radius: var(--r-lg);
  background: var(--ink-700, rgba(255, 255, 255, 0.06));
  color: var(--fg-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--s-2);
}
.fk-ath__empty-pane__ico .fk-ic { width: 34px; height: 34px; opacity: 0.85; }
.fk-ath__empty-pane__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg-1);
}
.fk-ath__empty-pane__sub {
  margin: 0 0 var(--s-2);
  max-width: 320px;
  color: var(--fg-3);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
}
.fk-ath__empty-pane .fk-btn .fk-ic { width: 16px; height: 16px; }

.fk-ath__detail-head {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}
.fk-ath__detail-id { display: flex; flex-direction: column; gap: 3px; flex: 1 1 auto; min-width: 0; }
.fk-ath__detail-name {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--fg-1);
}
.fk-ath__detail-meta { font-family: var(--font-mono); font-size: 12px; color: var(--fg-3); }
.fk-ath__newsession { flex: none; }

.fk-ath__protocol {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-6);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.025);
}
.fk-ath__protocol-lock { display: inline-flex; color: var(--fg-3); }
.fk-ath__protocol-lock .fk-ic { width: 17px; height: 17px; }
.fk-ath__protocol-text { display: flex; flex-direction: column; gap: 2px; }
.fk-ath__protocol-main { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--fg-1); }
.fk-ath__protocol-sub { font-family: var(--font-sans); font-size: 12px; color: var(--fg-3); }

.fk-ath__section-label {
  margin-bottom: var(--s-3);
  color: var(--fg-3);
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.fk-ath__hint { margin: 0 0 var(--s-5); color: var(--fg-3); font-family: var(--font-sans); font-size: var(--fs-sm); }

/* session timeline with a left connector */
.fk-ath__timeline {
  list-style: none;
  margin: 0 0 var(--s-6);
  padding: 0 0 0 var(--s-5);
  position: relative;
}
.fk-ath__timeline::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 14px;
  bottom: 24px;
  width: 2px;
  background: var(--line);
}
.fk-ath__ses {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
.fk-ath__ses:hover { border-color: rgba(63, 127, 221, 0.45); background: var(--pulse-tint); }
.fk-ath__ses.is-comparison-selected {
  border-color: var(--pulse-400);
  background: var(--pulse-tint);
  box-shadow: inset 0 0 0 1px rgba(119, 215, 255, 0.26);
}
.fk-ath__ses:focus-visible { outline: 2px solid var(--pulse-400); outline-offset: 2px; }
.fk-ath__ses::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--s-5) + 1px);
  width: 9px;
  height: 9px;
  border-radius: var(--r-pill);
  background: var(--fg-3);
  box-shadow: 0 0 0 4px var(--bg-0, #0b0e12);
}
.fk-ath__ses[data-role-dot="baseline"]::before,
.fk-ath__ses:has(.fk-ath__ses-role[data-role="baseline"])::before { background: var(--optimal, #57b894); }
.fk-ath__ses-role {
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.fk-ath__ses-role[data-role="baseline"] { background: var(--optimal, #57b894); color: #06120d; }
.fk-ath__ses-role[data-role="retest"] { background: rgba(255, 255, 255, 0.9); color: #0b0e12; }
.fk-ath__ses-date { font-family: var(--font-sans); font-size: 14px; font-weight: 600; color: var(--fg-1); }
.fk-ath__ses-right { margin-left: auto; font-family: var(--font-sans); font-size: 13px; color: var(--fg-3); white-space: nowrap; }

.fk-ath__nextdue {
  position: relative;
  padding: var(--s-3) var(--s-4);
  border: 1px dashed var(--line);
  border-radius: var(--r-lg);
  color: var(--fg-3);
  font-family: var(--font-sans);
  font-size: 13px;
}
.fk-ath__nextdue::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--s-5) + 1px);
  top: 50%;
  transform: translateY(-50%);
  width: 9px;
  height: 9px;
  border-radius: var(--r-pill);
  border: 2px solid var(--line);
  background: var(--bg-0, #0b0e12);
}

.fk-ath__detail-foot { display: flex; gap: var(--s-2); }
.fk-ath__detail-foot .fk-btn[disabled] { opacity: 0.5; cursor: default; }
.fk-ath__detail-foot .fk-ic { width: 15px; height: 15px; }

/* ---- responsive ---------------------------------------------------------- */
@media (max-width: 760px) {
  .fk-ath { padding-left: var(--s-4); padding-right: var(--s-4); }
  .fk-ath__cols { grid-template-columns: 1fr; }
  .fk-ath__side {
    position: static;
    border-right: 0;
    padding-right: 0;
    border-bottom: 1px solid var(--line-strong);
    padding-bottom: var(--s-5);
    margin-bottom: var(--s-2);
    box-shadow: 0 18px 28px -28px rgba(0, 0, 0, 0.85);
  }
  .fk-ath__main {
    padding-left: 0;
    padding-top: var(--s-6);
  }
  /* List scrolls in place so details stay put as profiles grow. */
  .fk-ath.is-populated .fk-ath__list {
    max-height: min(36vh, 260px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding-right: 2px;
  }
}

/* Phone: stage padding clears the floating pill (dock overlays, transparent). */
@media (max-width: 720px) {
  .fk-ath {
    padding-bottom: 24px;
  }
  .fk-ath__search-count {
    max-width: 38%;
    font-size: 10px;
    letter-spacing: 0.04em;
  }
  .fk-ath.is-populated .fk-ath__list {
    max-height: min(32vh, 220px);
  }
}

/* ---- session-creation modal (Stage 4 / gate 7) --------------------------- */
.fk-ath__modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; }
.fk-ath__modal[hidden] { display: none; }
.fk-ath__modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 12, 0.5);
}
.fk-ath__modal-panel {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100vw - 32px));
  background: var(--ink-800);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--elev-3);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.fk-ath__modal-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--fg-1);
}
.fk-ath__modal-body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--fg-2);
}
.fk-ath__modal-form { display: flex; flex-direction: column; gap: 14px; }
.fk-ath__modal-fields { display: flex; flex-direction: column; gap: 12px; }
.fk-ath__modal-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--fg-2);
}
.fk-ath__modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---- danger zone / erasure (Stage 5) ------------------------------------- */
/* Delete sits above the details bottom separator. */
.fk-ath__danger {
  margin-top: var(--s-3, 12px);
  padding: var(--s-2, 8px) 0 var(--s-4, 16px);
  border-top: 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
}
.fk-ath__delete {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--fg-3);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
.fk-ath__delete:hover {
  color: var(--risk);
  border-color: rgba(255, 155, 155, 0.4);
  background: rgba(255, 155, 155, 0.06);
}
.fk-ath__delete .fk-ic { width: 15px; height: 15px; }

.fk-ath__modal-title--danger { color: var(--risk); }
.fk-ath__danger-confirm {
  background: var(--risk);
  border: 1px solid var(--risk);
  color: #2a0808;
  font-weight: 600;
}
.fk-ath__danger-confirm:hover:not([disabled]) { filter: brightness(1.06); }
.fk-ath__danger-confirm[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
