:root {
  color-scheme: dark;
  --bg: #07101f;
  --panel: rgba(17, 28, 48, .92);
  --line: rgba(255,255,255,.12);
  --text: #f7f9fc;
  --muted: #aebbd0;
  --start: #25c06d;
  --stop: #ff5c57;
  --lap: #3c8cff;
  --warning: #ffb020;
  --purple: #9672ff;
  --radius: 22px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
}

/* ================================================================
   v50 athlete positions, roster sorting, and performance report
   ================================================================ */
.add-athlete-row {
  grid-template-columns: minmax(220px,1fr) minmax(170px,.5fr) auto;
}

.athlete-sort-control {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 8px;
  color: #426989;
  font-size: .78rem;
  font-weight: 850;
  white-space: nowrap;
}

.athlete-sort-control select {
  min-height: 42px;
  min-width: 176px;
  border-color: rgba(18,91,158,.2);
  background: #fff;
  color: #164d7d;
  font-weight: 800;
}

.management-page .athlete-list-toolbar {
  grid-template-columns: auto minmax(90px,1fr) auto auto;
}

.athlete-row-fields {
  display: grid;
  grid-template-columns: minmax(180px,1fr) minmax(118px,.38fr);
  gap: 9px;
  min-width: 0;
}

.athlete-edit-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.athlete-edit-field > span {
  color: #5f7f9e;
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.management-page .athlete-edit-field input,
.management-page .athlete-edit-field select,
.management-page #newAthletePosition {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border: 1px solid rgba(18,91,158,.18);
  border-radius: 12px;
  background: #fff;
  color: #164d7d;
  font-weight: 800;
}

.management-page .athlete-edit-field input:focus,
.management-page .athlete-edit-field select:focus,
.management-page #newAthletePosition:focus {
  border-color: #2488db;
  box-shadow: 0 0 0 3px rgba(36,136,219,.14);
}

.group-member-name {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.group-member-name strong {
  overflow: hidden;
  color: #164d7d;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-member-name small {
  color: #4d83af;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .08em;
}

@media (max-width:900px) {
  .management-page .athlete-list-toolbar {
    grid-template-columns: auto 1fr;
  }

  .athlete-sort-control {
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .athlete-sort-control select {
    flex: 1;
  }

  .management-page .athlete-bulk-delete {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-width:700px) {
  .add-athlete-row,
  .athlete-row-fields {
    grid-template-columns: 1fr;
  }

  .add-athlete-row .button {
    width: 100%;
  }
}

.feedback-page {
  --report-navy: #061c34;
  --report-blue: #0878df;
  --report-cyan: #16bde8;
  --report-ice: #eef7ff;
  --report-ink: #12283e;
  --report-muted: #60788f;
  --report-line: #d7e5f1;
}

.feedback-report-v50 {
  position: relative;
  width: min(100%,940px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 18px;
  background: #fff;
  color: var(--report-ink);
  box-shadow: 0 24px 60px rgba(13,54,91,.2);
  font-family:
    -apple-system, BlinkMacSystemFont, "Avenir Next", "Helvetica Neue",
    Arial, sans-serif;
}

.feedback-report-v50 table {
  table-layout: fixed;
}

.feedback-report-v50 th,
.feedback-report-v50 td {
  border: 0;
}

.feedback-report-hero {
  position: relative;
  overflow: hidden;
  padding: 17px 22px 18px;
  background:
    radial-gradient(circle at 88% -25%,rgba(22,189,232,.45),transparent 38%),
    linear-gradient(125deg,#04182e 0%,#073762 67%,#07599a 100%);
  color: #fff;
}

.feedback-report-hero::after {
  position: absolute;
  right: -58px;
  bottom: -86px;
  width: 250px;
  height: 160px;
  border: 22px solid rgba(255,255,255,.06);
  border-radius: 50%;
  content: "";
  transform: rotate(-16deg);
}

.feedback-report-topline,
.feedback-athlete-hero,
.feedback-sheet-brand,
.feedback-kpi-heading,
.feedback-section-heading,
.feedback-section-heading > div {
  display: flex;
  align-items: center;
}

.feedback-report-topline {
  position: relative;
  z-index: 1;
  justify-content: space-between;
  gap: 18px;
}

.feedback-sheet-brand {
  gap: 12px;
}

.feedback-sheet-brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 5px 12px rgba(0,0,0,.22));
}

.feedback-sheet-brand > div {
  display: grid;
  gap: 2px;
}

.feedback-sheet-brand span {
  color: #92daf4;
  font-size: .58rem;
  font-weight: 900;
  letter-spacing: .18em;
}

.feedback-sheet-brand strong {
  color: #fff;
  font-family:
    "Arial Narrow", "Avenir Next Condensed", "Helvetica Neue", sans-serif;
  font-size: 1.36rem;
  font-weight: 950;
  letter-spacing: .035em;
  line-height: 1;
}

.feedback-report-tag {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 999px;
  background: rgba(255,255,255,.09);
  backdrop-filter: blur(8px);
}

.feedback-report-tag span,
.feedback-report-tag strong {
  padding: 7px 10px;
  font-size: .64rem;
  font-weight: 950;
  letter-spacing: .1em;
}

.feedback-report-tag strong {
  background: var(--report-cyan);
  color: #03182b;
}

.feedback-athlete-hero {
  position: relative;
  z-index: 1;
  justify-content: space-between;
  gap: 20px;
  margin-top: 18px;
}

.feedback-athlete-kicker {
  display: block;
  margin-bottom: 3px;
  color: #72c9ee;
  font-size: .59rem;
  font-weight: 950;
  letter-spacing: .2em;
}

.feedback-athlete-hero h3 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.65rem,3vw,2.35rem);
  font-weight: 900;
  letter-spacing: -.025em;
  line-height: 1;
}

.feedback-athlete-hero dl {
  display: grid;
  grid-template-columns: minmax(80px,.55fr) minmax(100px,.75fr) minmax(220px,1.7fr);
  min-width: min(58%,520px);
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.17);
  border-radius: 11px;
  background: rgba(0,12,27,.22);
}

.feedback-athlete-hero dl > div {
  min-width: 0;
  padding: 7px 10px;
  border-right: 1px solid rgba(255,255,255,.13);
}

.feedback-athlete-hero dl > div:last-child {
  border-right: 0;
}

.feedback-athlete-hero dt {
  color: #7ecbea;
  font-size: .52rem;
  font-weight: 900;
  letter-spacing: .13em;
}

.feedback-athlete-hero dd {
  overflow-wrap: anywhere;
  margin: 2px 0 0;
  color: #fff;
  font-size: .74rem;
  font-weight: 850;
  line-height: 1.2;
}

.feedback-kpi-grid {
  display: grid;
  grid-template-columns: minmax(0,1.55fr) minmax(160px,.64fr) minmax(160px,.64fr);
  gap: 10px;
  padding: 13px 16px 10px;
  background: #f5faff;
}

.feedback-kpi {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--report-line);
  border-radius: 12px;
  background: #fff !important;
}

.feedback-kpi-total {
  padding: 9px 11px 10px;
}

.feedback-kpi-heading {
  gap: 8px;
  margin-bottom: 7px;
}

.feedback-kpi-heading > span,
.feedback-section-heading > div > span,
.feedback-comment-data h4 > span {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--report-blue);
  color: #fff;
  font-size: .62rem;
  font-weight: 950;
}

.feedback-kpi-heading > div {
  display: grid;
}

.feedback-kpi-heading strong {
  color: var(--report-ink);
  font-size: .82rem;
}

.feedback-kpi-heading small {
  color: var(--report-muted);
  font-size: .48rem;
  font-weight: 900;
  letter-spacing: .12em;
}

.feedback-total-list {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(65px,1fr));
  gap: 5px;
}

.feedback-total-item {
  position: relative;
  display: grid;
  gap: 1px;
  min-height: 48px;
  padding: 5px 7px;
  border-radius: 8px;
  background: var(--report-ice);
}

.feedback-total-item.is-best {
  background: linear-gradient(135deg,#dff7ff,#e7f2ff);
  box-shadow: inset 0 0 0 1px rgba(8,120,223,.2);
}

.feedback-total-item span {
  color: #53708b;
  font-size: .5rem;
  font-weight: 950;
  letter-spacing: .08em;
}

.feedback-total-item strong {
  color: #0a4f8f;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.feedback-total-item strong small {
  margin-left: 2px;
  font-size: .52rem;
}

.feedback-total-item em {
  position: absolute;
  top: 5px;
  right: 5px;
  color: #0786bd;
  font-size: .42rem;
  font-style: normal;
  font-weight: 950;
}

.feedback-kpi-score,
.feedback-kpi-fatigue {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 10px 8px;
  border-top: 5px solid var(--rating-color,#8aa0b4);
}

.feedback-kpi-score > span,
.feedback-kpi-fatigue > span {
  color: var(--report-muted);
  font-size: .5rem;
  font-weight: 950;
  letter-spacing: .1em;
}

.feedback-kpi-score > strong,
.feedback-kpi-fatigue > strong {
  margin: 4px 0 2px;
  color: var(--report-ink);
  font-size: 1.56rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.feedback-kpi-score > strong small {
  margin-left: 2px;
  font-size: .62rem;
}

.feedback-kpi-score > em,
.feedback-kpi-fatigue > em {
  color: var(--rating-color,#63798e);
  font-size: .58rem;
  font-style: normal;
  font-weight: 950;
}

.rating-elite,
.rating-outstanding { --rating-color: #058fd1; }
.rating-professional,
.rating-excellent { --rating-color: #12a66a; }
.rating-semi-pro,
.rating-good { --rating-color: #d2a500; }
.rating-amateur,
.rating-average { --rating-color: #e97816; }
.rating-needs-work { --rating-color: #d94149; }
.rating-unrated { --rating-color: #8094a8; }

.feedback-insight-strip {
  display: grid;
  grid-template-columns: 1.3fr 1fr .85fr;
  margin: 0 16px 10px;
  overflow: hidden;
  border: 1px solid var(--report-line);
  border-radius: 10px;
  background: #fff;
}

.feedback-insight-strip > div {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px 10px;
  border-right: 1px solid var(--report-line);
}

.feedback-insight-strip > div:last-child {
  border-right: 0;
}

.feedback-insight-strip span {
  color: var(--report-muted);
  font-size: .47rem;
  font-weight: 950;
  letter-spacing: .11em;
}

.feedback-insight-strip strong {
  overflow: hidden;
  color: #23435f;
  font-size: .68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-insight-strip .has-review {
  background: #fff9df;
}

.feedback-insight-strip .has-review strong {
  color: #8c6500;
}

.feedback-section {
  margin: 0 16px 10px;
  border: 1px solid var(--report-line);
  border-radius: 12px;
  background: #fff;
}

.feedback-section-heading {
  justify-content: space-between;
  min-height: 36px;
  padding: 6px 9px;
  border-bottom: 1px solid var(--report-line);
}

.feedback-section-heading > div {
  gap: 8px;
}

.feedback-section-heading h4 {
  margin: 0;
  color: var(--report-ink);
  font-size: .72rem;
  font-weight: 950;
  letter-spacing: .06em;
}

.feedback-section-heading p {
  margin: 0;
  color: var(--report-muted);
  font-size: .56rem;
  font-weight: 800;
}

.feedback-data-section {
  overflow: hidden;
}

.feedback-block-table-wrap {
  overflow: hidden;
}

.feedback-block-table {
  color: var(--report-ink);
}

.feedback-block-table thead th {
  height: 43px;
  padding: 4px;
  border-right: 1px solid #c9dceb;
  border-bottom: 1px solid #c9dceb;
  background: #e8f4ff;
}

.feedback-block-table thead th:last-child {
  border-right: 0;
}

.feedback-block-table thead th span,
.feedback-block-table thead th small {
  display: block;
  color: #59758f;
  font-size: .44rem;
  font-weight: 900;
  letter-spacing: .08em;
}

.feedback-block-table thead th strong {
  display: block;
  color: #0a4f8f;
  font-size: .88rem;
  line-height: 1;
}

.feedback-block-table .feedback-measure-head {
  width: 112px;
}

.feedback-block-table .feedback-drop-head {
  width: 104px;
  background: #dceeff;
}

.feedback-block-table tbody th,
.feedback-block-table tbody td {
  height: 29px;
  padding: 4px 6px;
  border-right: 1px solid #d8e5ef;
  border-bottom: 1px solid #d8e5ef;
  background: #fff;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.feedback-block-table tbody tr:last-child th,
.feedback-block-table tbody tr:last-child td {
  border-bottom: 0;
}

.feedback-block-table tbody td:last-child {
  border-right: 0;
}

.feedback-block-table tbody th {
  text-align: left;
}

.feedback-block-table tbody th span {
  display: block;
  color: #5f7a92;
  font-size: .43rem;
  font-weight: 950;
  letter-spacing: .08em;
}

.feedback-block-table tbody th strong {
  color: #183c5d;
  font-size: .64rem;
}

.feedback-block-table tbody td strong {
  font-size: .76rem;
}

.feedback-block-table tbody td small {
  margin-left: 2px;
  color: #71869a;
  font-size: .46rem;
}

.feedback-block-table .feedback-per-rep-row th,
.feedback-block-table .feedback-per-rep-row td {
  background: #f7fbff;
}

.feedback-block-table .feedback-per-rep-row td strong {
  color: #0878c8;
}

.feedback-block-table .feedback-drop-cell {
  background: #edf7ff;
}

.feedback-block-table .feedback-drop-cell strong {
  display: block;
  color: #075b9c;
  font-size: .84rem;
}

.feedback-block-table .feedback-drop-cell small {
  display: block;
  margin: 2px 0 0;
  font-size: .4rem;
}

.feedback-block-table td.is-review {
  background: #fff3ba !important;
  color: #725100;
}

.feedback-block-table .feedback-change-row th,
.feedback-block-table .feedback-change-row td {
  height: 34px;
  background: #092c4e;
  color: #fff;
}

.feedback-block-table .feedback-change-row th span,
.feedback-block-table .feedback-change-row th strong,
.feedback-block-table .feedback-change-row td strong,
.feedback-block-table .feedback-change-row td small {
  color: #fff;
}

.feedback-chart-section {
  min-height: 0;
  padding: 0 0 3px;
  border: 1px solid var(--report-line);
}

.feedback-chart-wrap {
  padding: 4px 8px 0;
}

.feedback-chart {
  width: 100%;
  max-height: 205px;
}

.chart-grid {
  stroke: #d8e7f1;
}

.chart-axis {
  stroke: #7390a9;
}

.chart-axis-label,
.chart-axis-title,
.chart-value {
  fill: #34546e;
  font-family:
    -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

.feedback-chart-legend {
  margin-top: -8px;
  padding-bottom: 4px;
  color: #3c5f7c;
  font-size: .62rem;
  font-weight: 850;
}

.feedback-commentary {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  margin: 0 16px 9px;
  overflow: hidden;
  border: 1px solid var(--report-line);
  border-radius: 12px;
  background: #fff;
}

.feedback-commentary > .feedback-comment {
  min-height: 78px;
  padding: 8px 10px;
  border-right: 1px solid var(--report-line);
}

.feedback-commentary > .feedback-comment:last-child {
  border-right: 0;
}

.feedback-comment h4 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 5px;
  color: #0b5b9d;
  font-size: .58rem;
  font-weight: 950;
  letter-spacing: .06em;
}

.feedback-comment p {
  margin: 0;
  color: #273f55;
  font-size: .6rem;
  line-height: 1.48;
  white-space: pre-wrap;
}

.feedback-review-badge {
  padding: 2px 6px;
  border-radius: 999px;
  background: #ffe273;
  color: #644900;
  font-size: .46rem;
  letter-spacing: 0;
}

.feedback-rating-guide {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 16px 8px;
}

.feedback-rating-guide > div {
  display: grid;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #eff7fd;
}

.feedback-rating-guide strong {
  color: #0c5b9c;
  font-size: .48rem;
  letter-spacing: .08em;
}

.feedback-rating-guide span {
  color: #5a738a;
  font-size: .46rem;
  line-height: 1.35;
}

.feedback-sheet-footer {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 7px 16px;
  background: #061c34;
  color: #bad8ed;
  font-size: .48rem;
}

.feedback-sheet-footer span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-sheet-footer strong {
  color: #4fd6f5;
  font-size: .48rem;
  letter-spacing: .08em;
}

@media (max-width:760px) {
  .feedback-report-v50 {
    min-width: 760px;
  }
}

@media print {
  body.printing-feedback .feedback-report-v50 {
    width: 198mm;
    min-height: 282mm;
    padding: 0;
    overflow: hidden;
    border-radius: 0;
  }

  body.printing-feedback .feedback-report-hero {
    padding: 4mm 5mm 4.2mm;
  }

  body.printing-feedback .feedback-sheet-brand img {
    width: 11mm;
    height: 11mm;
  }

  body.printing-feedback .feedback-sheet-brand strong {
    font-size: 14pt;
  }

  body.printing-feedback .feedback-athlete-hero {
    margin-top: 3.2mm;
  }

  body.printing-feedback .feedback-athlete-hero h3 {
    font-size: 20pt;
  }

  body.printing-feedback .feedback-kpi-grid {
    padding: 2.6mm 3.5mm 2mm;
  }

  body.printing-feedback .feedback-insight-strip,
  body.printing-feedback .feedback-section,
  body.printing-feedback .feedback-commentary,
  body.printing-feedback .feedback-rating-guide {
    margin-right: 3.5mm;
    margin-left: 3.5mm;
  }

  body.printing-feedback .feedback-insight-strip,
  body.printing-feedback .feedback-section {
    margin-bottom: 2mm;
  }

  body.printing-feedback .feedback-chart-section {
    min-height: 49mm;
  }

  body.printing-feedback .feedback-chart {
    max-height: 43mm;
  }

  body.printing-feedback .feedback-commentary {
    margin-bottom: 1.7mm;
  }

  body.printing-feedback .feedback-rating-guide {
    margin-bottom: 1.6mm;
  }
}

/* ================================================================
   v54 AST leaderboard
   ================================================================ */
.leaderboard-page {
  gap: 16px;
}

.leaderboard-page-intro {
  align-items: center;
}

.leaderboard-controls {
  padding: 16px 18px;
  border: 1px solid #cfe2f4;
  background: linear-gradient(135deg,#fff 0%,#f2f8fe 100%);
}

.leaderboard-control-grid {
  display: grid;
  grid-template-columns: minmax(180px,1.2fr) minmax(130px,.7fr) minmax(180px,1fr);
  gap: 14px;
  align-items: end;
}

.leaderboard-control-grid .field {
  margin: 0;
}

.leaderboard-control-grid select {
  min-height: 48px;
  border-color: #8fbce0;
  background: #fff;
  color: #123d63;
  font-weight: 800;
}

.leaderboard-status {
  min-height: 1.25em;
  margin: 11px 0 0;
  color: #52718d;
  font-size: .82rem;
  font-weight: 700;
}

.leaderboard-summary {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 0;
  overflow: hidden;
  padding: 0;
  border: 1px solid #bfd8ed;
  background: #fff;
}

.leaderboard-summary[hidden] {
  display: none;
}

.leaderboard-summary > div {
  min-width: 0;
  padding: 13px 16px;
  border-right: 1px solid #dbe9f5;
}

.leaderboard-summary > div:last-child {
  border-right: 0;
}

.leaderboard-summary span,
.leaderboard-summary strong {
  display: block;
}

.leaderboard-summary span {
  margin-bottom: 3px;
  color: #6b879f;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.leaderboard-summary strong {
  overflow: hidden;
  color: #123d63;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-empty {
  padding: 34px 22px;
  border: 1px dashed #90bde0;
  background: #f7fbff;
  text-align: center;
}

.leaderboard-empty strong {
  display: block;
  color: #174c76;
  font-size: 1.05rem;
}

.leaderboard-empty p {
  margin: 7px 0 0;
  color: #657f96;
}

.leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 14px;
  align-items: start;
}

.leaderboard-grid[hidden] {
  display: none;
}

.leaderboard-grid.is-single {
  grid-template-columns: minmax(340px,680px);
}

.leaderboard-loading {
  grid-column: 1 / -1;
  padding: 36px;
  border: 1px solid #c8def0;
  border-radius: 16px;
  background: #fff;
  color: #2f678f;
  font-weight: 800;
  text-align: center;
}

.leaderboard-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #c4dced;
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(20,69,105,.09);
}

.leaderboard-card-header {
  display: flex;
  min-height: 86px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  color: #fff;
  background: linear-gradient(125deg,#0a3e70 0%,#0878b9 100%);
}

.leaderboard-card-header span,
.leaderboard-card-header h3,
.leaderboard-card-header > strong {
  display: block;
  margin: 0;
}

.leaderboard-card-header span {
  opacity: .76;
  font-size: .57rem;
  font-weight: 900;
  letter-spacing: .13em;
}

.leaderboard-card-header h3 {
  margin-top: 2px;
  font-size: 1.55rem;
  line-height: 1;
}

.leaderboard-card-header > strong {
  max-width: 54%;
  opacity: .88;
  font-size: .62rem;
  letter-spacing: .04em;
  text-align: right;
}

.leaderboard-rank-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.leaderboard-rank-row {
  display: grid;
  grid-template-columns: 30px 48px minmax(0,1fr) auto;
  gap: 9px;
  min-height: 70px;
  align-items: center;
  padding: 9px 12px;
  border-top: 1px solid #e2edf6;
  background: #fff;
}

.leaderboard-rank-row.rank-1 {
  border-top: 0;
  background: linear-gradient(90deg,#fff8d8 0%,#fff 72%);
}

.leaderboard-rank-number {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: #e8f3fb;
  color: #175a89;
  font-size: .82rem;
}

.rank-1 .leaderboard-rank-number {
  background: #e6b72d;
  color: #fff;
  box-shadow: 0 3px 9px rgba(184,133,0,.24);
}

.rank-2 .leaderboard-rank-number {
  background: #9caabd;
  color: #fff;
}

.rank-3 .leaderboard-rank-number {
  background: #b87648;
  color: #fff;
}

.leaderboard-athlete-photo {
  display: grid;
  width: 48px;
  height: 48px;
  overflow: hidden;
  place-items: center;
  border: 2px solid #b9d6ea;
  border-radius: 50%;
  background: #eaf4fb;
  color: #17608e;
  font-size: .8rem;
  font-weight: 900;
}

.rank-1 .leaderboard-athlete-photo {
  border-color: #e4b72e;
}

.leaderboard-athlete-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.leaderboard-athlete-copy {
  min-width: 0;
}

.leaderboard-athlete-copy strong,
.leaderboard-athlete-copy span {
  display: block;
}

.leaderboard-athlete-copy strong {
  overflow: hidden;
  color: #143e61;
  font-size: .92rem;
  line-height: 1.14;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-athlete-copy span {
  margin-top: 4px;
  color: #69859b;
  font-size: .65rem;
  font-weight: 900;
  letter-spacing: .08em;
}

.leaderboard-time {
  min-width: 70px;
  text-align: right;
}

.leaderboard-time strong,
.leaderboard-time span {
  display: block;
}

.leaderboard-time strong {
  color: #075f9b;
  font-size: 1.08rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

.leaderboard-time strong small {
  margin-left: 2px;
  font-size: .58rem;
}

.leaderboard-time span {
  margin-top: 5px;
  color: #7a91a4;
  font-size: .59rem;
  font-variant-numeric: tabular-nums;
}

.leaderboard-card-empty {
  display: grid;
  min-height: 114px;
  place-items: center;
  padding: 20px;
  color: #8297a8;
  font-size: .78rem;
  font-weight: 800;
  text-align: center;
}

@media (max-width:1180px) {
  .leaderboard-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
}

@media (max-width:760px) {
  .leaderboard-control-grid,
  .leaderboard-summary,
  .leaderboard-grid,
  .leaderboard-grid.is-single {
    grid-template-columns: 1fr;
  }

  .leaderboard-summary > div {
    border-right: 0;
    border-bottom: 1px solid #dbe9f5;
  }

  .leaderboard-summary > div:last-child {
    border-bottom: 0;
  }
}
* { box-sizing: border-box; }
html { min-height:100%; background:var(--bg); }
body {
  margin:0; min-height:100vh; min-height:100dvh; color:var(--text);
  background:radial-gradient(circle at top left,rgba(60,140,255,.15),transparent 35%),radial-gradient(circle at top right,rgba(37,192,109,.1),transparent 30%),var(--bg);
  -webkit-tap-highlight-color:transparent; overscroll-behavior:none;
}
button,input,select { font:inherit; }
button,select { touch-action:manipulation; }
button { -webkit-user-select:none; user-select:none; }
[hidden] { display:none !important; }
.app-shell { width:min(1600px,100%); margin:auto; padding:max(18px,env(safe-area-inset-top)) max(18px,env(safe-area-inset-right)) max(28px,env(safe-area-inset-bottom)) max(18px,env(safe-area-inset-left)); }
.app-header { display:flex; align-items:end; justify-content:space-between; gap:18px; margin-bottom:18px; }
h1,h2,h3,p { margin-top:0; }
h1 { margin-bottom:0; font-size:clamp(2rem,4vw,3.5rem); line-height:.95; letter-spacing:-.045em; }
h2 { margin-bottom:0; font-size:1.8rem; }
h3 { margin-bottom:12px; font-size:1.25rem; }
.eyebrow { margin-bottom:8px; color:#78aaff; font-size:.75rem; font-weight:800; letter-spacing:.16em; }
.install-hint { max-width:280px; padding:10px 14px; border:1px solid var(--line); border-radius:999px; color:var(--muted); font-size:.88rem; text-align:center; }
.panel { border:1px solid var(--line); border-radius:var(--radius); background:var(--panel); box-shadow:0 18px 50px rgba(0,0,0,.22); backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px); }
.top-panel { display:grid; grid-template-columns:minmax(210px,.75fr) minmax(120px,.4fr) minmax(240px,1.3fr) auto; gap:14px; align-items:end; padding:16px; }
.menu-template-field select { min-width:210px; font-weight:850; }
.field { display:grid; gap:7px; min-width:0; }
.field>span,.field-label { color:var(--muted); font-size:.8rem; font-weight:750; }
input,select { width:100%; min-height:54px; border:1px solid var(--line); border-radius:14px; outline:0; background:#0a1528; color:var(--text); padding:0 14px; font-size:1rem; }
input:focus,select:focus { border-color:#5d9cff; box-shadow:0 0 0 3px rgba(60,140,255,.18); }
.top-actions { display:flex; gap:10px; }
.button { min-height:58px; border:0; border-radius:15px; padding:10px 15px; color:#fff; font-size:1rem; font-weight:800; cursor:pointer; transition:transform 90ms ease,filter 90ms ease,opacity 90ms ease; }
.button:active { transform:scale(.975); filter:brightness(.92); }
.button:disabled { cursor:not-allowed; opacity:.38; }
.start { background:linear-gradient(180deg,#2bd27a,#159653); }
.stop { background:linear-gradient(180deg,#ff6965,#d83c3c); }
.lap { background:linear-gradient(180deg,#4f9bff,#246ed9); }
.reset { background:#25344d; color:#e8eef9; }
.secondary { border:1px solid var(--line); background:#1a2942; }
.danger-outline { border:1px solid rgba(255,92,87,.52); background:rgba(255,92,87,.1); color:#ff8a86; }
.global-panel { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin-top:14px; padding:14px; }
.status-row { display:flex; justify-content:space-between; gap:12px; margin:13px 4px; color:var(--muted); font-size:.88rem; }
.timer-grid,.ast-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.timer-card,.ast-athlete-card { min-width:0; overflow:hidden; border:1px solid var(--line); border-radius:var(--radius); background:linear-gradient(160deg,rgba(20,34,57,.98),rgba(10,21,39,.98)); box-shadow:0 14px 45px rgba(0,0,0,.22); }
.timer-card.is-running { border-color:rgba(37,192,109,.55); }
.card-topline { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:14px 16px 8px; }
.timer-number,.ast-slot-number { color:var(--muted); font-size:.9rem; font-weight:800; }
.running-badge,.ast-card-status { border-radius:999px; background:#25344d; color:#c7d1e1; padding:6px 10px; font-size:.72rem; font-weight:850; white-space:nowrap; }
.is-running .running-badge,.ast-athlete-card.is-active .ast-card-status { background:rgba(37,192,109,.15); color:#57e89a; }
.ast-athlete-card.is-complete { border-color:rgba(60,140,255,.55); }
.ast-athlete-card.is-complete .ast-card-status { background:rgba(60,140,255,.15); color:#79afff; }
.athlete-select-wrap { display:block; padding:0 16px; }
.athlete-select,.ast-athlete-select { min-height:50px; background:#0a1528; font-size:1.05rem; font-weight:750; }
.time-display { padding:15px 12px 18px; overflow:hidden; font-size:clamp(2.8rem,6.4vw,5.8rem); font-weight:800; font-variant-numeric:tabular-nums; letter-spacing:-.055em; line-height:1; text-align:center; white-space:nowrap; }
.latest-lap { margin:0 12px 12px; border:1px solid rgba(60,140,255,.28); border-radius:15px; background:rgba(60,140,255,.09); padding:10px 12px; }
.latest-lap.flash { animation:lapFlash .55s ease; }
@keyframes lapFlash { 50% { background:rgba(60,140,255,.38); transform:scale(1.015); } }
.latest-lap-heading { display:flex; justify-content:space-between; gap:8px; margin-bottom:8px; color:var(--muted); font-size:.75rem; font-weight:800; }
.latest-lap-values { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.latest-lap-values div { display:grid; gap:3px; }
.latest-lap-values span { color:var(--muted); font-size:.68rem; }
.latest-lap-values strong { font-size:clamp(1.05rem,2.3vw,1.45rem); font-variant-numeric:tabular-nums; }
.timer-actions { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; padding:0 12px 13px; }
.timer-actions .button { min-height:62px; padding-inline:6px; font-size:clamp(.78rem,1.8vw,1rem); }
.laps-panel { border-top:1px solid var(--line); background:rgba(4,11,23,.35); }
.laps-panel summary { display:flex; justify-content:space-between; padding:13px 16px; color:var(--muted); font-weight:750; cursor:pointer; list-style:none; }
.laps-panel summary::-webkit-details-marker { display:none; }
.lap-table-wrap { max-height:250px; overflow:auto; padding:0 12px 14px; }
.lap-table { width:100%; border-collapse:collapse; font-variant-numeric:tabular-nums; font-size:.9rem; }
.lap-table th,.lap-table td { border-bottom:1px solid var(--line); padding:10px 8px; text-align:right; }
.lap-table th:first-child,.lap-table td:first-child { text-align:left; }
.lap-table th { position:sticky; top:0; background:#0c182b; color:var(--muted); font-size:.75rem; }
.no-laps { margin:10px 4px 2px; color:var(--muted); font-size:.85rem; text-align:center; }

/* AST */
.ast-settings-panel { display:grid; grid-template-columns:1.1fr 1fr auto; gap:18px; align-items:center; margin-top:14px; padding:16px; }
.ast-setting-title h2 { font-size:1.45rem; }
.set2-setting { display:grid; gap:7px; }
.time-setting-row { display:flex; gap:9px; }
.time-setting-row label { display:flex; align-items:center; gap:6px; color:var(--muted); font-weight:750; }
.time-setting-row input { width:88px; min-height:48px; text-align:center; font-size:1.15rem; font-weight:850; font-variant-numeric:tabular-nums; }
.warning-text { margin:0; color:#ffc55d; font-size:.78rem; }
.sound-toggle { display:flex; align-items:center; gap:9px; min-height:54px; padding:0 14px; border:1px solid var(--line); border-radius:14px; background:#0a1528; color:var(--muted); font-weight:750; }
.sound-toggle input { width:23px; min-height:23px; accent-color:var(--start); }
.ast-program-grid { display:grid; grid-template-columns:.9fr 1.6fr; gap:14px; margin-top:14px; }
.rep-flow-card,.schedule-card { padding:16px; }
.rep-flow { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.rep-flow span { padding:9px 11px; border:1px solid rgba(150,114,255,.25); border-radius:11px; background:rgba(150,114,255,.1); font-size:.86rem; font-weight:800; white-space:nowrap; }
.rep-flow b { color:var(--muted); }
.schedule-heading { display:flex; justify-content:space-between; align-items:end; gap:12px; }
.schedule-heading>span { color:var(--muted); font-size:.8rem; }
.ast-schedule { display:grid; grid-template-columns:repeat(var(--ast-block-count,5),minmax(0,1fr)); gap:7px; }
.schedule-item { display:grid; gap:4px; padding:9px; border:1px solid var(--line); border-radius:11px; background:#0b172a; }
.schedule-item.is-set2 { border-color:rgba(150,114,255,.3); }
.schedule-item small { color:var(--muted); font-size:.65rem; }
.schedule-item strong { font-size:.9rem; }
.schedule-item span { color:#79afff; font-size:.78rem; font-weight:850; }
.ast-dashboard { display:grid; grid-template-columns:1.05fr 1fr .85fr auto; gap:14px; align-items:center; margin-top:14px; padding:16px; }
.ast-master-time-wrap,.ast-current-block,.ast-next-block { min-width:0; }
.ast-master-time-wrap span,.ast-current-block>span,.ast-next-block>span { display:block; margin-bottom:6px; color:var(--muted); font-size:.75rem; font-weight:800; }
.ast-master-time-wrap strong { display:block; font-size:clamp(2.8rem,6vw,5.7rem); line-height:.9; letter-spacing:-.06em; font-variant-numeric:tabular-nums; white-space:nowrap; }
.ast-current-block strong { display:block; font-size:clamp(1.5rem,3vw,2.4rem); }
.ast-current-block p,.ast-next-block p { margin:5px 0 0; color:var(--muted); font-weight:750; }
.ast-next-block strong { display:block; color:#79afff; font-size:clamp(2rem,4vw,3.5rem); font-variant-numeric:tabular-nums; }
.ast-controls { display:grid; grid-template-columns:1fr 1fr; gap:8px; width:260px; }
.ast-controls .button:last-child { grid-column:1/-1; min-height:44px; }
.ast-block-time { display:grid; gap:5px; padding:15px 14px 8px; text-align:center; }
.ast-block-time span { color:var(--muted); font-size:.72rem; font-weight:800; }
.ast-block-time strong { font-size:clamp(2.5rem,4.5vw,4.2rem); line-height:1; font-variant-numeric:tabular-nums; letter-spacing:-.05em; }
.ast-finish-button { width:calc(100% - 24px); margin:0 12px 8px; min-height:68px; background:linear-gradient(180deg,#a180ff,#7049da); font-size:1.1rem; }
.ast-finish-button.is-recorded { background:linear-gradient(180deg,#4f9bff,#246ed9); }
.ast-undo-button { width:calc(100% - 24px); margin:0 12px 12px; min-height:34px; border:1px solid var(--line); border-radius:10px; background:#17243a; color:var(--muted); font-size:.75rem; font-weight:750; }
.ast-history-panel { border-top:1px solid var(--line); background:rgba(4,11,23,.35); }
.ast-history-heading { display:flex; justify-content:space-between; gap:8px; padding:11px 12px 8px; color:var(--muted); font-size:.76rem; font-weight:800; }
.ast-history-list { display:grid; padding:0 10px 12px; }
.ast-history-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:7px; align-items:center; padding:8px 2px; border-bottom:1px solid var(--line); }
.ast-history-row:last-child { border-bottom:0; }
.ast-history-label { min-width:0; overflow:hidden; color:var(--muted); font-size:.72rem; font-weight:750; text-overflow:ellipsis; white-space:nowrap; }
.ast-history-value { display:flex; align-items:baseline; justify-content:flex-end; gap:4px; min-width:0; font-variant-numeric:tabular-nums; white-space:nowrap; }
.ast-history-total { color:var(--text); font-size:.78rem; }
.ast-history-per-rep { color:#79afff; font-size:.72rem; }
.ast-history-empty { margin:6px 0 2px; color:var(--muted); font-size:.8rem; text-align:center; }

.modal { width:min(680px,calc(100vw - 28px)); max-height:min(820px,calc(100dvh - 28px)); border:1px solid var(--line); border-radius:24px; padding:0; background:#0c1729; color:var(--text); box-shadow:0 24px 90px rgba(0,0,0,.6); }
.modal::backdrop { background:rgba(1,6,15,.78); backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px); }
.modal-card { display:grid; gap:16px; padding:20px; }
.modal-header { display:flex; align-items:center; justify-content:space-between; }
.icon-button { width:48px; height:48px; border:1px solid var(--line); border-radius:50%; background:#17243a; color:var(--text); font-size:1.8rem; }
.add-athlete-row { display:grid; grid-template-columns:1fr auto; gap:10px; }
.athlete-register-panel { display:grid; gap:12px; }
.athlete-register-section { display:grid; gap:10px; padding:14px; border:1px solid var(--line); border-radius:16px; background:rgba(255,255,255,.025); }
.athlete-register-heading { display:flex; align-items:baseline; justify-content:space-between; gap:12px; }
.athlete-register-heading h3 { margin:0; font-size:1rem; }
.athlete-register-heading span { color:var(--muted); font-size:.75rem; font-weight:750; }
.bulk-register-section textarea { width:100%; min-height:132px; resize:vertical; border:1px solid var(--line); border-radius:14px; outline:none; background:#0a1528; color:var(--text); padding:12px 14px; font:inherit; font-size:1rem; line-height:1.55; }
.bulk-register-section textarea:focus { border-color:#5d9cff; box-shadow:0 0 0 3px rgba(60,140,255,.18); }
.bulk-register-footer { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; align-items:center; }
.bulk-register-footer .button { min-width:150px; }
.bulk-athlete-status { margin:0; color:var(--muted); font-size:.82rem; line-height:1.45; }
.bulk-athlete-status.is-success { color:#65e5a0; }
.bulk-athlete-status.is-warning { color:#ffc56b; }
.helper { margin-bottom:0; color:var(--muted); font-size:.86rem; line-height:1.55; }
.athlete-list-toolbar { display:grid; grid-template-columns:auto 1fr auto; gap:12px; align-items:center; padding:11px 12px; border:1px solid var(--line); border-radius:14px; background:rgba(255,255,255,.025); }
.athlete-select-all { display:flex; align-items:center; gap:8px; font-size:.88rem; font-weight:800; cursor:pointer; }
.athlete-select-all input,
.athlete-row-checkbox { width:22px; height:22px; min-height:0; accent-color:#4f9bff; }
.athlete-count { color:var(--muted); font-size:.84rem; font-weight:800; }
.athlete-bulk-delete { min-height:48px; }
.athlete-list { display:grid; gap:9px; max-height:440px; overflow:auto; }
.athlete-row { display:grid; grid-template-columns:28px 36px minmax(0,1fr) auto; gap:8px; align-items:center; }
.athlete-index { color:var(--muted); text-align:center; font-weight:800; }
.athlete-row > input[type="text"] { min-height:48px; }
.athlete-row-actions { display:flex; gap:6px; }
.small-button { min-height:48px; border:1px solid var(--line); border-radius:12px; background:#1b2a43; color:var(--text); padding:0 13px; font-weight:800; }
.small-button.delete { color:#ff918d; }
.modal-footer { display:flex; justify-content:flex-end; }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }

@media (min-width:1180px) {
  .timer-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .time-display { font-size:clamp(2.7rem,4.3vw,4.8rem); }
}
@media (orientation:landscape) and (min-width:1000px) {
  .timer-grid,.ast-grid { grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; }
  .timer-card,.ast-athlete-card { border-radius:18px; }
  .card-topline { padding:10px 10px 6px; }
  .athlete-select-wrap { padding:0 9px; }
  .athlete-select,.ast-athlete-select { min-height:44px; padding-inline:9px; font-size:.88rem; }
  .time-display { padding:12px 5px; font-size:clamp(2rem,3.3vw,3rem); }
  .latest-lap { margin:0 8px 8px; padding:8px; }
  .latest-lap-values strong { font-size:.95rem; }
  .timer-actions { grid-template-columns:1fr 1fr; gap:6px; padding:0 8px 9px; }
  .timer-actions .button { min-height:48px; font-size:.78rem; }
  .ast-block-time { padding:12px 8px 6px; }
  .ast-block-time strong { font-size:clamp(2rem,3.2vw,2.9rem); }
  .ast-finish-button { width:calc(100% - 16px); margin:0 8px 7px; min-height:56px; font-size:.9rem; }
  .ast-undo-button { width:calc(100% - 16px); margin:0 8px 8px; }
}
@media (max-width:1050px) {
  .top-panel { grid-template-columns:auto 130px 1fr; }
  .top-actions { grid-column:1/-1; }
  .top-actions .button { flex:1; }
  .ast-dashboard { grid-template-columns:1fr 1fr; }
  .ast-controls { width:auto; }
}
@media (max-width:760px) {
  .app-shell { padding-inline:10px; }
  .athlete-register-heading { align-items:flex-start; flex-direction:column; gap:4px; }
  .bulk-register-footer { grid-template-columns:1fr; }
  .bulk-register-footer .button { width:100%; }
  .athlete-list-toolbar { grid-template-columns:1fr auto; }
  .athlete-bulk-delete { grid-column:1 / -1; width:100%; }
  .athlete-row { grid-template-columns:28px 30px minmax(0,1fr); }
  .athlete-row-actions { grid-column:3; }
  .athlete-row-actions .small-button { flex:1; }
  .app-header { align-items:flex-start; flex-direction:column; }
  .top-panel { grid-template-columns:1fr; }
  .top-actions { grid-column:auto; }
  .global-panel { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .timer-grid,.ast-grid { grid-template-columns:1fr; }
  .time-display { font-size:clamp(3.2rem,15vw,5rem); }
  .ast-settings-panel,.ast-program-grid,.ast-dashboard { grid-template-columns:1fr; }
  .ast-schedule { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .ast-controls { width:100%; }
  .status-row { padding-inline:5px; }
}
@media (prefers-reduced-motion:reduce) { * { scroll-behavior:auto!important; transition:none!important; animation:none!important; } }


/* AST setup -> focused timing flow */
.ast-setup-screen { display:grid; gap:14px; margin-top:14px; }
.ast-setup-hero { display:grid; grid-template-columns:minmax(260px,1.25fr) minmax(250px,.8fr) auto minmax(220px,.65fr); gap:18px; align-items:center; padding:22px; }
.ast-setup-copy p:last-child { margin:10px 0 0; color:var(--muted); line-height:1.55; }
.set2-setting-large { padding:14px; border:1px solid rgba(60,140,255,.28); border-radius:16px; background:rgba(60,140,255,.08); }
.set2-setting-large .time-setting-row input { width:104px; min-height:62px; font-size:1.55rem; }
.ast-setup-start { min-height:72px; font-size:1.12rem; }
.ast-setup-roster-heading { display:flex; align-items:end; justify-content:space-between; gap:18px; padding:10px 4px 0; }
.ast-setup-roster-heading h2 { margin:0; }
.ast-setup-roster-heading > p { margin:0; color:var(--muted); font-size:.86rem; }
.ast-athlete-name-display { display:none; margin:0 12px; padding:12px; overflow:hidden; border:1px solid rgba(60,140,255,.28); border-radius:13px; background:rgba(60,140,255,.08); font-size:1.05rem; font-weight:850; text-align:center; text-overflow:ellipsis; white-space:nowrap; }
.ast-mode-setup .ast-grid { margin-top:0; }
.ast-mode-setup .ast-athlete-card { padding-bottom:10px; }
.ast-mode-setup .ast-athlete-card .ast-block-time,
.ast-mode-setup .ast-athlete-card .ast-finish-button,
.ast-mode-setup .ast-athlete-card .ast-undo-button,
.ast-mode-setup .ast-athlete-card .ast-history-panel { display:none; }
.ast-mode-setup .ast-card-status { display:none; }
.ast-mode-running .ast-athlete-card .athlete-select-wrap { display:none; }
.ast-mode-running .ast-athlete-name-display { display:block; }
.ast-mode-running .ast-grid { margin-top:14px; }
.ast-run-screen { margin-top:0; }
.ast-dashboard-focus { position:sticky; top:max(8px,env(safe-area-inset-top)); z-index:20; grid-template-columns:1.2fr .78fr .78fr .58fr auto; margin-top:0; border-color:rgba(60,140,255,.3); box-shadow:0 15px 55px rgba(0,0,0,.4); }
.ast-runtime-summary { min-width:0; }
.ast-runtime-summary span { display:block; margin-bottom:6px; color:var(--muted); font-size:.75rem; font-weight:800; }
.ast-runtime-summary strong { display:block; font-size:1.3rem; white-space:nowrap; }
.ast-runtime-controls { grid-template-columns:1fr 1fr; width:280px; }
.ast-runtime-controls .button { min-height:50px; }
.ast-runtime-controls .button:last-child { grid-column:auto; min-height:50px; }
body.ast-focus-mode .app-header,
body.ast-focus-mode .top-panel { display:none; }
body.ast-focus-mode .app-shell { width:min(1800px,100%); padding-top:max(8px,env(safe-area-inset-top)); }
body.ast-focus-mode #astView { margin-top:0; }

@media (orientation:landscape) and (min-width:1000px) {
  .ast-mode-running .ast-grid { grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; }
  .ast-mode-running .ast-athlete-name-display { margin:0 8px; padding:9px 7px; font-size:.88rem; }
  .ast-mode-running .ast-history-heading { padding:8px 8px 6px; font-size:.68rem; }
  .ast-mode-running .ast-history-list { padding:0 7px 8px; }
  .ast-mode-running .ast-history-row { grid-template-columns:minmax(0,1fr) auto; gap:4px; padding:6px 1px; }
  .ast-mode-running .ast-history-label { font-size:.62rem; }
  .ast-mode-running .ast-history-value { gap:2px; }
  .ast-mode-running .ast-history-total { font-size:.66rem; }
  .ast-mode-running .ast-history-per-rep { font-size:.61rem; }
  .ast-dashboard-focus .ast-master-time-wrap strong { font-size:clamp(3.2rem,5vw,5.4rem); }
}

@media (max-width:1100px) {
  .ast-setup-hero { grid-template-columns:1fr 1fr; }
  .ast-setup-start { min-height:62px; }
  .ast-dashboard-focus { grid-template-columns:1fr 1fr; }
  .ast-runtime-controls { width:100%; }
}

@media (max-width:760px) {
  .ast-setup-hero { grid-template-columns:1fr; padding:16px; }
  .ast-setup-roster-heading { align-items:flex-start; flex-direction:column; }
  .ast-dashboard-focus { position:static; grid-template-columns:1fr; }
  .ast-runtime-controls { grid-template-columns:1fr 1fr; }
}


/* AST guided flow v5 */
.ast-flow-setup { gap:18px; }
.ast-step-panel { padding:20px; }
.ast-step-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:18px; margin-bottom:16px; }
.ast-step-heading h2 { margin:0; }
.ast-step-heading > p { max-width:520px; margin:0; color:var(--muted); line-height:1.5; }
.ast-roster-step .ast-grid { margin-top:0; }
.ast-time-setting-layout { display:grid; grid-template-columns:minmax(280px,1fr) auto minmax(220px,.55fr); align-items:center; gap:18px; }
.ast-time-step .ast-setup-start { min-height:74px; }
.ast-complete-button { grid-column:1/-1; min-height:52px; background:linear-gradient(180deg,#ffb933,#e68a00); color:#161006; }
.ast-completion-dialog { width:min(620px,calc(100vw - 28px)); }
.ast-completion-copy { margin:0; color:var(--muted); line-height:1.65; }
.ast-completion-status { min-height:1.5em; margin:0; color:#57e89a; font-weight:750; }
.ast-completion-actions { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.ast-completion-actions .button:last-child { grid-column:1/-1; }
.ast-mode-running #astRunGridHost { margin-top:14px; }

@media (max-width:900px) {
  .ast-time-setting-layout { grid-template-columns:1fr 1fr; }
  .ast-time-step .ast-setup-start { grid-column:1/-1; }
}
@media (max-width:680px) {
  .ast-step-heading { align-items:flex-start; flex-direction:column; }
  .ast-time-setting-layout { grid-template-columns:1fr; }
  .ast-time-step .ast-setup-start { grid-column:auto; }
  .ast-completion-actions { grid-template-columns:1fr; }
  .ast-completion-actions .button:last-child { grid-column:auto; }
}


/* AST per-athlete carry-over progression v9 */
.ast-athlete-card.is-complete .ast-block-time strong {
  color: #79afff;
}
.ast-athlete-card .ast-block-time span {
  min-height: 1.2em;
  text-align: center;
}


/* ================================================================
   Athlete groups + completion home (v14)
   ================================================================ */
.ast-group-picker {
  display: grid;
  grid-template-columns: minmax(240px, .75fr) minmax(240px, 1.25fr);
  gap: 14px;
  align-items: end;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid rgba(79, 155, 255, .28);
  border-radius: 16px;
  background: rgba(79, 155, 255, .07);
}
.ast-group-picker select {
  font-weight: 850;
}
.ast-group-status {
  min-height: 54px;
  display: flex;
  align-items: center;
  margin: 0;
  border-radius: 13px;
  background: rgba(255, 255, 255, .035);
  color: var(--muted);
  padding: 10px 12px;
  font-size: .86rem;
  line-height: 1.45;
}
.ast-group-status.is-success {
  color: #66e8a2;
  background: rgba(37, 192, 109, .09);
}
.ast-group-status.is-warning {
  color: #ffd078;
  background: rgba(255, 176, 32, .09);
}

.athlete-group-manager {
  display: grid;
  gap: 11px;
  padding: 14px;
  border: 1px solid rgba(79, 155, 255, .3);
  border-radius: 16px;
  background: rgba(79, 155, 255, .055);
}
.athlete-group-manager .eyebrow {
  margin-bottom: 4px;
}
.athlete-group-create {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}
.group-manager-status {
  margin: 0;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.45;
}
.group-manager-status.is-success {
  color: #66e8a2;
}
.group-manager-status.is-warning {
  color: #ffd078;
}
.athlete-group-list {
  display: grid;
  gap: 8px;
}
.athlete-group-empty {
  margin: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, .035);
  color: var(--muted);
  padding: 11px 12px;
  font-size: .84rem;
  text-align: center;
}
.athlete-group-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #0a1528;
  padding: 10px 11px;
}
.athlete-group-details {
  min-width: 0;
}
.athlete-group-details strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.athlete-group-details span {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: .76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.athlete-group-actions {
  display: flex;
  gap: 6px;
}
.athlete-group-actions .small-button {
  min-height: 42px;
}
.ast-completion-actions .button:last-child {
  grid-column: auto;
}

@media (max-width: 760px) {
  .ast-group-picker {
    grid-template-columns: 1fr;
  }
  .athlete-group-create {
    grid-template-columns: 1fr;
  }
  .athlete-group-row {
    grid-template-columns: 1fr;
  }
  .athlete-group-actions .small-button {
    flex: 1;
  }
}


/* ================================================================
   Athlete face photos (v15)
   ================================================================ */
.athlete-photo-display {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 86px;
  height: 86px;
  border: 2px solid rgba(255, 255, 255, .12);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(79, 155, 255, .2), transparent 42%),
    #13213a;
  color: #9fb0c9;
  flex: 0 0 auto;
}
.athlete-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.athlete-photo-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 1.75rem;
  font-weight: 900;
  text-transform: uppercase;
}
.timer-athlete-photo {
  width: 76px;
  height: 76px;
  margin: 12px auto 0;
}
.ast-athlete-identity {
  display: grid;
  justify-items: center;
  gap: 9px;
  padding: 12px 12px 4px;
}
.ast-athlete-photo {
  width: 92px;
  height: 92px;
}
.ast-athlete-name-display {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.athlete-photo-editor {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 82px;
}
.athlete-photo-editor .athlete-photo-display {
  width: 62px;
  height: 62px;
}
.athlete-photo-editor .athlete-photo-placeholder {
  font-size: 1.25rem;
}
.athlete-photo-controls {
  display: flex;
  gap: 4px;
}
.photo-small-button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1b2a43;
  color: var(--text);
  padding: 0 7px;
  font-size: .68rem;
  font-weight: 850;
  cursor: pointer;
}
.photo-small-button.remove {
  color: #ff9a96;
}
.athlete-photo-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}
.athlete-row {
  grid-template-columns: 28px 36px 82px minmax(0, 1fr) auto;
}
.photo-save-message {
  color: #66e8a2;
}

@media (orientation: landscape) and (min-width: 900px) {
  .ast-mode-setup .ast-athlete-photo {
    width: 82px;
    height: 82px;
  }
  .ast-mode-running .ast-athlete-photo {
    width: 96px;
    height: 96px;
  }
}

@media (max-width: 760px) {
  .athlete-row {
    grid-template-columns: 28px 30px 74px minmax(0, 1fr);
  }
  .athlete-row-actions {
    grid-column: 4;
  }
  .athlete-photo-editor .athlete-photo-display {
    width: 56px;
    height: 56px;
  }
}


/* ================================================================
   Separate athlete and group management screens (v16)
   ================================================================ */
.group-dialog {
  width: min(760px, calc(100vw - 28px));
}
.group-member-panel,
.saved-group-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .025);
}
.group-member-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.group-member-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}
.group-member-row {
  display: grid;
  grid-template-columns: 24px 52px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #0a1528;
  padding: 8px 10px;
  cursor: pointer;
}
.group-member-row.is-selected {
  border-color: rgba(79, 155, 255, .55);
  background: rgba(79, 155, 255, .1);
}
.group-member-row input {
  width: 21px;
  height: 21px;
  min-height: 0;
  accent-color: #4f9bff;
}
.group-member-photo {
  width: 48px;
  height: 48px;
  border-width: 1px;
}
.group-member-photo .athlete-photo-placeholder {
  font-size: 1rem;
}
.group-member-name {
  min-width: 0;
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.saved-group-panel .athlete-group-list {
  max-height: 250px;
  overflow: auto;
}
.top-actions {
  flex-wrap: wrap;
}
.top-actions .button {
  white-space: nowrap;
}

@media (max-width: 760px) {
  .group-member-list {
    grid-template-columns: 1fr;
  }
}


/* ================================================================
   Sidebar navigation + page-based layout (v17)
   ================================================================ */
body { overflow-x:hidden; }
.app-shell.sidebar-layout {
  display:grid;
  grid-template-columns:225px minmax(0,1fr);
  width:100%;
  max-width:none;
  min-height:100vh;
  min-height:100dvh;
  margin:0;
  padding:0;
}
.app-sidebar {
  position:sticky;
  top:0;
  display:flex;
  flex-direction:column;
  align-self:start;
  min-height:100vh;
  min-height:100dvh;
  border-right:1px solid var(--line);
  background:rgba(5,13,26,.97);
  padding:max(20px,env(safe-area-inset-top)) 13px max(18px,env(safe-area-inset-bottom));
  z-index:30;
}
.sidebar-brand { display:flex; align-items:center; gap:11px; padding:3px 7px 24px; }
.sidebar-logo {
  display:grid; place-items:center; width:45px; height:45px; border-radius:14px;
  background:linear-gradient(145deg,#4f9bff,#285ec5); color:#fff; font-size:.96rem;
  font-weight:950; letter-spacing:-.04em; box-shadow:0 9px 24px rgba(48,117,221,.3);
}
.sidebar-brand p { margin:0 0 3px; color:#78aaff; font-size:.61rem; font-weight:850; letter-spacing:.13em; }
.sidebar-brand strong { display:block; font-size:1.05rem; white-space:nowrap; }
.sidebar-nav { display:grid; gap:7px; }
.sidebar-item {
  display:grid; grid-template-columns:34px minmax(0,1fr); gap:9px; align-items:center;
  width:100%; min-height:57px; border:1px solid transparent; border-radius:14px;
  background:transparent; color:var(--muted); padding:8px 10px; font-size:.91rem;
  font-weight:820; text-align:left; cursor:pointer;
}
.sidebar-item:active { transform:scale(.985); }
.sidebar-item.is-active {
  border-color:rgba(79,155,255,.34);
  background:linear-gradient(100deg,rgba(79,155,255,.2),rgba(79,155,255,.07));
  color:#fff;
}
.sidebar-icon {
  display:grid; place-items:center; width:32px; height:32px; border-radius:10px;
  background:rgba(255,255,255,.055); font-size:1.2rem;
}
.sidebar-item.is-active .sidebar-icon { background:rgba(79,155,255,.22); color:#90bbff; }
.sidebar-footer {
  display:grid; gap:12px; margin-top:auto; padding:20px 7px 0;
  color:#6f7d93; font-size:.71rem; font-weight:750; text-align:center;
}
.sidebar-footer .install-hint { max-width:none; font-size:.73rem; line-height:1.4; }
.app-main {
  min-width:0;
  padding:max(20px,env(safe-area-inset-top)) max(20px,env(safe-area-inset-right))
    max(30px,env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left));
}
.page-header { align-items:center; margin-bottom:18px; }
.page-header h1 { font-size:clamp(2rem,3.7vw,3.2rem); }
.page-subtitle { margin:8px 0 0; color:var(--muted); }
.header-save-state {
  border:1px solid var(--line); border-radius:999px; background:rgba(255,255,255,.035);
  color:var(--muted); padding:9px 13px; font-size:.78rem; font-weight:750;
}
.page-container,.app-page { min-width:0; }
.app-page[hidden] { display:none!important; }
.home-template-panel {
  grid-template-columns:minmax(190px,.8fr) minmax(200px,1fr) minmax(240px,1.25fr) minmax(120px,.5fr);
}
.section-title-block { align-self:center; }
.section-title-block h2,.section-heading-row h2,.page-intro h2 { margin:0; }
.section-heading-row { display:flex; align-items:center; justify-content:space-between; gap:14px; }
.master-stopwatch-panel { display:grid; gap:14px; margin-top:15px; padding:17px; }
.master-time {
  padding:8px 10px 12px; overflow:hidden; font-size:clamp(4rem,9vw,8.7rem);
  font-weight:850; font-variant-numeric:tabular-nums; letter-spacing:-.065em;
  line-height:1; text-align:center; white-space:nowrap;
}
.master-controls { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.master-laps-panel {
  overflow:hidden; border:1px solid var(--line); border-radius:15px;
  background:rgba(3,11,23,.3);
}
.master-laps-panel summary {
  display:flex; justify-content:space-between; padding:12px 14px;
  color:var(--muted); font-weight:780; cursor:pointer; list-style:none;
}
.master-laps-panel summary::-webkit-details-marker { display:none; }
.master-lap-list { display:grid; max-height:220px; overflow:auto; padding:0 12px 12px; }
.master-lap-row {
  display:grid; grid-template-columns:80px 1fr 1fr; gap:10px;
  border-top:1px solid var(--line); padding:10px 4px; font-variant-numeric:tabular-nums;
}
.master-lap-row span { text-align:right; }
.athlete-stopwatch-header { display:grid; gap:13px; margin:15px 0; padding:16px; }
.embedded-global-panel {
  margin:0; padding:0; border:0; background:transparent; box-shadow:none;
  backdrop-filter:none; -webkit-backdrop-filter:none;
}
.management-page { display:grid; gap:15px; }
.page-intro { border-bottom:1px solid var(--line); padding:4px 2px 17px; }
.page-intro p:last-child { margin:8px 0 0; color:var(--muted); }
.management-list-panel { display:grid; gap:11px; padding:15px; }
.management-page .athlete-list { max-height:none; }
.management-page .group-member-list { max-height:520px; }
.management-page .athlete-group-list { max-height:350px; overflow:auto; }
.csv-dashboard { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.csv-summary-card { display:grid; gap:8px; padding:18px; }
.csv-summary-card span { color:var(--muted); font-size:.79rem; font-weight:750; }
.csv-summary-card strong { overflow:hidden; font-size:1.4rem; text-overflow:ellipsis; white-space:nowrap; }
.csv-export-panel {
  display:grid; grid-template-columns:minmax(0,1fr) auto; gap:18px; align-items:center; padding:18px;
}
.csv-export-copy h3,.csv-option-card h3 { margin:0; }
.csv-export-copy p,.csv-option-card p { margin:7px 0 0; color:var(--muted); line-height:1.5; }
.csv-primary-button { min-width:230px; }
.csv-option-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.csv-option-card { display:grid; gap:12px; align-content:start; padding:18px; }
.csv-option-card .button { margin-top:auto; }
.csv-page-status { min-height:42px; margin:0; border-radius:12px; color:var(--muted); padding:10px 12px; }
.csv-page-status.is-success { background:rgba(37,192,109,.1); color:#69e8a3; }
.running-badge.is-running { background:rgba(37,192,109,.15); color:#57e89a; }

body.ast-focus-mode .app-header { display:flex; }
body.ast-focus-mode .app-shell { width:100%; padding:0; }
body.ast-focus-mode .top-panel { display:none; }

@media (max-width:1100px) {
  .app-shell.sidebar-layout { grid-template-columns:190px minmax(0,1fr); }
  .sidebar-brand strong { font-size:.96rem; }
  .sidebar-item { grid-template-columns:31px minmax(0,1fr); padding-inline:8px; font-size:.83rem; }
  .home-template-panel { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .section-title-block { grid-column:1/-1; }
}
@media (max-width:760px) {
  .app-shell.sidebar-layout { display:block; }
  .app-sidebar {
    position:sticky; top:0; min-height:auto; border-right:0; border-bottom:1px solid var(--line);
    padding:max(8px,env(safe-area-inset-top)) 8px 8px;
  }
  .sidebar-brand,.sidebar-footer { display:none; }
  .sidebar-nav { grid-template-columns:repeat(4,minmax(0,1fr)); gap:5px; }
  .sidebar-item {
    display:grid; grid-template-columns:1fr; gap:3px; justify-items:center;
    min-height:58px; padding:5px 2px; font-size:.66rem; text-align:center;
  }
  .sidebar-icon { width:29px; height:29px; font-size:1rem; }
  .app-main { padding:13px 10px max(24px,env(safe-area-inset-bottom)); }
  .page-header { align-items:flex-start; }
  .header-save-state { display:none; }
  .home-template-panel { grid-template-columns:1fr; }
  .section-title-block { grid-column:auto; }
  .master-controls,.embedded-global-panel { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .master-time { font-size:clamp(3.2rem,16vw,5.4rem); }
  .master-lap-row { grid-template-columns:65px 1fr; }
  .master-lap-row span:last-child { grid-column:2; }
  .csv-dashboard,.csv-option-grid,.csv-export-panel { grid-template-columns:1fr; }
  .csv-primary-button { min-width:0; width:100%; }
}


/* ================================================================
   Linked Master stopwatch + collapsible sidebar (v18)
   ================================================================ */
.sidebar-brand {
  justify-content: space-between;
}
.sidebar-brand-main {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 11px;
}
.sidebar-brand-copy {
  min-width: 0;
}
.sidebar-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255,255,255,.045);
  color: #b9c7da;
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease;
}
.sidebar-toggle:active {
  transform: scale(.94);
}
.sidebar-toggle span {
  transform: translateY(-1px);
}
.master-link-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 700;
}

/* Collapsed sidebar on iPad landscape / desktop. */
body.sidebar-collapsed .app-shell.sidebar-layout {
  grid-template-columns: 78px minmax(0,1fr);
}
body.sidebar-collapsed .app-sidebar {
  padding-inline: 9px;
}
body.sidebar-collapsed .sidebar-brand {
  display: grid;
  justify-items: center;
  gap: 9px;
  padding-inline: 0;
}
body.sidebar-collapsed .sidebar-brand-main {
  justify-content: center;
}
body.sidebar-collapsed .sidebar-brand-copy,
body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .sidebar-footer {
  display: none;
}
body.sidebar-collapsed .sidebar-item {
  grid-template-columns: 1fr;
  justify-items: center;
  padding-inline: 5px;
}
body.sidebar-collapsed .sidebar-icon {
  width: 38px;
  height: 38px;
}
body.sidebar-collapsed .sidebar-toggle span {
  transform: rotate(180deg) translateY(1px);
}
body.sidebar-collapsed .sidebar-item {
  position: relative;
}
body.sidebar-collapsed .sidebar-item:hover::after {
  content: attr(data-tooltip);
}

/* Existing navigation buttons use their visible label as an accessible title. */
body.sidebar-collapsed #navHome::after,
body.sidebar-collapsed #openAthletes::after,
body.sidebar-collapsed #openGroups::after,
body.sidebar-collapsed #openCsv::after {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  display: none;
  width: max-content;
  max-width: 180px;
  transform: translateY(-50%);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #101d31;
  color: #fff;
  padding: 7px 9px;
  font-size: .75rem;
  font-weight: 750;
  box-shadow: 0 8px 25px rgba(0,0,0,.35);
  z-index: 60;
}
body.sidebar-collapsed #navHome::after { content: "ホーム"; }
body.sidebar-collapsed #openAthletes::after { content: "選手登録・写真"; }
body.sidebar-collapsed #openGroups::after { content: "グループ管理"; }
body.sidebar-collapsed #openCsv::after { content: "CSV保存"; }
body.sidebar-collapsed #navHome:hover::after,
body.sidebar-collapsed #openAthletes:hover::after,
body.sidebar-collapsed #openGroups:hover::after,
body.sidebar-collapsed #openCsv:hover::after {
  display: block;
}

@media (max-width:760px) {
  .sidebar-toggle {
    display: none;
  }
  body.sidebar-collapsed .app-shell.sidebar-layout {
    display: block;
  }
  body.sidebar-collapsed .sidebar-label {
    display: inline;
  }
  body.sidebar-collapsed .sidebar-item {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
  }
}


/* ================================================================
   Session history (v19)
   ================================================================ */
.history-page-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.history-toolbar {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 14px;
  align-items: end;
  padding: 16px;
}
.history-count-card {
  display: grid;
  gap: 4px;
  min-width: 145px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255,255,255,.035);
  padding: 11px 14px;
}
.history-count-card span {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 750;
}
.history-count-card strong {
  font-size: 1.25rem;
}
.history-list {
  display: grid;
  gap: 10px;
}
.history-session-card {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
}
.history-session-main {
  display: grid;
  grid-template-columns: auto minmax(180px,1fr) auto auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 7px;
  text-align: left;
  cursor: pointer;
}
.history-session-main strong {
  overflow: hidden;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-mode-badge {
  border-radius: 999px;
  padding: 6px 8px;
  font-size: .66rem;
  font-weight: 900;
}
.history-mode-badge.ast {
  background: rgba(255,176,32,.12);
  color: #ffd078;
}
.history-mode-badge.normal {
  background: rgba(79,155,255,.13);
  color: #8bb9ff;
}
.history-session-date,
.history-session-stats {
  color: var(--muted);
  font-size: .77rem;
  white-space: nowrap;
}
.history-session-actions {
  display: flex;
  gap: 6px;
}
.history-empty {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 42px 20px;
  color: var(--muted);
  text-align: center;
}
.history-empty p {
  margin: 0;
}
.history-empty.history-flash {
  padding: 18px;
}
.history-empty.history-flash.is-success {
  color: #68e8a3;
}
.history-editor-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.history-editor-actions {
  display: flex;
  gap: 8px;
}
.history-editor-header {
  display: grid;
  grid-template-columns: minmax(220px,1fr) minmax(260px,1.5fr) auto;
  gap: 14px;
  align-items: end;
  padding: 16px;
}
.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  min-height: 51px;
}
.history-meta span {
  border-radius: 999px;
  background: rgba(255,255,255,.05);
  color: var(--muted);
  padding: 7px 10px;
  font-size: .76rem;
  font-weight: 750;
}
.history-editor-status {
  min-height: 38px;
  margin: 0;
  border-radius: 11px;
  color: var(--muted);
  padding: 8px 11px;
}
.history-editor-status.is-success {
  background: rgba(37,192,109,.1);
  color: #68e8a3;
}
.history-editor-status.is-warning {
  background: rgba(255,176,32,.1);
  color: #ffd078;
}
.history-record-panel {
  display: grid;
  gap: 13px;
  padding: 16px;
}
.history-table-scroll {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
}
.history-record-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  background: #081426;
}
.history-record-table th,
.history-record-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  font-size: .79rem;
  text-align: left;
  white-space: nowrap;
}
.history-record-table th {
  position: sticky;
  top: 0;
  background: #132038;
  color: #b9c7da;
  font-weight: 850;
  z-index: 2;
}
.history-record-table tr:last-child td {
  border-bottom: 0;
}
.history-record-table input {
  width: 100%;
  min-width: 88px;
  min-height: 39px;
  border-radius: 9px;
  padding: 7px 8px;
  font-size: .8rem;
}
.history-record-table input[type="text"] {
  min-width: 145px;
}
.history-row-delete {
  min-height: 36px;
  border: 1px solid rgba(255,92,87,.3);
  border-radius: 9px;
  background: rgba(255,92,87,.08);
  color: #ff9a96;
  padding: 0 10px;
  font-weight: 800;
}
.history-no-records {
  padding: 28px !important;
  color: var(--muted);
  text-align: center !important;
}

/* Fifth item in the mobile navigation. */
@media (max-width:760px) {
  .sidebar-nav {
    grid-template-columns: repeat(5,minmax(0,1fr));
  }
  .sidebar-item {
    font-size: .58rem;
  }
  .history-page-intro,
  .history-editor-top {
    align-items: stretch;
    flex-direction: column;
  }
  .history-toolbar,
  .history-editor-header {
    grid-template-columns: 1fr;
  }
  .history-editor-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .history-session-main {
    grid-template-columns: auto minmax(0,1fr);
  }
  .history-session-date,
  .history-session-stats {
    grid-column: 2;
  }
  .history-session-card {
    grid-template-columns: 1fr;
  }
  .history-session-actions .small-button {
    flex: 1;
  }
}

/* Collapsed sidebar tooltip for History. */
body.sidebar-collapsed #openHistory::after {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  display: none;
  width: max-content;
  transform: translateY(-50%);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #101d31;
  color: #fff;
  padding: 7px 9px;
  font-size: .75rem;
  font-weight: 750;
  box-shadow: 0 8px 25px rgba(0,0,0,.35);
  content: "履歴";
  z-index: 60;
}
body.sidebar-collapsed #openHistory:hover::after {
  display: block;
}


/* ================================================================
   Japanese / English language selector (v21)
   ================================================================ */
.sidebar-language {
  display: grid;
  grid-template-columns: 34px minmax(0,1fr);
  gap: 9px;
  align-items: center;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding: 14px 10px 0;
}
.sidebar-language-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(255,255,255,.055);
  color: #90bbff;
  font-size: .9rem;
  font-weight: 900;
}
.sidebar-language-control {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.sidebar-language-label {
  color: var(--muted);
  font-size: .7rem;
  font-weight: 800;
}
.sidebar-language select {
  width: 100%;
  min-height: 38px;
  border-radius: 10px;
  padding: 6px 8px;
  font-size: .78rem;
  font-weight: 800;
}
body.sidebar-collapsed .sidebar-language {
  grid-template-columns: 1fr;
  justify-items: center;
  padding-inline: 0;
}
body.sidebar-collapsed .sidebar-language-icon,
body.sidebar-collapsed .sidebar-language-label {
  display: none;
}
body.sidebar-collapsed .sidebar-language-control {
  width: 58px;
}
body.sidebar-collapsed .sidebar-language select {
  padding-inline: 3px;
  font-size: .66rem;
  text-align: center;
}
#normalView > .timer-grid {
  margin-top: 15px;
}

@media (max-width:760px) {
  .sidebar-language {
    grid-template-columns: auto minmax(0,1fr);
    margin-top: 7px;
    padding: 7px 5px 0;
  }
  .sidebar-language-icon {
    width: 29px;
    height: 29px;
  }
  .sidebar-language-control {
    grid-template-columns: auto minmax(0,1fr);
    align-items: center;
    gap: 8px;
  }
  .sidebar-language select {
    min-height: 34px;
  }
  body.sidebar-collapsed .sidebar-language {
    grid-template-columns: auto minmax(0,1fr);
  }
  body.sidebar-collapsed .sidebar-language-icon,
  body.sidebar-collapsed .sidebar-language-label {
    display: grid;
  }
  body.sidebar-collapsed .sidebar-language-control {
    width: 100%;
  }
}


/* ================================================================
   Offline-first multi-iPad sync (v22)
   ================================================================ */
.sync-header-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.035);
  color: var(--muted);
  padding: 7px 11px;
  font-size: .73rem;
  font-weight: 850;
  cursor: pointer;
}
.sync-header-dot,
.sync-network-dot {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #77859a;
}
.sync-header-button.is-connected .sync-header-dot,
.sync-network-dot.is-online {
  background: #43df8d;
  box-shadow: 0 0 0 4px rgba(67,223,141,.1);
}
.sync-header-button.is-pending .sync-header-dot,
.sync-header-button.is-syncing .sync-header-dot {
  background: #ffb020;
}
.sync-header-button.is-error .sync-header-dot {
  background: #ff625d;
}
.sync-page-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.sync-state-badge,
.sync-config-badge {
  border-radius: 999px;
  background: rgba(255,255,255,.055);
  color: var(--muted);
  padding: 8px 12px;
  font-size: .75rem;
  font-weight: 900;
}
.sync-state-badge.is-connected,
.sync-config-badge.is-ready {
  background: rgba(67,223,141,.12);
  color: #68e8a3;
}
.sync-state-badge.is-pending,
.sync-state-badge.is-syncing {
  background: rgba(255,176,32,.12);
  color: #ffd078;
}
.sync-state-badge.is-error {
  background: rgba(255,98,93,.12);
  color: #ff9a96;
}
.sync-status-panel {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 17px;
}
.sync-status-main {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sync-status-main .sync-network-dot {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
}
.sync-status-main p {
  margin: 5px 0 0;
  color: var(--muted);
}
.sync-status-stats {
  display: grid;
  grid-template-columns: repeat(3,minmax(105px,auto));
  gap: 9px;
}
.sync-status-stats > div,
.sync-session-grid > div {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.028);
  padding: 9px 11px;
}
.sync-status-stats span,
.sync-session-grid span,
.sync-code-card span {
  color: var(--muted);
  font-size: .7rem;
  font-weight: 750;
}
.sync-config-panel,
.sync-connected-panel {
  display: grid;
  gap: 14px;
  padding: 17px;
}
.sync-config-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 11px;
}
.sync-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sync-message {
  min-height: 38px;
  margin: 0;
  border-radius: 11px;
  color: var(--muted);
  padding: 8px 10px;
}
.sync-message.is-success {
  background: rgba(67,223,141,.1);
  color: #68e8a3;
}
.sync-message.is-warning {
  background: rgba(255,176,32,.1);
  color: #ffd078;
}
.sync-message.is-error {
  background: rgba(255,98,93,.1);
  color: #ff9a96;
}
.sync-join-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 13px;
}
.sync-action-card {
  display: grid;
  gap: 13px;
  align-content: start;
  padding: 18px;
}
.sync-action-card h3,
.sync-action-card p {
  margin: 0;
}
.sync-action-card > p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.5;
}
.sync-code-input {
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: 1.35rem;
  font-weight: 950;
  text-align: center;
}
.sync-connected-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.sync-connected-heading h3 {
  margin: 0;
}
.sync-connected-heading p {
  margin: 6px 0 0;
  color: var(--muted);
}
.sync-code-card {
  display: grid;
  grid-template-columns: auto auto;
  gap: 5px 10px;
  align-items: center;
  border: 1px solid rgba(79,155,255,.28);
  border-radius: 13px;
  background: rgba(79,155,255,.07);
  padding: 10px 12px;
}
.sync-code-card span {
  grid-column: 1 / -1;
}
.sync-code-card strong {
  font-size: 1.45rem;
  letter-spacing: .16em;
}
.sync-session-grid {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 9px;
}
.sync-members-panel {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.sync-members-panel h4 {
  margin: 0;
}
.sync-member-list {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 8px;
}
.sync-member-item {
  display: grid;
  grid-template-columns: 11px minmax(0,1fr);
  gap: 9px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
  padding: 10px;
}
.sync-member-indicator {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #75839a;
}
.sync-member-item.is-online .sync-member-indicator {
  background: #43df8d;
}
.sync-member-item strong,
.sync-member-item span {
  display: block;
}
.sync-member-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: .72rem;
}
.history-shared-badge {
  border-radius: 999px;
  background: rgba(67,223,141,.12);
  color: #68e8a3;
  padding: 5px 7px;
  font-size: .61rem;
  font-weight: 950;
}
.history-session-main {
  grid-template-columns: auto auto minmax(180px,1fr) auto auto;
}

@media (max-width:1050px) {
  .sync-config-grid,
  .sync-session-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
  .sync-status-panel {
    grid-template-columns: 1fr;
  }
}
@media (max-width:760px) {
  .sidebar-nav {
    grid-template-columns: repeat(6,minmax(0,1fr));
  }
  .sync-header-button {
    display: none;
  }
  .sync-page-intro,
  .sync-connected-heading {
    align-items: stretch;
    flex-direction: column;
  }
  .sync-status-stats,
  .sync-config-grid,
  .sync-join-grid,
  .sync-session-grid,
  .sync-member-list {
    grid-template-columns: 1fr;
  }
  .history-session-main {
    grid-template-columns: auto auto minmax(0,1fr);
  }
  .history-session-date,
  .history-session-stats {
    grid-column: 3;
  }
}

/* Collapsed sidebar tooltip for Sync. */
body.sidebar-collapsed #openSync::after {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  display: none;
  width: max-content;
  transform: translateY(-50%);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #101d31;
  color: #fff;
  padding: 7px 9px;
  font-size: .75rem;
  font-weight: 750;
  box-shadow: 0 8px 25px rgba(0,0,0,.35);
  content: "Sync";
  z-index: 60;
}
body.sidebar-collapsed #openSync:hover::after {
  display: block;
}


/* ================================================================
   Mobile connection diagnostics (v24)
   ================================================================ */
.sync-mobile-note {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(79,155,255,.22);
  border-radius: 12px;
  background: rgba(79,155,255,.065);
  padding: 11px 12px;
}
.sync-mobile-note strong {
  color: #9ec5ff;
  font-size: .8rem;
}
.sync-mobile-note p {
  margin: 0;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.5;
}
.sync-diagnostic-panel {
  display: grid;
  gap: 11px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.sync-diagnostic-panel h4 {
  margin: 0;
}
.sync-diagnostic-list {
  display: grid;
  gap: 7px;
}
.sync-diagnostic-placeholder {
  margin: 0;
  color: var(--muted);
}
.sync-diagnostic-item {
  display: grid;
  grid-template-columns: 28px minmax(0,1fr);
  gap: 9px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255,255,255,.025);
  padding: 9px 10px;
}
.sync-diagnostic-symbol {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  font-weight: 950;
}
.sync-diagnostic-item strong {
  font-size: .8rem;
}
.sync-diagnostic-item p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: .74rem;
  line-height: 1.45;
}
.sync-diagnostic-item.is-pass {
  border-color: rgba(67,223,141,.2);
}
.sync-diagnostic-item.is-pass .sync-diagnostic-symbol {
  background: rgba(67,223,141,.12);
  color: #68e8a3;
}
.sync-diagnostic-item.is-warn {
  border-color: rgba(255,176,32,.22);
}
.sync-diagnostic-item.is-warn .sync-diagnostic-symbol {
  background: rgba(255,176,32,.12);
  color: #ffd078;
}
.sync-diagnostic-item.is-fail {
  border-color: rgba(255,98,93,.22);
}
.sync-diagnostic-item.is-fail .sync-diagnostic-symbol {
  background: rgba(255,98,93,.12);
  color: #ff9a96;
}


/* ================================================================
   Fixed AST measurement viewport (v25)
   ================================================================ */
html.ast-viewport-locked {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body.ast-focus-mode {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden !important;
  overscroll-behavior: none;
  touch-action: manipulation;
}

/* Keep the complete app inside the visible viewport. */
body.ast-focus-mode .app-shell.sidebar-layout {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

body.ast-focus-mode .app-sidebar {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

body.ast-focus-mode .app-main {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  padding:
    max(7px, env(safe-area-inset-top))
    max(8px, env(safe-area-inset-right))
    max(7px, env(safe-area-inset-bottom))
    max(8px, env(safe-area-inset-left));
}

/* The normal page heading is unnecessary while timing. */
body.ast-focus-mode .app-header {
  display: none !important;
}

body.ast-focus-mode .page-container,
body.ast-focus-mode #homePage,
body.ast-focus-mode #astView,
body.ast-focus-mode #astRunScreen {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

body.ast-focus-mode #astRunScreen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
}

body.ast-focus-mode .ast-dashboard-focus {
  position: relative;
  top: auto;
  z-index: 20;
  margin: 0;
  padding: 9px 11px;
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(0,0,0,.32);
}

body.ast-focus-mode .ast-dashboard-focus .ast-master-time-wrap strong {
  font-size: clamp(2.7rem, 4.3vw, 4.4rem);
}

body.ast-focus-mode .ast-dashboard-focus .ast-current-block strong {
  font-size: clamp(1.25rem, 2.1vw, 1.8rem);
}

body.ast-focus-mode .ast-dashboard-focus .ast-next-block strong {
  font-size: clamp(1.7rem, 2.8vw, 2.7rem);
}

body.ast-focus-mode .ast-runtime-summary strong {
  font-size: 1.05rem;
}

body.ast-focus-mode .ast-runtime-controls {
  width: 245px;
}

body.ast-focus-mode .ast-runtime-controls .button {
  min-height: 42px;
  padding-block: 6px;
  font-size: .84rem;
}

body.ast-focus-mode #astRunGridHost {
  min-height: 0;
  margin-top: 0 !important;
  overflow: hidden;
}

body.ast-focus-mode .ast-grid {
  height: 100%;
  min-height: 0;
  margin-top: 0 !important;
  align-content: stretch;
  grid-auto-rows: minmax(0, 1fr);
}

body.ast-focus-mode .ast-athlete-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border-radius: 15px;
}

body.ast-focus-mode .ast-athlete-card .card-topline {
  flex: 0 0 auto;
  padding: 7px 9px 3px;
}

body.ast-focus-mode .ast-athlete-identity {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 48px minmax(0,1fr);
  align-items: center;
  justify-items: stretch;
  gap: 7px;
  padding: 4px 8px;
}

body.ast-focus-mode .ast-athlete-photo {
  width: 48px;
  height: 48px;
}

body.ast-focus-mode .ast-athlete-name-display {
  display: block;
  margin: 0;
  padding: 8px 7px;
  font-size: .8rem;
}

body.ast-focus-mode .ast-block-time {
  flex: 0 0 auto;
  gap: 2px;
  padding: 4px 8px 3px;
}

body.ast-focus-mode .ast-block-time strong {
  font-size: clamp(1.8rem, 3.1vw, 2.8rem);
}

body.ast-focus-mode .ast-finish-button {
  flex: 0 0 auto;
  width: calc(100% - 14px);
  min-height: 45px;
  margin: 0 7px 5px;
  padding: 5px;
  font-size: .82rem;
}

body.ast-focus-mode .ast-undo-button {
  flex: 0 0 auto;
  width: calc(100% - 14px);
  min-height: 27px;
  margin: 0 7px 5px;
  padding: 3px 5px;
  font-size: .62rem;
}

body.ast-focus-mode .ast-history-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

body.ast-focus-mode .ast-history-heading {
  flex: 0 0 auto;
  padding: 5px 7px 3px;
  font-size: .6rem;
}

body.ast-focus-mode .ast-history-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 6px 5px;
  scrollbar-width: none;
}

body.ast-focus-mode .ast-history-list::-webkit-scrollbar {
  display: none;
}

body.ast-focus-mode .ast-history-row {
  padding: 4px 0;
}

/* iPad landscape: the entire timing view stays fixed, including the 5 x 2 grid. */
@media (orientation: landscape) and (min-width: 900px) {
  body.ast-focus-mode #astRunGridHost,
  body.ast-focus-mode .ast-grid {
    overflow: hidden;
  }

  body.ast-focus-mode .ast-grid {
    grid-template-columns: repeat(5, minmax(0,1fr));
    gap: 7px;
  }
}

/* Portrait tablets and phones keep the page fixed; only the card area can move. */
@media (orientation: portrait), (max-width: 899px) {
  body.ast-focus-mode .app-shell.sidebar-layout {
    display: flex;
    flex-direction: column;
  }

  body.ast-focus-mode .app-sidebar {
    position: relative;
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  body.ast-focus-mode .app-main {
    flex: 1 1 auto;
    height: auto;
  }

  body.ast-focus-mode #astRunGridHost {
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  body.ast-focus-mode .ast-grid {
    height: auto;
    grid-auto-rows: auto;
  }

  body.ast-focus-mode .ast-athlete-card {
    height: auto;
    min-height: 285px;
  }
}


/* ================================================================
   Home → AST Setup → AST Stopwatch flow (v26)
   ================================================================ */
.home-template-panel {
  grid-template-columns: minmax(190px,.8fr) minmax(220px,1fr) minmax(250px,1.3fr);
}

.individual-normal-section {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.individual-normal-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 17px;
}

.individual-normal-heading h2,
.individual-normal-heading p {
  margin-bottom: 0;
}

.individual-normal-heading > div > p:not(.eyebrow) {
  margin-top: 6px;
  color: var(--muted);
}

.individual-count-field {
  min-width: 135px;
}

#individualNormalSection .timer-grid {
  margin-top: 0;
}

.ast-setup-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 13px;
  padding: 17px 18px;
  border-color: rgba(255,176,32,.25);
  background:
    linear-gradient(135deg,rgba(255,176,32,.08),rgba(255,255,255,.025));
}

.ast-setup-intro h2 {
  margin: 0;
}

.ast-setup-intro p:not(.eyebrow) {
  margin: 6px 0 0;
  color: var(--muted);
}

body.ast-setup-flow #homePage {
  max-width: 100%;
}

body.ast-setup-flow #topPanel,
body.ast-setup-flow #normalView {
  display: none !important;
}

body.ast-setup-flow #astView {
  display: block;
}

@media (max-width:900px) {
  .home-template-panel {
    grid-template-columns: 1fr;
  }

  .individual-normal-heading,
  .ast-setup-intro {
    align-items: stretch;
    flex-direction: column;
  }

  .individual-count-field {
    width: 100%;
  }
}


/* ================================================================
   iPad startup recovery (v27)
   ================================================================ */
.boot-recovery[hidden] {
  display: none !important;
}
.boot-recovery {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #071222;
  padding: 24px;
  z-index: 10000;
}
.boot-recovery-card {
  display: grid;
  gap: 14px;
  width: min(560px,100%);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  background: #101d31;
  color: #fff;
  padding: 24px;
  box-shadow: 0 24px 70px rgba(0,0,0,.45);
}
.boot-recovery-card h1,
.boot-recovery-card p {
  margin: 0;
}
.boot-recovery-card > p:not(.eyebrow) {
  color: #b9c7da;
  line-height: 1.6;
}
.boot-recovery-help {
  font-size: .78rem;
}


/* ================================================================
   Automatic multi-device cloud history (v28)
   ================================================================ */
.sync-cloud-stats {
  grid-template-columns: repeat(4,minmax(105px,auto));
}

.sync-auto-panel,
.sync-devices-panel {
  display: grid;
  gap: 15px;
  padding: 18px;
}

.sync-auto-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.sync-auto-heading h3,
.sync-auto-heading p {
  margin-bottom: 0;
}

.sync-auto-heading > div > p:not(.eyebrow) {
  margin-top: 6px;
  max-width: 720px;
  color: var(--muted);
  line-height: 1.55;
}

.sync-flow-grid {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 9px;
}

.sync-flow-grid > div {
  display: grid;
  grid-template-columns: 34px minmax(0,1fr);
  gap: 9px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255,255,255,.028);
  padding: 11px;
}

.sync-flow-grid strong {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(79,155,255,.12);
  color: #9ec5ff;
}

.sync-flow-grid span {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 750;
  line-height: 1.4;
}

@media (max-width:1050px) {
  .sync-cloud-stats,
  .sync-flow-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
}

@media (max-width:760px) {
  .sync-auto-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .sync-cloud-stats,
  .sync-flow-grid {
    grid-template-columns: 1fr;
  }
}


/* ================================================================
   Variable AST sets and top-packed block records (v29)
   ================================================================ */
.ast-set-config-layout {
  display: grid;
  grid-template-columns: minmax(150px,.45fr) minmax(350px,1.5fr) minmax(190px,.5fr) minmax(220px,.55fr);
  align-items: center;
  gap: 16px;
}

.ast-set-count-field {
  align-self: stretch;
}

.ast-set-count-field select {
  min-height: 54px;
  font-size: 1rem;
  font-weight: 850;
}

.ast-set-start-panel {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.ast-set-start-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.ast-set-start-heading > span {
  font-size: .78rem;
  font-weight: 850;
}

.ast-set-start-heading > small {
  color: var(--muted);
  font-weight: 750;
}

.ast-set-start-list {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 8px;
}

.ast-set-start-row {
  display: grid;
  grid-template-columns: 56px minmax(0,1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
  padding: 8px 9px;
}

.ast-set-start-row.is-warning {
  border-color: rgba(255,176,32,.5);
  background: rgba(255,176,32,.065);
}

.ast-set-start-row > strong {
  white-space: nowrap;
  font-size: .8rem;
}

.ast-set-fixed-time {
  font-size: 1.15rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.ast-set-start-row > small {
  grid-column: 2;
  color: var(--muted);
  font-size: .68rem;
}

.ast-set-time-inputs {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 6px;
}

.ast-set-time-inputs label {
  min-width: 0;
}

.ast-set-time-inputs input {
  width: 100%;
  min-width: 0;
}

/* Keep completed Block records tightly packed from the top. */
.ast-history-list,
body.ast-focus-mode .ast-history-list {
  align-content: start;
  grid-auto-rows: max-content;
}

.ast-history-row {
  min-height: 0;
}

@media (max-width:1100px) {
  .ast-set-config-layout {
    grid-template-columns: minmax(150px,.45fr) minmax(320px,1.4fr);
  }

  .ast-set-config-layout .sound-toggle,
  .ast-set-config-layout .ast-setup-start {
    min-height: 58px;
  }
}

@media (max-width:760px) {
  .ast-set-config-layout,
  .ast-set-start-list {
    grid-template-columns: 1fr;
  }
}


/* ================================================================
   AST athlete portrait and timing states (v30)
   ================================================================ */

/* Name above, face photo centered below it. */
.ast-mode-running .ast-athlete-identity,
body.ast-focus-mode .ast-athlete-identity {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  padding: 5px 8px 6px;
  text-align: center;
}

.ast-mode-running .ast-athlete-name-display,
body.ast-focus-mode .ast-athlete-name-display {
  order: 1;
  display: block;
  width: calc(100% - 4px);
  max-width: 100%;
  margin: 0;
  padding: 6px 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: clamp(.78rem,1.15vw,.98rem);
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ast-mode-running .ast-athlete-photo,
body.ast-focus-mode .ast-athlete-photo {
  order: 2;
  width: clamp(54px,5.4vw,76px);
  height: clamp(54px,5.4vw,76px);
  margin: 0 auto;
  border-width: 2px;
  box-shadow: 0 5px 18px rgba(0,0,0,.28);
}

/* Athlete is currently timing this Block. */
.ast-athlete-card.is-active {
  border: 2px solid #38d77b !important;
  background:
    linear-gradient(160deg,rgba(20,55,45,.98),rgba(9,29,29,.98));
  box-shadow:
    0 0 0 2px rgba(56,215,123,.15),
    0 12px 34px rgba(0,0,0,.28),
    0 0 26px rgba(56,215,123,.18);
}

.ast-athlete-card.is-active .ast-athlete-photo {
  border-color: #38d77b;
  box-shadow:
    0 0 0 3px rgba(56,215,123,.16),
    0 6px 20px rgba(0,0,0,.32);
}

.ast-athlete-card.is-active .ast-athlete-name-display,
.ast-athlete-card.is-active .ast-block-time strong {
  color: #8af0b5;
}

/* Finished current Block and waiting for the next scheduled Block. */
.ast-athlete-card.is-next-waiting {
  opacity: .48;
  border-color: rgba(145,164,190,.22);
  filter: saturate(.55);
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  transition:
    opacity .18s ease,
    filter .18s ease,
    border-color .18s ease,
    box-shadow .18s ease;
}

.ast-athlete-card.is-next-waiting .ast-athlete-photo {
  border-color: rgba(145,164,190,.35);
  box-shadow: none;
}

.ast-athlete-card.is-next-waiting .ast-card-status {
  background: rgba(145,164,190,.1);
  color: rgba(220,228,240,.72);
}

/* Active and complete states always override faded waiting visuals. */
.ast-athlete-card.is-active,
.ast-athlete-card.is-complete {
  opacity: 1;
  filter: none;
}

/* Preserve enough room for the portrait in the fixed iPad layout. */
body.ast-focus-mode .ast-athlete-card .card-topline {
  padding-bottom: 1px;
}

body.ast-focus-mode .ast-block-time {
  padding-top: 2px;
}

@media (orientation: landscape) and (min-width: 900px) {
  body.ast-focus-mode .ast-athlete-name-display {
    font-size: clamp(.7rem,1vw,.88rem);
    padding-block: 3px;
  }

  body.ast-focus-mode .ast-athlete-photo {
    width: clamp(50px,4.8vw,68px);
    height: clamp(50px,4.8vw,68px);
  }
}

@media (max-width: 760px) {
  .ast-mode-running .ast-athlete-photo,
  body.ast-focus-mode .ast-athlete-photo {
    width: 78px;
    height: 78px;
  }
}


/* ================================================================
   Cloud upload after session finish (v31)
   ================================================================ */
.history-shared-badge.is-pending {
  border-color: rgba(255,176,32,.28);
  background: rgba(255,176,32,.1);
  color: #ffd078;
}

@media (max-width:760px) {
  .sidebar-nav {
    grid-template-columns: repeat(5,minmax(0,1fr));
  }
}


/* ================================================================
   Visible cloud upload status and aggregated history location (v32)
   ================================================================ */
.history-cloud-location {
  display: grid;
  grid-template-columns: 48px minmax(0,1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
  padding: 15px 17px;
  border-color: rgba(79,155,255,.22);
  background: linear-gradient(135deg,rgba(79,155,255,.08),rgba(255,255,255,.025));
}
.history-cloud-location-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(79,155,255,.14);
  color: #9ec5ff;
  font-size: 1.4rem;
}
.history-cloud-location h3,
.history-cloud-location p { margin-bottom: 0; }
.history-cloud-location p:not(.eyebrow) {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.5;
}
.history-cloud-connection {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: .68rem;
  font-weight: 900;
  white-space: nowrap;
}
.history-cloud-connection.is-connected {
  border-color: rgba(67,223,141,.3);
  background: rgba(67,223,141,.1);
  color: #68e8a3;
}
.history-cloud-connection.is-offline {
  border-color: rgba(255,176,32,.3);
  background: rgba(255,176,32,.1);
  color: #ffd078;
}
.history-cloud-connection.is-local {
  border-color: rgba(145,164,190,.28);
  background: rgba(145,164,190,.1);
  color: #c5d0e0;
}
.history-cloud-connection.is-checking {
  border-color: rgba(79,155,255,.3);
  background: rgba(79,155,255,.1);
  color: #9ec5ff;
}
.history-upload-summary {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 10px;
  margin-bottom: 8px;
}
.history-upload-stat {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 13px 14px;
}
.history-upload-stat span {
  color: var(--muted);
  font-size: .7rem;
  font-weight: 850;
}
.history-upload-stat strong { font-size: 1.45rem; }
.history-upload-stat small {
  overflow: hidden;
  color: var(--muted);
  font-size: .65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-upload-stat.is-uploaded { border-color: rgba(67,223,141,.23); }
.history-upload-stat.is-pending { border-color: rgba(255,176,32,.25); }
.history-upload-stat.is-local { border-color: rgba(145,164,190,.22); }
.history-cloud-last-checked {
  margin: 0 2px 12px;
  color: var(--muted);
  font-size: .7rem;
  text-align: right;
}
.history-toolbar-search-only { grid-template-columns: minmax(0,1fr); }
.history-session-card.is-uploaded { border-color: rgba(67,223,141,.18); }
.history-session-card.is-pending { border-color: rgba(255,176,32,.22); }
.history-session-card.is-local { border-color: rgba(145,164,190,.18); }
.history-session-main {
  grid-template-columns: auto auto minmax(180px,1fr) auto auto;
}
.history-upload-badge {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 5px 7px;
  font-size: .6rem;
  font-weight: 950;
  white-space: nowrap;
}
.history-upload-badge.is-uploaded {
  border-color: rgba(67,223,141,.24);
  background: rgba(67,223,141,.11);
  color: #68e8a3;
}
.history-upload-badge.is-pending {
  border-color: rgba(255,176,32,.28);
  background: rgba(255,176,32,.1);
  color: #ffd078;
}
.history-upload-badge.is-local {
  border-color: rgba(145,164,190,.24);
  background: rgba(145,164,190,.09);
  color: #c5d0e0;
}
.history-upload-detail {
  grid-column: 3 / -1;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
}
.history-upload-detail.is-uploaded { color: rgba(104,232,163,.8); }
.history-upload-detail.is-pending { color: rgba(255,208,120,.85); }
.history-editor-cloud-state {
  border-radius: 999px;
  padding: 4px 7px;
  font-weight: 850;
}
.history-editor-cloud-state.is-uploaded {
  background: rgba(67,223,141,.1);
  color: #68e8a3;
}
.history-editor-cloud-state.is-pending {
  background: rgba(255,176,32,.1);
  color: #ffd078;
}
.history-editor-cloud-state.is-local {
  background: rgba(145,164,190,.1);
  color: #c5d0e0;
}
@media (max-width:1050px) {
  .history-upload-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width:760px) {
  .history-cloud-location { grid-template-columns: 42px minmax(0,1fr); }
  .history-cloud-connection {
    grid-column: 1 / -1;
    justify-self: start;
  }
  .history-upload-summary { grid-template-columns: 1fr 1fr; }
  .history-session-main { grid-template-columns: auto auto minmax(0,1fr); }
  .history-session-date,
  .history-session-stats,
  .history-upload-detail { grid-column: 3; }
}


/* ================================================================
   BlueRevs branding, requested sidebar order and Settings (v33)
   ================================================================ */
.sidebar-logo-button {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 0;
  border-radius: 15px;
  background: #fff;
  padding: 3px;
  box-shadow: 0 9px 24px rgba(0,0,0,.28);
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease;
}
.sidebar-logo-button:active {
  transform: scale(.95);
}
.sidebar-logo-button:focus-visible {
  outline: 3px solid rgba(79,155,255,.65);
  outline-offset: 3px;
}
.sidebar-logo-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.sidebar-brand-copy p {
  color: #75b5e5;
  font-size: .55rem;
  letter-spacing: .08em;
}
body.sidebar-collapsed .sidebar-logo-button {
  width: 52px;
  height: 52px;
}
body.sidebar-collapsed #openSettings::after {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  display: none;
  width: max-content;
  max-width: 180px;
  transform: translateY(-50%);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #101d31;
  color: #fff;
  padding: 7px 9px;
  font-size: .75rem;
  font-weight: 750;
  box-shadow: 0 8px 25px rgba(0,0,0,.35);
  content: "設定";
  z-index: 60;
}
body.sidebar-collapsed #openSettings:hover::after {
  display: block;
}

/* Settings page */
.settings-page-intro {
  align-items: center;
}
.settings-cloud-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 11px;
  font-size: .7rem;
  font-weight: 900;
  white-space: nowrap;
}
.settings-cloud-badge.is-connected {
  border-color: rgba(67,223,141,.3);
  background: rgba(67,223,141,.1);
  color: #68e8a3;
}
.settings-cloud-badge.is-offline {
  border-color: rgba(255,176,32,.3);
  background: rgba(255,176,32,.1);
  color: #ffd078;
}
.settings-cloud-badge.is-local {
  border-color: rgba(145,164,190,.28);
  background: rgba(145,164,190,.1);
  color: #c5d0e0;
}
.settings-cloud-badge.is-checking {
  border-color: rgba(79,155,255,.3);
  background: rgba(79,155,255,.1);
  color: #9ec5ff;
}
.settings-cloud-panel {
  display: grid;
  gap: 16px;
  padding: 19px;
}
.settings-device-id {
  color: var(--muted);
  font-size: .68rem;
  font-weight: 750;
}
.settings-cloud-description {
  margin: 0;
  max-width: 850px;
  color: var(--muted);
  line-height: 1.6;
}
.settings-form-grid {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(180px,.42fr);
  gap: 12px;
}
.settings-wide-field {
  grid-column: 1 / -1;
}
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.settings-actions .button {
  min-width: 180px;
}
.settings-message {
  min-height: 44px;
  margin: 0;
  border-radius: 12px;
  color: var(--muted);
  padding: 11px 12px;
}
.settings-message.is-success {
  background: rgba(67,223,141,.1);
  color: #68e8a3;
}
.settings-message.is-warning {
  background: rgba(255,176,32,.1);
  color: #ffd078;
}
.settings-message.is-error {
  background: rgba(255,92,110,.1);
  color: #ff9ba8;
}
.settings-status-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 11px;
  margin-top: 12px;
}
.settings-status-card {
  display: grid;
  gap: 5px;
  padding: 16px;
}
.settings-status-card > span,
.settings-status-card > small {
  color: var(--muted);
  font-size: .7rem;
  font-weight: 750;
}
.settings-status-card > strong {
  overflow: hidden;
  font-size: 1.15rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settings-history-panel {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 18px;
  align-items: center;
  margin-top: 12px;
  padding: 19px;
  border-color: rgba(79,155,255,.22);
  background: linear-gradient(135deg,rgba(79,155,255,.08),rgba(255,255,255,.025));
}
.settings-history-panel h3,
.settings-history-panel p {
  margin-bottom: 0;
}
.settings-history-panel p:not(.eyebrow) {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.55;
}
.settings-history-button {
  min-width: 190px;
}

@media (max-width:760px) {
  .sidebar-nav {
    grid-template-columns: repeat(5,minmax(0,1fr));
  }
  .settings-form-grid,
  .settings-status-grid,
  .settings-history-panel {
    grid-template-columns: 1fr;
  }
  .settings-history-button,
  .settings-actions .button {
    width: 100%;
    min-width: 0;
  }
}


/* ================================================================
   One shared cloud configured once in the deployed app (v34)
   ================================================================ */
.settings-form-grid {
  grid-template-columns: minmax(0,1fr) minmax(220px,.42fr);
  align-items: stretch;
}

.settings-central-cloud-info {
  display: grid;
  grid-template-columns: 44px minmax(0,1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  border: 1px solid rgba(79,155,255,.22);
  border-radius: 14px;
  background: rgba(79,155,255,.07);
  padding: 13px 14px;
}

.settings-central-cloud-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(79,155,255,.14);
  color: #9ec5ff;
  font-size: 1.25rem;
}

.settings-central-cloud-info strong {
  display: block;
  margin-bottom: 4px;
}

.settings-central-cloud-info p {
  margin: 0;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.5;
}

.settings-device-name-field {
  align-self: stretch;
}

.settings-device-name-field input {
  min-height: 54px;
}

@media (max-width:900px) {
  .settings-form-grid {
    grid-template-columns: 1fr;
  }
}


/* ================================================================
   Automatic session names and direct History navigation (v35)
   ================================================================ */
@media (max-width:760px) {
  .sidebar-nav {
    grid-template-columns: repeat(3,minmax(0,1fr));
  }
}

.history-session-actions {
  flex-wrap: wrap;
}

.history-editor-header label .field-note {
  color: var(--muted);
  font-size: .68rem;
}


/* ================================================================
   Per-Block review alerts (v36)
   ================================================================ */
.ast-review-button {
  width: calc(100% - 24px);
  min-height: 38px;
  margin: 0 12px 8px;
  border: 1px solid rgba(255,214,74,.7);
  background: linear-gradient(180deg,#ffd95a,#e5ad19);
  color: #2c2100;
  font-size: .78rem;
  font-weight: 950;
  box-shadow: 0 5px 14px rgba(229,173,25,.18);
}

.ast-review-button.is-flagged {
  border-color: #fff0a1;
  background: linear-gradient(180deg,#ffca2c,#c98f00);
  color: #211700;
  box-shadow:
    0 0 0 2px rgba(255,214,74,.18),
    0 6px 18px rgba(229,173,25,.27);
}

.ast-review-button:disabled {
  border-color: rgba(145,164,190,.2);
  background: rgba(145,164,190,.1);
  color: rgba(220,228,240,.45);
  box-shadow: none;
}

.ast-mode-setup .ast-athlete-card .ast-review-button {
  display: none;
}

/* Yellow frame overrides green timing and faded waiting while the warning is active. */
.ast-athlete-card.is-review-warning {
  opacity: 1 !important;
  filter: none !important;
  border: 2px solid #ffd64a !important;
  background:
    linear-gradient(160deg,rgba(63,50,13,.98),rgba(26,25,18,.98)) !important;
  box-shadow:
    0 0 0 2px rgba(255,214,74,.16),
    0 12px 34px rgba(0,0,0,.28),
    0 0 25px rgba(255,214,74,.2) !important;
}

.ast-athlete-card.is-review-warning .ast-athlete-photo {
  border-color: #ffd64a !important;
  box-shadow:
    0 0 0 3px rgba(255,214,74,.15),
    0 6px 20px rgba(0,0,0,.32) !important;
}

.ast-athlete-card.is-review-warning .ast-athlete-name-display,
.ast-athlete-card.is-review-warning .ast-block-time strong {
  color: #ffe98f !important;
}

.ast-athlete-card.is-review-warning .ast-card-status {
  background: rgba(255,214,74,.15);
  color: #ffe98f;
}

.ast-history-row.is-needs-review {
  border-radius: 7px;
  background: rgba(255,214,74,.09);
  padding-inline: 5px;
}

.ast-history-review-mark {
  color: #ffd64a;
  font-size: .58rem;
  white-space: nowrap;
}

/* Compact button for fixed 5 × 2 iPad AST layout. */
body.ast-focus-mode .ast-review-button {
  flex: 0 0 auto;
  width: calc(100% - 14px);
  min-height: 29px;
  margin: 0 7px 5px;
  padding: 3px 5px;
  font-size: .62rem;
}

/* History list and editor alerts. */
.history-session-card.has-review-alert {
  border-color: rgba(255,214,74,.48);
  background:
    linear-gradient(135deg,rgba(255,214,74,.065),rgba(255,255,255,.02));
}

.history-review-count-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 7px;
  border: 1px solid rgba(255,214,74,.28);
  border-radius: 999px;
  background: rgba(255,214,74,.11);
  color: #ffe27a;
  padding: 3px 7px;
  font-size: .63rem;
  font-weight: 950;
  white-space: nowrap;
}

.history-review-alert[hidden] {
  display: none !important;
}

.history-review-alert {
  display: grid;
  grid-template-columns: 42px minmax(0,1fr);
  gap: 12px;
  align-items: start;
  border: 1px solid rgba(255,214,74,.42);
  border-radius: 14px;
  background:
    linear-gradient(135deg,rgba(255,214,74,.13),rgba(255,176,32,.055));
  color: #ffe88f;
  padding: 14px 16px;
}

.history-review-alert-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,214,74,.16);
  font-size: 1.25rem;
}

.history-review-alert strong {
  display: block;
  margin-bottom: 5px;
}

.history-review-alert p,
.history-review-alert small {
  display: block;
  margin: 0;
  color: #f3daa0;
  line-height: 1.5;
}

.history-review-alert small {
  margin-top: 5px;
}

.history-record-table tr.is-needs-review td {
  background: rgba(255,214,74,.095);
  border-bottom-color: rgba(255,214,74,.24);
}

.history-record-table tr.is-needs-review td:first-child {
  box-shadow: inset 4px 0 0 #ffd64a;
}

.history-review-state-cell {
  min-width: 140px;
}

.history-review-select {
  min-width: 125px;
  min-height: 40px;
  border-color: rgba(67,223,141,.28);
  background: rgba(67,223,141,.08);
  color: #87efb7;
  padding-inline: 9px;
  font-size: .75rem;
  font-weight: 850;
}

.history-review-select.is-warning {
  border-color: rgba(255,214,74,.48);
  background: rgba(255,214,74,.12);
  color: #ffe27a;
}

@media (max-width:760px) {
  .ast-review-button {
    width: calc(100% - 16px);
    margin-inline: 8px;
  }

  .history-review-alert {
    grid-template-columns: 1fr;
  }

  .history-review-alert-icon {
    width: 36px;
    height: 36px;
  }
}


/* ================================================================
   Yellow review button fixed at the bottom of each AST card (v37)
   ================================================================ */
.ast-athlete-card > .ast-review-button {
  display: block;
  flex: 0 0 auto;
  order: 99;
  margin-top: auto;
  margin-bottom: 10px;
}

.ast-athlete-card > .ast-history-panel {
  order: 50;
}

/* The history area grows and scrolls; the yellow button remains visible below it. */
body.ast-focus-mode .ast-athlete-card > .ast-history-panel {
  flex: 1 1 auto;
  min-height: 0;
}

body.ast-focus-mode .ast-athlete-card > .ast-review-button {
  flex: 0 0 auto;
  width: calc(100% - 14px);
  min-height: 29px;
  margin: 0 7px 6px;
  padding: 3px 5px;
}

/* Setup mode must continue to hide the review button. */
.ast-mode-setup .ast-athlete-card > .ast-review-button {
  display: none;
}

@media (max-width:760px) {
  .ast-athlete-card > .ast-review-button {
    width: calc(100% - 16px);
    margin: 0 8px 8px;
  }
}


/* ================================================================
   White and blue visual theme (v38)
   ================================================================ */
:root {
  color-scheme: light;
  --bg: #eef6ff;
  --panel: rgba(255,255,255,.96);
  --line: rgba(18,91,158,.17);
  --text: #12345a;
  --muted: #607b98;
  --lap: #1478d4;
  --purple: #397dcc;
}

html {
  background: #eef6ff;
}

body {
  color: var(--text);
  background:
    radial-gradient(circle at 8% 2%,rgba(44,139,222,.17),transparent 31%),
    radial-gradient(circle at 95% 8%,rgba(119,190,245,.22),transparent 27%),
    linear-gradient(155deg,#f9fcff 0%,#edf6ff 48%,#dceeff 100%);
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255,255,255,.32),rgba(255,255,255,.08)),
    repeating-linear-gradient(
      120deg,
      transparent 0,
      transparent 55px,
      rgba(16,104,183,.025) 56px,
      transparent 57px
    );
  content: "";
  z-index: -1;
}

.panel {
  border-color: rgba(18,91,158,.16);
  background: rgba(255,255,255,.94);
  box-shadow:
    0 16px 38px rgba(35,91,145,.11),
    0 2px 8px rgba(35,91,145,.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.eyebrow {
  color: #0f6fc4;
}

.install-hint,
.header-save-state {
  border-color: rgba(18,91,158,.16);
  background: rgba(255,255,255,.68);
  color: #527493;
}

input,
select,
textarea {
  border-color: rgba(18,91,158,.2);
  background: #f8fbff;
  color: #12345a;
  box-shadow: inset 0 1px 2px rgba(35,91,145,.04);
}

input::placeholder,
textarea::placeholder {
  color: #8aa0b7;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #278bdc;
  box-shadow: 0 0 0 3px rgba(39,139,220,.16);
}

.reset {
  background: #e4eef8;
  color: #234c74;
}

.secondary {
  border-color: rgba(18,91,158,.2);
  background: #eaf4fd;
  color: #18558c;
}

.small-button {
  border-color: rgba(18,91,158,.18);
  background: #edf6ff;
  color: #1b5f99;
}

.small-button:hover {
  background: #dceeff;
}

.danger-outline,
.small-button.delete,
.history-row-delete {
  border-color: rgba(207,65,75,.28);
  background: #fff1f2;
  color: #bf3945;
}

/* Deep blue sidebar against the white main canvas. */
.app-sidebar {
  border-right-color: rgba(255,255,255,.16);
  background:
    radial-gradient(circle at 10% 0%,rgba(83,171,238,.28),transparent 31%),
    linear-gradient(180deg,#075da9 0%,#064b8e 52%,#073d75 100%);
  box-shadow: 8px 0 30px rgba(10,70,126,.15);
  color: #fff;
}

.sidebar-brand p {
  color: #bfe4ff;
}

.sidebar-brand strong {
  color: #fff;
}

.sidebar-logo-button {
  border: 2px solid rgba(255,255,255,.9);
  box-shadow: 0 10px 26px rgba(2,36,72,.25);
}

.sidebar-item {
  color: rgba(234,247,255,.78);
}

.sidebar-item:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}

.sidebar-item.is-active {
  border-color: rgba(255,255,255,.34);
  background:
    linear-gradient(100deg,rgba(255,255,255,.23),rgba(255,255,255,.10));
  color: #fff;
  box-shadow: inset 4px 0 0 #8bd0ff;
}

.sidebar-icon {
  background: rgba(255,255,255,.11);
  color: #e8f7ff;
}

.sidebar-item.is-active .sidebar-icon {
  background: rgba(255,255,255,.2);
  color: #fff;
}

.sidebar-footer,
.sidebar-language-label {
  color: rgba(224,243,255,.72);
}

.sidebar-language {
  border-color: rgba(255,255,255,.14);
  background: rgba(255,255,255,.07);
}

.sidebar-language select {
  border-color: rgba(255,255,255,.2);
  background: rgba(255,255,255,.94);
  color: #174d7d;
}

.sidebar-toggle {
  border-color: rgba(255,255,255,.2);
  background: rgba(255,255,255,.1);
  color: #fff;
}

body.sidebar-collapsed .sidebar-item:hover::after,
body.sidebar-collapsed #openSettings::after,
body.sidebar-collapsed #openHistory::after {
  border-color: rgba(18,91,158,.2);
  background: #fff;
  color: #174d7d;
  box-shadow: 0 10px 28px rgba(24,76,126,.18);
}

/* Main header and stopwatch panels. */
.page-header h1,
.page-intro h2,
.section-title-block h2,
.section-heading-row h2,
h1,h2,h3 {
  color: #103a65;
}

.page-subtitle,
.page-intro p:last-child,
.field > span,
.field-label {
  color: #607b98;
}

.master-stopwatch-panel,
.home-template-panel,
.ast-settings-panel,
.ast-program-panel,
.ast-dashboard,
.settings-cloud-panel,
.settings-history-panel,
.history-toolbar,
.history-editor-header,
.history-record-panel {
  background: rgba(255,255,255,.95);
}

.master-time,
.time-display,
.ast-time-display,
.ast-master-time-wrap strong,
.ast-current-block strong,
.ast-next-block strong {
  color: #0b4f8a;
  text-shadow: 0 2px 0 rgba(255,255,255,.8);
}

.timer-card,
.ast-athlete-card {
  border-color: rgba(18,91,158,.18);
  background:
    linear-gradient(160deg,rgba(255,255,255,.99),rgba(235,246,255,.98));
  box-shadow:
    0 14px 30px rgba(35,91,145,.11),
    0 2px 8px rgba(35,91,145,.05);
}

.timer-card.is-running {
  border-color: rgba(37,192,109,.62);
  box-shadow:
    0 0 0 2px rgba(37,192,109,.12),
    0 14px 32px rgba(35,91,145,.11);
}

.timer-number,
.ast-slot-number,
.ast-history-label,
.ast-history-heading {
  color: #6985a0;
}

.running-badge,
.ast-card-status {
  background: #e4eef8;
  color: #4d6c89;
}

.is-running .running-badge,
.ast-athlete-card.is-active .ast-card-status {
  background: #dcf8e8;
  color: #16884d;
}

.ast-athlete-card.is-complete {
  border-color: rgba(20,120,212,.55);
  background:
    linear-gradient(160deg,rgba(248,252,255,.99),rgba(221,240,255,.98));
}

.ast-athlete-card.is-complete .ast-card-status {
  background: #dceeff;
  color: #1269b5;
}

.athlete-select,
.ast-athlete-select {
  background: #f7fbff;
  color: #163d63;
}

.timer-actions,
.ast-card-actions {
  border-top-color: rgba(18,91,158,.12);
  background: rgba(232,244,255,.64);
}

.lap-list,
.ast-history-panel,
.master-laps-panel {
  border-color: rgba(18,91,158,.14);
  background: rgba(225,241,255,.58);
}

.lap-row,
.ast-history-row,
.master-lap-row {
  border-bottom-color: rgba(18,91,158,.12);
}

.ast-history-total {
  color: #173f68;
}

.ast-history-per-rep {
  color: #1673c2;
}

.ast-program-card,
.ast-runtime-summary,
.ast-current-block,
.ast-next-block,
.history-count-card,
.history-meta span,
.settings-status-card,
.history-upload-stat {
  border-color: rgba(18,91,158,.14);
  background: #f1f8ff;
}

.ast-dashboard-focus {
  border-color: rgba(18,91,158,.18);
  background:
    linear-gradient(135deg,rgba(255,255,255,.98),rgba(225,241,255,.96));
}

body.ast-focus-mode {
  background:
    radial-gradient(circle at top left,rgba(70,161,232,.18),transparent 32%),
    linear-gradient(155deg,#f8fcff,#dfedfb);
}

body.ast-focus-mode .ast-dashboard-focus {
  box-shadow: 0 8px 24px rgba(35,91,145,.15);
}

/* Active green and review yellow remain distinct on the light theme. */
.ast-athlete-card.is-active {
  border: 2px solid #2bb86c !important;
  background:
    linear-gradient(160deg,#f4fff8,#e4f8ec) !important;
  box-shadow:
    0 0 0 2px rgba(43,184,108,.12),
    0 12px 28px rgba(35,91,145,.11),
    0 0 22px rgba(43,184,108,.13) !important;
}

.ast-athlete-card.is-active .ast-athlete-name-display,
.ast-athlete-card.is-active .ast-block-time strong {
  color: #137847;
}

.ast-athlete-card.is-next-waiting {
  opacity: .55;
  filter: saturate(.65);
}

.ast-athlete-card.is-review-warning {
  border: 2px solid #e2aa00 !important;
  background:
    linear-gradient(160deg,#fffdf3,#fff3c9) !important;
  box-shadow:
    0 0 0 2px rgba(226,170,0,.13),
    0 12px 30px rgba(35,91,145,.11),
    0 0 22px rgba(226,170,0,.14) !important;
}

.ast-athlete-card.is-review-warning .ast-athlete-name-display,
.ast-athlete-card.is-review-warning .ast-block-time strong {
  color: #8a6500 !important;
}

.ast-athlete-card.is-review-warning .ast-card-status {
  background: #fff0ad;
  color: #7a5900;
}

.ast-review-button {
  border-color: #d7a400;
  background: linear-gradient(180deg,#ffe36e,#f2bd21);
  color: #382900;
  box-shadow: 0 5px 14px rgba(187,137,0,.18);
}

/* Management, Settings and History pages. */
.athlete-row,
.group-row,
.csv-card,
.history-session-card {
  border-color: rgba(18,91,158,.15);
  background: rgba(255,255,255,.95);
}

.history-session-main {
  color: #173f68;
}

.history-session-card.is-uploaded {
  border-color: rgba(37,173,104,.28);
}

.history-session-card.is-pending {
  border-color: rgba(214,154,0,.31);
}

.history-session-card.is-local {
  border-color: rgba(85,119,151,.22);
}

.history-mode-badge.ast {
  background: #fff1c9;
  color: #8a6200;
}

.history-mode-badge.normal {
  background: #deefff;
  color: #1169b5;
}

.history-upload-badge.is-uploaded,
.history-editor-cloud-state.is-uploaded {
  border-color: rgba(31,160,91,.22);
  background: #e3f8ec;
  color: #147c47;
}

.history-upload-badge.is-pending,
.history-editor-cloud-state.is-pending {
  border-color: rgba(207,147,0,.25);
  background: #fff3ce;
  color: #8d6500;
}

.history-upload-badge.is-local,
.history-editor-cloud-state.is-local {
  border-color: rgba(85,119,151,.2);
  background: #edf3f8;
  color: #536f89;
}

.history-table-scroll {
  border-color: rgba(18,91,158,.16);
  background: #fff;
}

.history-record-table {
  background: #fff;
  color: #173f68;
}

.history-record-table th {
  background: #dceeff;
  color: #164d7d;
}

.history-record-table th,
.history-record-table td {
  border-bottom-color: rgba(18,91,158,.13);
}

.history-record-table tr:nth-child(even) td {
  background: #f8fbff;
}

.history-record-table tr.is-needs-review td {
  background: #fff8dc;
  border-bottom-color: rgba(207,147,0,.22);
}

.history-review-alert {
  border-color: rgba(207,147,0,.34);
  background: linear-gradient(135deg,#fff9de,#fff4c5);
  color: #785800;
}

.history-review-alert p,
.history-review-alert small {
  color: #8a6b17;
}

.history-review-count-badge {
  border-color: rgba(207,147,0,.26);
  background: #fff3c4;
  color: #805d00;
}

.history-cloud-location,
.settings-history-panel {
  border-color: rgba(18,91,158,.18);
  background:
    linear-gradient(135deg,rgba(221,239,255,.82),rgba(255,255,255,.94));
}

.history-cloud-location-icon,
.settings-central-cloud-icon {
  background: #d9edff;
  color: #0f6fc4;
}

.history-cloud-connection.is-connected,
.settings-cloud-badge.is-connected {
  border-color: rgba(31,160,91,.25);
  background: #e3f8ec;
  color: #147c47;
}

.history-cloud-connection.is-offline,
.settings-cloud-badge.is-offline {
  border-color: rgba(207,147,0,.26);
  background: #fff3ce;
  color: #8d6500;
}

.history-cloud-connection.is-local,
.settings-cloud-badge.is-local {
  border-color: rgba(85,119,151,.2);
  background: #edf3f8;
  color: #536f89;
}

.history-cloud-connection.is-checking,
.settings-cloud-badge.is-checking {
  border-color: rgba(18,111,196,.22);
  background: #e2f1ff;
  color: #1169b5;
}

.settings-central-cloud-info {
  border-color: rgba(18,91,158,.18);
  background: #edf7ff;
}

.settings-message {
  background: #f3f8fd;
}

.settings-message.is-success,
.history-editor-status.is-success,
.history-empty.history-flash.is-success {
  background: #e3f8ec;
  color: #147c47;
}

.settings-message.is-warning,
.history-editor-status.is-warning {
  background: #fff3ce;
  color: #8d6500;
}

.settings-message.is-error {
  background: #fff0f1;
  color: #b63b47;
}

/* Dialogs and overlays. */
.modal,
.group-dialog,
.ast-completion-dialog {
  border-color: rgba(18,91,158,.2);
  background: #fff;
  color: #173f68;
  box-shadow: 0 24px 70px rgba(17,70,118,.24);
}

.modal::backdrop,
.group-dialog::backdrop,
.ast-completion-dialog::backdrop {
  background: rgba(20,57,91,.34);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-header,
.modal-footer {
  border-color: rgba(18,91,158,.12);
}

/* Keep scrollbar details aligned with the new palette. */
* {
  scrollbar-color: #8ec3eb #eaf4fd;
}

::selection {
  background: #b9ddf8;
  color: #103a65;
}


/* ================================================================
   Athlete and group management white/blue cards (v39)
   ================================================================ */

/* Athlete registration panels */
.management-page .athlete-register-section,
.management-page .athlete-list-toolbar,
.management-page .group-member-panel,
.management-page .saved-group-panel {
  border-color: rgba(18,91,158,.18);
  background:
    linear-gradient(145deg,rgba(255,255,255,.98),rgba(238,247,255,.96));
  box-shadow: 0 9px 24px rgba(35,91,145,.07);
}

/* The old selector was more specific than the general textarea theme. */
.management-page .bulk-register-section textarea {
  border: 1px solid rgba(18,91,158,.22);
  background: #fff;
  color: #153f69;
  caret-color: #1478d4;
  box-shadow:
    inset 0 1px 2px rgba(35,91,145,.04),
    0 5px 15px rgba(35,91,145,.04);
}

.management-page .bulk-register-section textarea::placeholder {
  color: #88a1bb;
}

.management-page .bulk-register-section textarea:focus {
  border-color: #2488db;
  background: #fff;
  box-shadow:
    0 0 0 3px rgba(36,136,219,.15),
    0 7px 20px rgba(35,91,145,.07);
}

.management-page .bulk-athlete-status {
  color: #607b98;
}

.management-page .bulk-athlete-status.is-success {
  color: #147c47;
}

.management-page .bulk-athlete-status.is-warning {
  color: #8d6500;
}

/* Athlete rows */
.management-page .athlete-list {
  gap: 10px;
}

.management-page .athlete-row {
  border: 1px solid rgba(18,91,158,.16);
  border-radius: 15px;
  background:
    linear-gradient(145deg,#fff,#f0f8ff);
  padding: 10px 11px;
  color: #153f69;
  box-shadow:
    0 7px 19px rgba(35,91,145,.07),
    inset 0 1px 0 rgba(255,255,255,.9);
}

.management-page .athlete-row:hover {
  border-color: rgba(20,120,212,.34);
  background:
    linear-gradient(145deg,#fff,#e7f4ff);
}

.management-page .athlete-index {
  color: #3973a6;
}

.management-page .athlete-row > input[type="text"] {
  border-color: rgba(18,91,158,.18);
  background: #fff;
  color: #164d7d;
  font-weight: 800;
}

.management-page .athlete-row > input[type="text"]:focus {
  border-color: #2488db;
  box-shadow: 0 0 0 3px rgba(36,136,219,.14);
}

.management-page .athlete-row-checkbox,
.management-page .athlete-select-all input,
.management-page .group-member-row input {
  accent-color: #1478d4;
}

.management-page .athlete-photo-display,
.management-page .group-member-photo {
  border-color: rgba(18,91,158,.24);
  background:
    radial-gradient(circle at 35% 28%,#f9fcff,#dbeeff 70%);
  color: #245f93;
}

.management-page .athlete-photo-placeholder {
  color: #547aa0;
}

.management-page .photo-small-button {
  border-color: rgba(18,91,158,.18);
  background: #e8f4ff;
  color: #185b92;
}

.management-page .photo-small-button:hover {
  background: #d6ebfc;
}

.management-page .photo-small-button.remove {
  border-color: rgba(207,65,75,.2);
  background: #fff1f2;
  color: #b83e49;
}

.management-page .athlete-row-actions .small-button {
  border-color: rgba(18,91,158,.18);
  background: #e7f3fd;
  color: #185b92;
}

.management-page .athlete-row-actions .small-button:hover {
  background: #d5eafd;
}

.management-page .athlete-row-actions .small-button.delete {
  border-color: rgba(207,65,75,.22);
  background: #fff0f1;
  color: #b83e49;
}

/* Group member selection list */
.management-page .group-member-list {
  gap: 10px;
}

.management-page .group-member-row {
  border: 1px solid rgba(18,91,158,.17);
  background:
    linear-gradient(145deg,#fff,#eef7ff);
  color: #153f69;
  box-shadow:
    0 7px 18px rgba(35,91,145,.07),
    inset 0 1px 0 rgba(255,255,255,.9);
  transition:
    border-color .15s ease,
    background .15s ease,
    box-shadow .15s ease,
    transform .15s ease;
}

.management-page .group-member-row:hover {
  border-color: rgba(20,120,212,.4);
  background:
    linear-gradient(145deg,#fff,#e2f1ff);
  transform: translateY(-1px);
}

.management-page .group-member-row.is-selected {
  border-color: #278bdc;
  background:
    linear-gradient(145deg,#e7f4ff,#cfe8ff);
  color: #0c568f;
  box-shadow:
    0 0 0 2px rgba(39,139,220,.11),
    0 8px 22px rgba(35,91,145,.10);
}

.management-page .group-member-name {
  color: #174d7d;
  font-weight: 900;
}

.management-page .group-member-row.is-selected .group-member-name {
  color: #075ca4;
}

.management-page .group-member-row.is-selected .group-member-photo {
  border-color: rgba(20,120,212,.48);
  background:
    radial-gradient(circle at 35% 28%,#fff,#cfe7fb 72%);
}

/* Group creation controls and saved groups */
.management-page .group-member-toolbar,
.management-page .athlete-register-heading {
  color: #164d7d;
}

.management-page .group-member-toolbar strong,
.management-page .athlete-register-heading h3 {
  color: #103f6d;
}

.management-page .athlete-count,
.management-page .group-member-toolbar span,
.management-page .athlete-register-heading span {
  color: #607b98;
}

.management-page .athlete-group-row,
.management-page .saved-group-row,
.management-page .group-row {
  border-color: rgba(18,91,158,.16);
  background:
    linear-gradient(145deg,#fff,#eef7ff);
  color: #174d7d;
}

.management-page .athlete-group-row strong,
.management-page .saved-group-row strong,
.management-page .group-row strong {
  color: #103f6d;
}

/* Ensure empty/help text stays readable on light cards. */
.management-page .helper,
.management-page .athlete-group-empty {
  color: #607b98;
}

/* Selected-all toolbar remains a clean white/blue block. */
.management-page .athlete-list-toolbar {
  color: #153f69;
}

.management-page .athlete-select-all {
  color: #174d7d;
}

@media (max-width:760px) {
  .management-page .athlete-row,
  .management-page .group-member-row {
    border-radius: 13px;
  }
}


/* ================================================================
   Long-press athlete card reordering (v40)
   ================================================================ */
.card-reorder-hint {
  margin: 4px 2px 9px;
  color: #47769f;
  font-size: .7rem;
  font-weight: 850;
  text-align: right;
}
.ast-mode-setup .ast-reorder-hint { display:none; }

.timer-card,
.ast-athlete-card {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.timer-card:active,
.ast-athlete-card:active { cursor:grabbing; }

body.card-reorder-active {
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.is-card-reordering {
  overflow: hidden !important;
  border: 2px solid #1685d5 !important;
  background: linear-gradient(145deg,#fff,#dceeff) !important;
  box-shadow:
    0 24px 65px rgba(17,86,148,.34),
    0 0 0 5px rgba(22,133,213,.13) !important;
  opacity: .96;
  transform: scale(1.025) rotate(.35deg);
  transition: none !important;
}

.card-reorder-placeholder {
  min-width: 0;
  border: 2px dashed #288ed8;
  border-radius: 18px;
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(54,151,221,.08) 0,
      rgba(54,151,221,.08) 11px,
      rgba(255,255,255,.58) 11px,
      rgba(255,255,255,.58) 22px
    );
  box-shadow: inset 0 0 0 4px rgba(54,151,221,.06);
}

.header-save-state.is-reorder-status {
  border-color: rgba(22,133,213,.28);
  background: #dceeff;
  color: #0f65a8;
}

@media (orientation:landscape) and (min-width:900px) {
  body.ast-focus-mode .card-reorder-hint {
    position: fixed;
    right: 15px;
    top: 7px;
    margin: 0;
    border: 1px solid rgba(18,91,158,.14);
    border-radius: 999px;
    background: rgba(255,255,255,.9);
    padding: 4px 8px;
    z-index: 25;
  }
}
@media (max-width:760px) {
  .card-reorder-hint { margin-right:4px; font-size:.66rem; }
}


/* ================================================================
   AST athlete count + compact top-right master controls (v41)
   ================================================================ */

/* AST setup: athlete count, group, and status in one clean row. */
.ast-group-picker {
  grid-template-columns: minmax(130px,.36fr) minmax(240px,.76fr) minmax(250px,1.1fr);
}

.ast-visible-count-field select {
  min-height: 52px;
  font-size: 1rem;
  font-weight: 900;
  text-align: center;
}

.ast-visible-count-field {
  min-width: 0;
}

/* Measurement: shrink the master area and reserve more height for athlete cards. */
body.ast-focus-mode #astRunScreen {
  grid-template-rows: auto minmax(0,1fr);
  gap: 4px;
}

body.ast-focus-mode .ast-dashboard-focus {
  position: relative;
  display: grid;
  grid-template-columns:
    minmax(145px,.88fr)
    minmax(130px,.66fr)
    minmax(130px,.66fr)
    minmax(92px,.42fr);
  gap: 7px;
  min-height: 64px;
  padding: 6px 260px 6px 9px;
  border-radius: 13px;
}

body.ast-focus-mode .ast-dashboard-focus .ast-master-time-wrap span,
body.ast-focus-mode .ast-dashboard-focus .ast-current-block > span,
body.ast-focus-mode .ast-dashboard-focus .ast-next-block > span,
body.ast-focus-mode .ast-runtime-summary span {
  margin-bottom: 2px;
  font-size: .58rem;
  line-height: 1.05;
}

body.ast-focus-mode .ast-dashboard-focus .ast-master-time-wrap strong {
  font-size: clamp(2rem,3.35vw,3.25rem);
  line-height: .9;
}

body.ast-focus-mode .ast-dashboard-focus .ast-current-block strong {
  font-size: clamp(.98rem,1.55vw,1.3rem);
  line-height: 1.05;
}

body.ast-focus-mode .ast-dashboard-focus .ast-current-block p,
body.ast-focus-mode .ast-dashboard-focus .ast-next-block p {
  margin-top: 2px;
  font-size: .58rem;
  line-height: 1.05;
}

body.ast-focus-mode .ast-dashboard-focus .ast-next-block strong {
  font-size: clamp(1.15rem,1.9vw,1.75rem);
  line-height: 1;
}

body.ast-focus-mode .ast-runtime-summary strong {
  font-size: .85rem;
  line-height: 1.05;
}

/* Start / Stop / Pause fixed at upper right. */
body.ast-focus-mode .ast-runtime-controls {
  position: absolute;
  top: 6px;
  right: 7px;
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 5px;
  width: 246px;
  margin: 0;
}

body.ast-focus-mode .ast-runtime-controls .button,
body.ast-focus-mode .ast-runtime-controls .button:last-child {
  grid-column: auto;
  min-height: 38px;
  padding: 4px 5px;
  font-size: .72rem;
  line-height: 1.05;
}

body.ast-focus-mode .ast-runtime-controls .ast-complete-button {
  background: linear-gradient(180deg,#f0525d,#cf2f3b);
  color: #fff;
}

/* Give the athlete area every remaining pixel. */
body.ast-focus-mode #astRunGridHost {
  height: 100%;
}

body.ast-focus-mode .ast-grid {
  gap: 7px;
}

body.ast-focus-mode .ast-athlete-card {
  border-radius: 13px;
}

/* Very narrow screens fall back to a normal compact control row. */
@media (max-width:900px) {
  .ast-group-picker {
    grid-template-columns: 1fr;
  }

  body.ast-focus-mode .ast-dashboard-focus {
    grid-template-columns: repeat(2,minmax(0,1fr));
    padding: 7px;
  }

  body.ast-focus-mode .ast-runtime-controls {
    position: static;
    grid-column: 1 / -1;
    width: 100%;
  }
}


/* ================================================================
   Multiple History session selection and combined CSV export (v42)
   ================================================================ */
.history-bulk-export-panel {
  display: grid;
  grid-template-columns: auto minmax(150px,.55fr) minmax(280px,auto);
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
  padding: 14px 16px;
  border-color: rgba(18,91,158,.18);
  background:
    linear-gradient(135deg,rgba(226,241,255,.9),rgba(255,255,255,.97));
}

.history-select-all-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #174d7d;
  font-size: .78rem;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.history-select-all-label input,
.history-session-select input {
  accent-color: #1478d4;
}

.history-selection-summary {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
}

.history-selection-summary strong {
  color: #0b5fa7;
  font-size: 1rem;
}

.history-selection-summary span {
  color: #607b98;
  font-size: .72rem;
  font-weight: 750;
}

.history-bulk-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.history-bulk-actions .button {
  min-height: 42px;
  padding-inline: 13px;
}

.history-bulk-message {
  grid-column: 1 / -1;
  min-height: 0;
  margin: -3px 0 0;
  color: #607b98;
  font-size: .72rem;
  font-weight: 750;
}

.history-bulk-message:empty {
  display: none;
}

.history-bulk-message.is-success {
  color: #147c47;
}

.history-bulk-message.is-warning {
  color: #8d6500;
}

.history-session-card {
  grid-template-columns: 38px minmax(0,1fr) auto;
}

.history-session-card.is-selected {
  border-color: #278bdc !important;
  background:
    linear-gradient(145deg,#f8fcff,#dceeff) !important;
  box-shadow:
    0 0 0 3px rgba(39,139,220,.11),
    0 10px 25px rgba(35,91,145,.10);
}

.history-session-select {
  display: grid;
  place-items: center;
  align-self: stretch;
  min-height: 54px;
  border-right: 1px solid rgba(18,91,158,.12);
  cursor: pointer;
}

.history-session-select input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.history-session-select-visual {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid #7ea7c9;
  border-radius: 7px;
  background: #fff;
  transition:
    border-color .14s ease,
    background .14s ease,
    box-shadow .14s ease;
}

.history-session-select input:checked + .history-session-select-visual {
  border-color: #1478d4;
  background: #1478d4;
  box-shadow: 0 0 0 3px rgba(20,120,212,.13);
}

.history-session-select input:checked + .history-session-select-visual::after {
  color: #fff;
  font-size: .9rem;
  font-weight: 950;
  content: "✓";
}

.history-session-select input:focus-visible + .history-session-select-visual {
  outline: 3px solid rgba(20,120,212,.25);
  outline-offset: 2px;
}

@media (max-width:980px) {
  .history-bulk-export-panel {
    grid-template-columns: 1fr 1fr;
  }

  .history-bulk-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .history-bulk-actions .button {
    flex: 1;
  }
}

@media (max-width:760px) {
  .history-bulk-export-panel {
    grid-template-columns: 1fr;
  }

  .history-bulk-actions {
    grid-column: auto;
    display: grid;
    grid-template-columns: 1fr;
  }

  .history-session-card {
    grid-template-columns: 38px minmax(0,1fr);
  }

  .history-session-actions {
    grid-column: 1 / -1;
  }

  .history-session-select {
    grid-row: 1;
  }
}


/* ================================================================
   AST setup: complete white and blue theme (v43)
   ================================================================ */
#astSetupScreen .ast-settings-panel,
#astSetupScreen .rep-flow-card,
#astSetupScreen .schedule-card {
  border-color: rgba(18,91,158,.17);
  background: linear-gradient(145deg,rgba(255,255,255,.99),rgba(239,247,255,.97));
  color: #123f6a;
  box-shadow: 0 12px 30px rgba(35,91,145,.09), inset 0 1px 0 rgba(255,255,255,.9);
}

#astSetupScreen .sound-toggle {
  border-color: rgba(18,91,158,.2);
  background: linear-gradient(145deg,#fff,#edf7ff);
  color: #174d7d;
  box-shadow: 0 5px 14px rgba(35,91,145,.06), inset 0 1px 0 rgba(255,255,255,.9);
}
#astSetupScreen .sound-toggle input { accent-color:#1478d4; }
#astSetupScreen .sound-toggle span { color:#315f8a; }

#astSetupScreen .ast-set-start-row {
  border-color: rgba(18,91,158,.17);
  background: linear-gradient(145deg,#fff,#f1f8ff);
  color: #123f6a;
  box-shadow: 0 4px 12px rgba(35,91,145,.045);
}
#astSetupScreen .ast-set-start-row.is-warning {
  border-color: rgba(206,148,0,.42);
  background: linear-gradient(145deg,#fffdf2,#fff3c8);
}
#astSetupScreen .ast-set-start-row > strong,
#astSetupScreen .ast-set-fixed-time { color:#103f6d; }
#astSetupScreen .ast-set-time-inputs input {
  border-color: rgba(18,91,158,.2);
  background:#fff;
  color:#0e4c80;
}
#astSetupScreen .ast-set-time-inputs label,
#astSetupScreen .ast-set-time-inputs span { color:#557797; }

#astSetupScreen .rep-flow span {
  border-color: rgba(20,120,212,.22);
  background: linear-gradient(145deg,#fafdff,#e5f2ff);
  color:#174d7d;
  box-shadow:0 3px 9px rgba(35,91,145,.045);
}
#astSetupScreen .rep-flow b { color:#4b7da7; }

#astSetupScreen .schedule-item {
  border-color: rgba(18,91,158,.18);
  background: linear-gradient(145deg,#fff,#eaf5ff);
  color:#123f6a;
  box-shadow:0 6px 15px rgba(35,91,145,.065), inset 0 1px 0 rgba(255,255,255,.9);
}
#astSetupScreen .schedule-item.is-set2 {
  border-color: rgba(31,126,205,.34);
  background: linear-gradient(145deg,#f7fbff,#dceeff);
}
#astSetupScreen .schedule-item small { color:#6986a1; }
#astSetupScreen .schedule-item strong { color:#0f4f86; }
#astSetupScreen .schedule-item span { color:#1478d4; }
#astSetupScreen .schedule-heading > span { color:#607b98; }
#astSetupScreen .warning-text { color:#9a6b00; }

/* ================================================================
   iPad Home Screen web-app installation guide (v43)
   ================================================================ */
.install-guide-button {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  width:100%;
  max-width:none;
  min-height:48px;
  border:1px solid rgba(255,255,255,.24);
  border-radius:13px;
  background:linear-gradient(145deg,rgba(255,255,255,.2),rgba(255,255,255,.09));
  color:#fff;
  padding:8px 10px;
  font-size:.72rem;
  font-weight:900;
  line-height:1.25;
  cursor:pointer;
  box-shadow:0 7px 17px rgba(2,42,82,.13);
}
.install-guide-button:hover {
  background:linear-gradient(145deg,rgba(255,255,255,.28),rgba(255,255,255,.13));
}
.install-guide-button-icon {
  display:grid;
  place-items:center;
  flex:0 0 auto;
  width:25px;
  height:25px;
  border-radius:8px;
  background:rgba(255,255,255,.17);
  font-size:.85rem;
}

.install-guide-dialog {
  width:min(610px,calc(100vw - 28px));
  max-height:calc(100dvh - 28px);
  overflow:auto;
  border:1px solid rgba(18,91,158,.2);
  border-radius:22px;
  background:#fff;
  color:#123f6a;
  padding:0;
  box-shadow:0 28px 85px rgba(18,68,112,.28);
}
.install-guide-dialog::backdrop {
  background:rgba(17,53,85,.4);
  backdrop-filter:blur(6px);
  -webkit-backdrop-filter:blur(6px);
}
.install-guide-card { display:grid; gap:16px; padding:22px; }
.install-guide-header {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:15px;
}
.install-guide-header h2 {
  color:#103f6d;
  font-size:clamp(1.45rem,4vw,2rem);
}
.install-guide-close {
  display:grid;
  place-items:center;
  flex:0 0 auto;
  width:42px;
  height:42px;
  border:1px solid rgba(18,91,158,.16);
  border-radius:50%;
  background:#eaf4fd;
  color:#185b92;
  font-size:1.65rem;
  line-height:1;
  cursor:pointer;
}
.install-guide-intro {
  margin:0;
  color:#567795;
  line-height:1.55;
}
.install-guide-steps {
  display:grid;
  gap:10px;
  margin:0;
  padding:0;
  list-style:none;
}
.install-guide-steps li {
  display:grid;
  grid-template-columns:38px minmax(0,1fr);
  gap:11px;
  align-items:start;
  border:1px solid rgba(18,91,158,.14);
  border-radius:15px;
  background:linear-gradient(145deg,#fff,#edf7ff);
  padding:12px;
}
.install-step-number {
  display:grid;
  place-items:center;
  width:34px;
  height:34px;
  border-radius:50%;
  background:#1478d4;
  color:#fff;
  font-weight:950;
}
.install-guide-steps strong {
  display:block;
  margin:1px 0 3px;
  color:#124d7e;
}
.install-guide-steps p {
  margin:0;
  color:#617d97;
  font-size:.83rem;
  line-height:1.45;
}
.install-guide-note {
  display:grid;
  gap:4px;
  border:1px solid rgba(31,160,91,.2);
  border-radius:14px;
  background:#e8f8ef;
  padding:12px 14px;
  color:#196a42;
}
.install-guide-note span {
  color:#347b59;
  font-size:.8rem;
}
.install-guide-done { width:100%; }

@media (max-width:760px) {
  #astSetupScreen .ast-schedule { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .install-guide-card { padding:17px; }
}


/* ================================================================
   iPad landscape: up to 7 AST athlete cards in one row (v44)
   ================================================================ */
@media (orientation:landscape) and (min-width:900px) {
  body.ast-focus-mode #astRunGridHost {
    width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  body.ast-focus-mode .ast-grid {
    width: 100%;
    min-width: 0;
    height: 100%;
    grid-template-columns:
      repeat(var(--ast-athlete-columns,5),minmax(0,1fr));
    grid-template-rows:
      repeat(var(--ast-athlete-rows,1),minmax(0,1fr));
    grid-auto-flow: row;
    grid-auto-rows: minmax(0,1fr);
    align-items: stretch;
    gap: 6px;
    overflow: hidden;
  }

  /* 1–7 athletes always occupy a single horizontal row. */
  body.ast-focus-mode .ast-grid.is-seven-or-fewer {
    grid-template-rows: minmax(0,1fr);
  }

  /* 8–10 athletes: first row has seven, remaining athletes use row two. */
  body.ast-focus-mode .ast-grid.is-eight-or-more {
    grid-template-columns: repeat(7,minmax(0,1fr));
    grid-template-rows: repeat(2,minmax(0,1fr));
  }

  body.ast-focus-mode .ast-athlete-card {
    width: auto;
    min-width: 0;
    max-width: none;
  }

  body.ast-focus-mode .ast-athlete-card > * {
    min-width: 0;
  }

  /* Compact card details only when six or seven cards share one row. */
  body.ast-focus-mode .ast-grid[data-athlete-count="6"],
  body.ast-focus-mode .ast-grid[data-athlete-count="7"] {
    gap: 5px;
  }

  body.ast-focus-mode
  .ast-grid:is([data-athlete-count="6"],[data-athlete-count="7"])
  .ast-athlete-card {
    border-radius: 11px;
  }

  body.ast-focus-mode
  .ast-grid:is([data-athlete-count="6"],[data-athlete-count="7"])
  .ast-athlete-card .card-topline {
    gap: 3px;
    padding: 4px 5px 1px;
  }

  body.ast-focus-mode
  .ast-grid:is([data-athlete-count="6"],[data-athlete-count="7"])
  .ast-slot-number {
    overflow: hidden;
    font-size: .53rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.ast-focus-mode
  .ast-grid:is([data-athlete-count="6"],[data-athlete-count="7"])
  .ast-card-status {
    max-width: 72px;
    overflow: hidden;
    padding: 3px 5px;
    font-size: .51rem;
    text-overflow: ellipsis;
  }

  body.ast-focus-mode
  .ast-grid:is([data-athlete-count="6"],[data-athlete-count="7"])
  .ast-athlete-identity {
    gap: 2px;
    padding: 2px 4px 3px;
  }

  body.ast-focus-mode
  .ast-grid:is([data-athlete-count="6"],[data-athlete-count="7"])
  .ast-athlete-name-display {
    padding: 2px 3px;
    font-size: clamp(.59rem,.72vw,.7rem);
    line-height: 1.08;
  }

  body.ast-focus-mode
  .ast-grid:is([data-athlete-count="6"],[data-athlete-count="7"])
  .ast-athlete-photo {
    width: clamp(38px,3.55vw,49px);
    height: clamp(38px,3.55vw,49px);
  }

  body.ast-focus-mode
  .ast-grid:is([data-athlete-count="6"],[data-athlete-count="7"])
  .ast-block-time {
    gap: 1px;
    padding: 2px 4px;
  }

  body.ast-focus-mode
  .ast-grid:is([data-athlete-count="6"],[data-athlete-count="7"])
  .ast-block-time span {
    font-size: .49rem;
  }

  body.ast-focus-mode
  .ast-grid:is([data-athlete-count="6"],[data-athlete-count="7"])
  .ast-block-time strong {
    font-size: clamp(1.45rem,2.15vw,2rem);
    letter-spacing: -.06em;
  }

  body.ast-focus-mode
  .ast-grid:is([data-athlete-count="6"],[data-athlete-count="7"])
  .ast-finish-button {
    width: calc(100% - 10px);
    min-height: 37px;
    margin: 0 5px 4px;
    padding: 3px;
    font-size: .65rem;
  }

  body.ast-focus-mode
  .ast-grid:is([data-athlete-count="6"],[data-athlete-count="7"])
  .ast-undo-button {
    width: calc(100% - 10px);
    min-height: 23px;
    margin: 0 5px 4px;
    padding: 2px 3px;
    font-size: .49rem;
  }

  body.ast-focus-mode
  .ast-grid:is([data-athlete-count="6"],[data-athlete-count="7"])
  .ast-history-heading {
    padding: 3px 4px 2px;
    font-size: .48rem;
  }

  body.ast-focus-mode
  .ast-grid:is([data-athlete-count="6"],[data-athlete-count="7"])
  .ast-history-list {
    padding: 0 4px 3px;
  }

  body.ast-focus-mode
  .ast-grid:is([data-athlete-count="6"],[data-athlete-count="7"])
  .ast-history-row {
    gap: 2px;
    padding: 2px 0;
    font-size: .46rem;
  }

  body.ast-focus-mode
  .ast-grid:is([data-athlete-count="6"],[data-athlete-count="7"])
  .ast-history-review-mark {
    font-size: .42rem;
  }

  body.ast-focus-mode
  .ast-grid:is([data-athlete-count="6"],[data-athlete-count="7"])
  .ast-review-button {
    width: calc(100% - 10px);
    min-height: 26px;
    margin: 0 5px 5px;
    padding: 2px 3px;
    font-size: .52rem;
  }
}

/* iPad portrait keeps a readable two-column card layout. */
@media (orientation:portrait) and (min-width:768px) {
  body.ast-focus-mode .ast-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
}


/* ================================================================
   Shared athlete roster cloud status (v45)
   ================================================================ */
.management-page .page-intro {
  position: relative;
}

.roster-cloud-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  margin-top: 10px;
  border: 1px solid rgba(18,91,158,.16);
  border-radius: 999px;
  background: #edf6ff;
  color: #315f86;
  padding: 6px 10px;
  font-size: .7rem;
  font-weight: 850;
}

.roster-cloud-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7d9ab4;
  box-shadow: 0 0 0 3px rgba(125,154,180,.12);
}

.roster-cloud-status.is-syncing {
  border-color: rgba(20,120,212,.22);
  background: #e2f1ff;
  color: #1269b5;
}

.roster-cloud-status.is-syncing .roster-cloud-dot,
.roster-cloud-status.is-checking .roster-cloud-dot {
  background: #278bdc;
  box-shadow: 0 0 0 3px rgba(39,139,220,.14);
  animation: roster-cloud-pulse 1.2s ease-in-out infinite;
}

.roster-cloud-status.is-synced {
  border-color: rgba(31,160,91,.22);
  background: #e3f8ec;
  color: #147c47;
}

.roster-cloud-status.is-synced .roster-cloud-dot {
  background: #24a760;
  box-shadow: 0 0 0 3px rgba(36,167,96,.13);
}

.roster-cloud-status.is-pending {
  border-color: rgba(207,147,0,.24);
  background: #fff3ce;
  color: #8d6500;
}

.roster-cloud-status.is-pending .roster-cloud-dot {
  background: #d59a00;
  box-shadow: 0 0 0 3px rgba(213,154,0,.13);
}

.roster-cloud-status.is-error {
  border-color: rgba(207,65,75,.22);
  background: #fff0f1;
  color: #b63b47;
}

.roster-cloud-status.is-error .roster-cloud-dot {
  background: #cf414b;
  box-shadow: 0 0 0 3px rgba(207,65,75,.12);
}

.roster-cloud-status.is-local {
  border-color: rgba(85,119,151,.19);
  background: #edf3f8;
  color: #536f89;
}

@keyframes roster-cloud-pulse {
  0%,100% { opacity:.55; transform:scale(.86); }
  50% { opacity:1; transform:scale(1.08); }
}


/* ================================================================
   Larger AST athlete photo and Block finish button (v46)
   ================================================================ */

/* 1–5 athletes: use the available card width and height generously. */
@media (orientation:landscape) and (min-width:900px) {
  body.ast-focus-mode
  .ast-grid:is(
    [data-athlete-count="1"],
    [data-athlete-count="2"],
    [data-athlete-count="3"],
    [data-athlete-count="4"],
    [data-athlete-count="5"]
  )
  .ast-athlete-identity {
    grid-template-columns: 68px minmax(0,1fr);
    gap: 8px;
    padding: 5px 8px;
  }

  body.ast-focus-mode
  .ast-grid:is(
    [data-athlete-count="1"],
    [data-athlete-count="2"],
    [data-athlete-count="3"],
    [data-athlete-count="4"],
    [data-athlete-count="5"]
  )
  .ast-athlete-photo {
    width: 68px;
    height: 68px;
  }

  body.ast-focus-mode
  .ast-grid:is(
    [data-athlete-count="1"],
    [data-athlete-count="2"],
    [data-athlete-count="3"],
    [data-athlete-count="4"],
    [data-athlete-count="5"]
  )
  .ast-athlete-name-display {
    padding: 9px 7px;
    font-size: .9rem;
  }

  body.ast-focus-mode
  .ast-grid:is(
    [data-athlete-count="1"],
    [data-athlete-count="2"],
    [data-athlete-count="3"],
    [data-athlete-count="4"],
    [data-athlete-count="5"]
  )
  .ast-finish-button {
    width: calc(100% - 14px);
    min-height: 58px;
    margin: 0 7px 6px;
    padding: 7px 5px;
    font-size: .98rem;
    font-weight: 950;
  }

  /* 6–7 athletes: noticeably larger, while retaining one-row layout. */
  body.ast-focus-mode
  .ast-grid:is([data-athlete-count="6"],[data-athlete-count="7"])
  .ast-athlete-identity {
    grid-template-columns: 52px minmax(0,1fr);
    gap: 4px;
    padding: 3px 5px 4px;
  }

  body.ast-focus-mode
  .ast-grid:is([data-athlete-count="6"],[data-athlete-count="7"])
  .ast-athlete-photo {
    width: 52px;
    height: 52px;
  }

  body.ast-focus-mode
  .ast-grid:is([data-athlete-count="6"],[data-athlete-count="7"])
  .ast-athlete-name-display {
    padding: 4px 3px;
    font-size: clamp(.66rem,.78vw,.76rem);
  }

  body.ast-focus-mode
  .ast-grid:is([data-athlete-count="6"],[data-athlete-count="7"])
  .ast-finish-button {
    width: calc(100% - 10px);
    min-height: 49px;
    margin: 0 5px 5px;
    padding: 5px 3px;
    font-size: .77rem;
    font-weight: 950;
  }
}

/* Portrait: keep controls comfortably tappable without forcing one row. */
@media (orientation:portrait) and (min-width:768px) {
  body.ast-focus-mode .ast-athlete-photo {
    width: 66px;
    height: 66px;
  }

  body.ast-focus-mode .ast-athlete-identity {
    grid-template-columns: 66px minmax(0,1fr);
  }

  body.ast-focus-mode .ast-finish-button {
    min-height: 56px;
    font-size: .94rem;
  }
}


/* ================================================================
   Near-edge AST photos and square Block finish buttons (v47)
   ================================================================ */
@media (orientation:landscape) and (min-width:900px) {
  /* For 1–7 athletes, stack the name above a large photo. */
  body.ast-focus-mode
  .ast-grid:is(
    [data-athlete-count="1"],
    [data-athlete-count="2"],
    [data-athlete-count="3"],
    [data-athlete-count="4"],
    [data-athlete-count="5"],
    [data-athlete-count="6"],
    [data-athlete-count="7"]
  )
  .ast-athlete-identity {
    display: grid;
    grid-template-columns: minmax(0,1fr);
    justify-items: center;
    align-items: start;
    gap: 3px;
    width: 100%;
    padding: 2px 3px 4px;
  }

  body.ast-focus-mode
  .ast-grid:is(
    [data-athlete-count="1"],
    [data-athlete-count="2"],
    [data-athlete-count="3"],
    [data-athlete-count="4"],
    [data-athlete-count="5"],
    [data-athlete-count="6"],
    [data-athlete-count="7"]
  )
  .ast-athlete-name-display {
    width: calc(100% - 4px);
    padding: 3px 4px;
    line-height: 1.05;
  }

  /* 1–5 athletes: photo nearly reaches the side edges of the card. */
  body.ast-focus-mode
  .ast-grid:is(
    [data-athlete-count="1"],
    [data-athlete-count="2"],
    [data-athlete-count="3"],
    [data-athlete-count="4"],
    [data-athlete-count="5"]
  )
  .ast-athlete-photo {
    width: calc(100% - 8px) !important;
    max-width: 210px;
    height: auto !important;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    border-width: 3px;
  }

  /* 6–7 athletes: use almost the entire narrow card width. */
  body.ast-focus-mode
  .ast-grid:is([data-athlete-count="6"],[data-athlete-count="7"])
  .ast-athlete-photo {
    width: calc(100% - 6px) !important;
    max-width: 142px;
    height: auto !important;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    border-width: 3px;
  }

  /* The Block-complete control is now a large square button. */
  body.ast-focus-mode
  .ast-grid:is(
    [data-athlete-count="1"],
    [data-athlete-count="2"],
    [data-athlete-count="3"],
    [data-athlete-count="4"],
    [data-athlete-count="5"]
  )
  .ast-finish-button {
    display: grid;
    place-items: center;
    width: min(calc(100% - 12px),170px);
    height: auto;
    min-height: 0;
    aspect-ratio: 1 / 1;
    margin: 2px auto 7px;
    padding: 9px;
    border-radius: 20px;
    font-size: clamp(1rem,1.45vw,1.28rem);
    font-weight: 950;
    line-height: 1.12;
    text-align: center;
    box-shadow:
      0 12px 25px rgba(74,83,190,.21),
      inset 0 1px 0 rgba(255,255,255,.27);
  }

  body.ast-focus-mode
  .ast-grid:is([data-athlete-count="6"],[data-athlete-count="7"])
  .ast-finish-button {
    display: grid;
    place-items: center;
    width: min(calc(100% - 8px),142px);
    height: auto;
    min-height: 0;
    aspect-ratio: 1 / 1;
    margin: 1px auto 6px;
    padding: 6px;
    border-radius: 17px;
    font-size: clamp(.82rem,.93vw,1rem);
    font-weight: 950;
    line-height: 1.08;
    text-align: center;
    box-shadow:
      0 10px 22px rgba(74,83,190,.2),
      inset 0 1px 0 rgba(255,255,255,.25);
  }

  /* Keep the record history as the flexible, scrollable remainder. */
  body.ast-focus-mode
  .ast-grid:is(
    [data-athlete-count="1"],
    [data-athlete-count="2"],
    [data-athlete-count="3"],
    [data-athlete-count="4"],
    [data-athlete-count="5"],
    [data-athlete-count="6"],
    [data-athlete-count="7"]
  )
  .ast-history-panel {
    flex: 1 1 76px;
    min-height: 48px;
  }
}

/* Portrait iPad: large photo and square button while retaining two columns. */
@media (orientation:portrait) and (min-width:768px) {
  body.ast-focus-mode .ast-athlete-identity {
    display: grid;
    grid-template-columns: minmax(0,1fr);
    justify-items: center;
    gap: 4px;
    padding: 3px 5px 5px;
  }

  body.ast-focus-mode .ast-athlete-photo {
    width: min(calc(100% - 12px),190px) !important;
    max-width: none;
    height: auto !important;
    aspect-ratio: 1 / 1;
    border-width: 3px;
  }

  body.ast-focus-mode .ast-finish-button {
    display: grid;
    place-items: center;
    width: min(calc(100% - 14px),160px);
    height: auto;
    min-height: 0;
    aspect-ratio: 1 / 1;
    margin: 2px auto 7px;
    border-radius: 20px;
    font-size: 1.06rem;
    font-weight: 950;
  }
}


/* ================================================================
   History CSV selection layout fix for iPad (v48)
   ================================================================ */

/*
  iPadの表示幅では、チェックボックス・履歴情報・操作ボタンを
  別々のグリッド領域へ固定する。文字量が増えても重ならない。
*/
@media (min-width:761px) and (max-width:1400px) {
  .history-session-card {
    grid-template-columns: 44px minmax(0,1fr);
    grid-template-areas:
      "select main"
      "select actions";
    column-gap: 10px;
    row-gap: 8px;
    align-items: stretch;
    padding: 10px 11px;
  }

  .history-session-select {
    grid-area: select;
    align-self: stretch;
    min-width: 44px;
    min-height: 100%;
    border-right: 1px solid rgba(18,91,158,.14);
  }

  .history-session-select-visual {
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
  }

  .history-session-main {
    grid-area: main;
    display: grid;
    grid-template-columns: auto auto minmax(0,1fr);
    grid-template-areas:
      "mode upload name"
      "date date date"
      "stats stats stats"
      "detail detail detail";
    width: 100%;
    min-width: 0;
    gap: 5px 8px;
    padding: 5px 4px 2px;
    overflow: hidden;
  }

  .history-session-main .history-mode-badge {
    grid-area: mode;
    align-self: center;
  }

  .history-session-main .history-upload-badge {
    grid-area: upload;
    align-self: center;
  }

  .history-session-main > strong {
    grid-area: name;
    min-width: 0;
    overflow: hidden;
    font-size: .94rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
    text-overflow: ellipsis;
    white-space: normal;
  }

  .history-session-main .history-session-date {
    grid-area: date;
  }

  .history-session-main .history-session-stats {
    grid-area: stats;
  }

  .history-session-main .history-upload-detail {
    grid-area: detail;
  }

  .history-session-date,
  .history-session-stats,
  .history-upload-detail {
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal;
    line-height: 1.35;
  }

  .history-session-actions {
    grid-area: actions;
    display: flex;
    justify-content: flex-end;
    gap: 7px;
    width: 100%;
    min-width: 0;
  }

  .history-session-actions .small-button {
    min-width: 72px;
    min-height: 38px;
    padding: 6px 10px;
    white-space: nowrap;
  }
}

/* iPad portrait / narrow widths: buttons use a clean full-width row. */
@media (max-width:820px) {
  .history-session-card {
    grid-template-columns: 42px minmax(0,1fr);
    grid-template-areas:
      "select main"
      "actions actions";
    gap: 8px;
  }

  .history-session-select {
    grid-area: select;
    border-right: 1px solid rgba(18,91,158,.14);
  }

  .history-session-main {
    grid-area: main;
    grid-template-columns: auto minmax(0,1fr);
    grid-template-areas:
      "mode name"
      "upload upload"
      "date date"
      "stats stats"
      "detail detail";
    gap: 5px 7px;
  }

  .history-session-main .history-mode-badge {
    grid-area: mode;
  }

  .history-session-main .history-upload-badge {
    grid-area: upload;
    justify-self: start;
  }

  .history-session-main > strong {
    grid-area: name;
  }

  .history-session-main .history-session-date {
    grid-area: date;
  }

  .history-session-main .history-session-stats {
    grid-area: stats;
  }

  .history-session-main .history-upload-detail {
    grid-area: detail;
  }

  .history-session-actions {
    grid-area: actions;
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 7px;
  }

  .history-session-actions .small-button {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding-inline: 5px;
  }
}

/* ================================================================
   AST athlete feedback sheets (v49)
   ================================================================ */
.feedback-page {
  --feedback-blue: #08aee0;
  --feedback-deep-blue: #14658a;
  --feedback-orange: #ed6b2c;
  --feedback-line: #17212b;
}

.feedback-page-intro,
.feedback-intro-actions,
.feedback-control-actions,
.feedback-all-athletes {
  display: flex;
  align-items: center;
}

.feedback-page-intro {
  justify-content: space-between;
  gap: 18px;
}

.feedback-intro-actions {
  gap: 10px;
  flex-wrap: wrap;
}

.feedback-controls {
  margin-bottom: 18px;
  padding: 20px;
}

.feedback-control-grid {
  display: grid;
  grid-template-columns: minmax(250px,1.6fr) minmax(180px,1fr) minmax(130px,.55fr) minmax(150px,.7fr);
  gap: 14px;
}

.feedback-notes-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 14px;
  margin-top: 14px;
}

.feedback-notes-grid textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
}

.feedback-control-actions {
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
}

.feedback-all-athletes {
  gap: 10px;
  color: #244e78;
  font-weight: 800;
}

.feedback-all-athletes input {
  width: 22px;
  height: 22px;
  accent-color: #147bd1;
}

.feedback-status {
  min-height: 1.4em;
  margin: 12px 0 0;
  color: #607b98;
  font-weight: 750;
}

.feedback-status.is-success {
  color: #0c7c58;
}

.feedback-status.is-warning {
  color: #a35d00;
}

.feedback-empty {
  padding: 36px;
  color: #607b98;
  text-align: center;
}

.feedback-empty strong {
  display: block;
  margin-bottom: 7px;
  color: #174d7d;
  font-size: 1.05rem;
}

.feedback-preview {
  display: grid;
  gap: 28px;
  padding: 14px;
  border-radius: 22px;
  background:
    linear-gradient(135deg,rgba(11,174,224,.08),rgba(20,101,138,.035)),
    #dfeaf4;
  overflow-x: auto;
}

.feedback-sheet {
  box-sizing: border-box;
  width: min(100%, 900px);
  min-width: 0;
  margin: 0 auto;
  padding: 14px;
  border: 1px solid rgba(20,68,110,.18);
  border-radius: 4px;
  background: #fff;
  color: #111;
  box-shadow: 0 18px 45px rgba(22,66,105,.18);
  font-family: Arial, "Helvetica Neue", sans-serif;
}

.feedback-sheet table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.feedback-sheet th,
.feedback-sheet td {
  border: 1.5px solid var(--feedback-line);
  padding: 5px 6px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.feedback-sheet-title {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  min-height: 66px;
  padding: 6px 18px;
  background: var(--feedback-blue);
  color: #07131d;
}

.feedback-sheet-title > span {
  font-size: 1.16rem;
  font-weight: 950;
  letter-spacing: .02em;
}

.feedback-sheet-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.feedback-sheet-brand img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.feedback-sheet-brand strong {
  color: #06141f;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: .01em;
}

.feedback-athlete-meta {
  display: grid;
  grid-template-columns: minmax(0,1fr) 330px;
  min-height: 72px;
  border: 1.5px solid var(--feedback-line);
  border-top: 0;
}

.feedback-athlete-meta h3 {
  display: grid;
  place-items: center;
  margin: 0;
  border-right: 1.5px solid var(--feedback-line);
  color: #111;
  font-size: 1.55rem;
  font-weight: 500;
}

.feedback-athlete-meta dl {
  display: grid;
  grid-template-rows: repeat(2,1fr);
  margin: 0;
}

.feedback-athlete-meta dl > div {
  display: grid;
  grid-template-columns: 86px 1fr;
}

.feedback-athlete-meta dl > div:first-child {
  border-bottom: 1.5px solid var(--feedback-line);
}

.feedback-athlete-meta dt,
.feedback-athlete-meta dd {
  display: grid;
  place-items: center;
  margin: 0;
  padding: 5px;
}

.feedback-athlete-meta dt {
  border-right: 1.5px solid var(--feedback-line);
}

.feedback-summary {
  display: grid;
  grid-template-columns: minmax(0,1.1fr) minmax(170px,.75fr) minmax(240px,1fr);
  border: 1.5px solid var(--feedback-line);
  border-top: 0;
}

.feedback-summary > div {
  display: grid;
  align-content: stretch;
  border-right: 1.5px solid var(--feedback-line);
}

.feedback-summary > div:last-child {
  border-right: 0;
}

.feedback-summary h4 {
  display: grid;
  place-items: center;
  min-height: 31px;
  margin: 0;
  padding: 4px;
  border-bottom: 1.5px solid var(--feedback-line);
  color: #111;
  font-size: .92rem;
}

.feedback-total-box table,
.feedback-total-box th,
.feedback-total-box td {
  border: 0;
}

.feedback-total-box th {
  padding: 4px;
  border-right: 1px solid var(--feedback-line);
  border-bottom: 1px solid var(--feedback-line);
  font-size: .75rem;
}

.feedback-total-box td {
  padding: 9px 4px;
  border-right: 1px solid var(--feedback-line);
  font-size: 1.15rem;
}

.feedback-total-box th:last-child,
.feedback-total-box td:last-child {
  border-right: 0;
}

.feedback-score-box strong,
.feedback-fatigue-box strong {
  display: grid;
  place-items: center;
  min-height: 44px;
  font-size: 1.65rem;
  line-height: 1;
}

.feedback-score-box span,
.feedback-fatigue-box span {
  display: block;
  padding: 2px 5px 6px;
  text-align: center;
  font-size: .72rem;
  font-weight: 800;
}

.feedback-block-table-wrap {
  margin-top: 0;
}

.feedback-block-table th:first-child {
  width: 88px;
}

.feedback-block-table th:last-child {
  width: 116px;
}

.feedback-block-table thead th,
.feedback-block-table thead td {
  background: #fff;
  font-size: .88rem;
}

.feedback-block-table thead small {
  display: block;
  margin-top: 2px;
  font-size: .62rem;
  font-weight: 650;
}

.feedback-block-table tbody th {
  font-size: .78rem;
}

.feedback-block-table tbody td {
  font-size: .86rem;
}

.feedback-block-table td.is-review {
  background: #fff1a8;
  color: #5e4400;
  font-weight: 900;
}

.feedback-change-row th,
.feedback-change-row td {
  background: #eef7ff;
  color: #174d7d;
  font-size: .74rem !important;
  font-weight: 850;
}

.feedback-chart-section {
  min-height: 252px;
  padding: 5px 6px 0;
  border: 1.5px solid var(--feedback-line);
  border-top: 0;
}

.feedback-chart {
  display: block;
  width: 100%;
  height: auto;
  max-height: 252px;
}

.chart-grid {
  stroke: #d8dde2;
  stroke-width: 1;
}

.chart-axis {
  stroke: #78838d;
  stroke-width: 1.2;
}

.chart-axis-label,
.chart-axis-title,
.chart-value {
  fill: #24313c;
  font-family: Arial, sans-serif;
}

.chart-axis-label {
  font-size: 12px;
}

.chart-axis-title {
  font-size: 12px;
  font-weight: 700;
}

.chart-value {
  font-size: 12px;
  font-weight: 800;
}

.feedback-chart-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: -12px;
  padding-bottom: 4px;
  font-size: .75rem;
}

.feedback-chart-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.feedback-chart-legend i {
  display: inline-block;
  width: 20px;
  height: 5px;
  border-radius: 999px;
}

.feedback-chart-empty {
  display: grid;
  place-items: center;
  min-height: 240px;
  color: #617183;
}

.feedback-standards {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  margin-top: 6px;
}

.feedback-standards table + table {
  margin-left: -1.5px;
}

.feedback-standards caption {
  padding: 5px;
  border: 1.5px solid var(--feedback-line);
  border-bottom: 0;
  font-weight: 800;
}

.feedback-standards th,
.feedback-standards td {
  padding: 3px 5px;
  font-size: .72rem;
}

.feedback-commentary {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  margin-top: 6px;
  border: 1.5px solid var(--feedback-line);
}

.feedback-commentary > div {
  min-height: 88px;
  padding: 7px 9px;
  border-right: 1.5px solid var(--feedback-line);
}

.feedback-commentary > div:last-child {
  border-right: 0;
}

.feedback-commentary h4 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 4px;
  color: #174d7d;
  font-size: .72rem;
}

.feedback-commentary p {
  margin: 0;
  color: #222;
  font-size: .68rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.feedback-review-badge {
  padding: 2px 6px;
  border-radius: 999px;
  background: #ffd84d;
  color: #4e3800;
  font-size: .6rem;
}

.feedback-sheet-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 5px;
  color: #657789;
  font-size: .58rem;
}

.rating-elite,
.rating-outstanding {
  background: #0aade0 !important;
}

.rating-professional,
.rating-excellent {
  background: #05b35a !important;
}

.rating-semi-pro,
.rating-good {
  background: #fff200 !important;
}

.rating-amateur,
.rating-average {
  background: #ffb515 !important;
}

.rating-needs-work {
  background: #ff1d17 !important;
}

.rating-unrated {
  background: #e4e9ee !important;
}

body.sidebar-collapsed #openFeedback::after {
  content: "フィードバック";
  border-color: rgba(18,91,158,.2);
  background: #fff;
  color: #174d7d;
  box-shadow: 0 10px 28px rgba(24,76,126,.18);
}

@media (max-width:1080px) {
  .feedback-control-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
}

@media (max-width:760px) {
  .feedback-page-intro,
  .feedback-control-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .feedback-intro-actions {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
  }

  .feedback-control-grid,
  .feedback-notes-grid {
    grid-template-columns: 1fr;
  }

  .feedback-control-actions .button {
    width: 100%;
  }

  .feedback-sheet {
    min-width: 700px;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 6mm;
  }

  body.printing-feedback {
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
  }

  body.printing-feedback .app-sidebar,
  body.printing-feedback .app-header,
  body.printing-feedback .feedback-page > :not(.feedback-preview),
  body.printing-feedback .boot-recovery,
  body.printing-feedback dialog {
    display: none !important;
  }

  body.printing-feedback .app-shell,
  body.printing-feedback .app-main,
  body.printing-feedback .page-container,
  body.printing-feedback .feedback-page,
  body.printing-feedback .feedback-preview {
    display: block !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  body.printing-feedback .feedback-sheet {
    width: 198mm;
    min-width: 0;
    min-height: 284mm;
    margin: 0 auto;
    padding: 2mm;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
  }

  body.printing-feedback .feedback-sheet:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  body.printing-feedback .feedback-sheet-title {
    min-height: 16mm;
  }

  body.printing-feedback .feedback-sheet-brand strong {
    font-size: 20pt;
  }

  body.printing-feedback .feedback-chart-section {
    min-height: 61mm;
  }

  body.printing-feedback .feedback-chart {
    max-height: 60mm;
  }

  body.printing-feedback,
  body.printing-feedback .feedback-sheet {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* v50 must win over the legacy v49 rules above. */
.add-athlete-row {
  grid-template-columns: minmax(220px,1fr) minmax(170px,.5fr) auto;
}

.management-page .athlete-list-toolbar {
  grid-template-columns: auto minmax(90px,1fr) auto auto;
}

.feedback-report-v50 {
  width: min(100%,940px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 18px;
  background: #fff;
  color: var(--report-ink);
  box-shadow: 0 24px 60px rgba(13,54,91,.2);
  font-family:
    -apple-system, BlinkMacSystemFont, "Avenir Next", "Helvetica Neue",
    Arial, sans-serif;
}

.feedback-report-v50 .feedback-sheet-brand strong {
  color: #fff;
  font-family:
    "Arial Narrow", "Avenir Next Condensed", "Helvetica Neue", sans-serif;
  font-size: 1.36rem;
}

.feedback-report-v50 .feedback-chart-section {
  min-height: 0;
  padding: 0 0 3px;
  border: 1px solid var(--report-line);
}

.feedback-report-v50 .feedback-chart {
  max-height: 205px;
}

.feedback-report-v50 .feedback-commentary {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  margin: 0 16px 9px;
  border: 1px solid var(--report-line);
}

.feedback-report-v50 .feedback-comment h4 {
  color: #0b5b9d;
  font-size: .58rem;
}

.feedback-report-v50 .feedback-comment p {
  color: #273f55;
  font-size: .6rem;
  line-height: 1.48;
}

.feedback-report-v50 .feedback-sheet-footer {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto auto;
  padding: 7px 16px;
  background: #061c34;
  color: #bad8ed;
  font-size: .48rem;
}

@media (max-width:900px) {
  .management-page .athlete-list-toolbar {
    grid-template-columns: auto 1fr;
  }

  .management-page .athlete-sort-control,
  .management-page .athlete-bulk-delete {
    grid-column: 1 / -1;
  }
}

@media (max-width:700px) {
  .add-athlete-row {
    grid-template-columns: 1fr;
  }
}

@media print {
  body.printing-feedback .feedback-report-v50 {
    width: 198mm;
    min-height: 282mm;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  body.printing-feedback .feedback-report-v50 .feedback-report-hero {
    padding: 4mm 5mm 4.2mm;
  }

  body.printing-feedback .feedback-report-v50 .feedback-sheet-brand strong {
    font-size: 14pt;
  }

  body.printing-feedback .feedback-report-v50 .feedback-chart-section {
    min-height: 49mm;
  }

  body.printing-feedback .feedback-report-v50 .feedback-chart {
    max-height: 43mm;
  }

  body.printing-feedback .feedback-report-v50 .feedback-commentary {
    margin: 0 3.5mm 1.7mm;
  }

  body.printing-feedback .feedback-report-v50 .feedback-sheet-footer {
    padding: 1.8mm 3.5mm;
  }
}

/* ================================================================
   v51 athlete photo, unified typography, and Block decrease panel
   ================================================================ */
.feedback-report-v50 {
  font-family:
    -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

.feedback-report-v50 *,
.feedback-report-v50 .feedback-sheet-brand strong,
.feedback-report-v50 .chart-axis-label,
.feedback-report-v50 .chart-axis-title,
.feedback-report-v50 .chart-value {
  font-family: inherit !important;
}

.feedback-report-v50 .feedback-sheet-brand strong {
  font-size: 1.28rem;
  font-weight: 900;
  letter-spacing: .045em;
}

.feedback-athlete-identity {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 13px;
}

.feedback-athlete-photo {
  display: grid;
  flex: 0 0 76px;
  place-items: center;
  width: 76px;
  height: 76px;
  overflow: hidden;
  border: 3px solid rgba(255,255,255,.88);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%,#d8f4ff,#1777b8 72%);
  color: #fff;
  box-shadow:
    0 0 0 4px rgba(39,190,237,.22),
    0 10px 24px rgba(0,11,27,.32);
}

.feedback-athlete-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.feedback-athlete-photo span {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: .04em;
}

.feedback-athlete-identity > div:last-child {
  min-width: 0;
}

.feedback-athlete-identity h3 {
  overflow-wrap: anywhere;
}

.feedback-block-decrease-section {
  overflow: hidden;
}

.feedback-block-decrease-grid {
  display: grid;
  grid-template-columns: repeat(6,minmax(0,1fr));
  gap: 1px;
  background: #d6e5f1;
}

.feedback-block-decrease-item {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 51px;
  padding: 6px 4px;
  background: #f8fbfe;
}

.feedback-block-decrease-item::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: #19a86d;
  content: "";
}

.feedback-block-decrease-item.is-declined::before {
  background: #e27628;
}

.feedback-block-decrease-item span {
  color: #678198;
  font-size: .47rem;
  font-weight: 900;
  letter-spacing: .09em;
}

.feedback-block-decrease-item strong {
  margin-top: 2px;
  color: #0e6b55;
  font-size: .92rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.feedback-block-decrease-item.is-declined strong {
  color: #bc581c;
}

.feedback-block-decrease-item.feedback-total-decrease {
  background: #092c4e;
}

.feedback-block-decrease-item.feedback-total-decrease span {
  color: #92c8ed;
}

.feedback-block-decrease-item.feedback-total-decrease strong {
  color: #fff;
}

.feedback-report-v50 .feedback-chart {
  max-height: 178px;
}

@media (max-width:760px) {
  .feedback-athlete-photo {
    flex-basis: 70px;
    width: 70px;
    height: 70px;
  }
}

@media print {
  body.printing-feedback .feedback-report-v50 .feedback-athlete-photo {
    flex-basis: 18mm;
    width: 18mm;
    height: 18mm;
    border-width: .7mm;
  }

  body.printing-feedback .feedback-report-v50 .feedback-athlete-hero {
    margin-top: 2.2mm;
  }

  body.printing-feedback .feedback-report-v50 .feedback-block-decrease-item {
    min-height: 10.5mm;
  }

  body.printing-feedback .feedback-report-v50 .feedback-chart-section {
    min-height: 42mm;
  }

  body.printing-feedback .feedback-report-v50 .feedback-chart {
    max-height: 36mm;
  }
}

/* ================================================================
   v52 compact decrease row and transparent BlueRevs crest
   ================================================================ */
.feedback-report-v50 .feedback-sheet-brand img {
  width: 44px;
  height: 54px;
  padding: 0;
  object-fit: contain;
  background: transparent;
  border: 0;
}

.feedback-report-v50 .feedback-change-row th,
.feedback-report-v50 .feedback-change-row td {
  height: 40px;
}

.feedback-report-v50 .feedback-change-row th span {
  display: block;
  font-size: .42rem;
  letter-spacing: .055em;
  line-height: 1.08;
  white-space: normal;
}

.feedback-report-v50 .feedback-change-row th strong {
  display: block;
  margin-top: 3px;
  font-size: .48rem;
  line-height: 1.1;
  white-space: normal;
}

@media print {
  body.printing-feedback .feedback-report-v50 .feedback-sheet-brand img {
    width: 11mm;
    height: 13.5mm;
    padding: 0;
    background: transparent;
  }

  body.printing-feedback .feedback-report-v50 .feedback-change-row th,
  body.printing-feedback .feedback-report-v50 .feedback-change-row td {
    height: 10mm;
  }
}

/* ================================================================
   v53 light Block decrease row and single-line athlete name
   ================================================================ */
.feedback-report-v50 .feedback-athlete-identity {
  flex: 1 1 48%;
  max-width: 48%;
}

.feedback-report-v50 .feedback-athlete-identity > div:last-child {
  min-width: 0;
  flex: 1 1 auto;
}

.feedback-report-v50 .feedback-athlete-identity h3 {
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: normal;
  font-size: min(var(--athlete-name-size,2.2rem),clamp(1.2rem,2.25vw,2.2rem));
  line-height: 1.04;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: keep-all;
}

.feedback-report-v50 .feedback-athlete-hero dl {
  flex: 0 1 52%;
  min-width: 0;
  max-width: 52%;
  grid-template-columns: minmax(72px,.55fr) minmax(88px,.7fr) minmax(160px,1.6fr);
}

.feedback-report-v50 .feedback-block-table .feedback-change-row th,
.feedback-report-v50 .feedback-block-table .feedback-change-row td {
  background: #fff !important;
  color: #173f63 !important;
  border-top: 2px solid #4b91c8;
}

.feedback-report-v50 .feedback-block-table .feedback-change-row th {
  background: #eef6fd !important;
}

.feedback-report-v50 .feedback-block-table .feedback-change-row td:last-child {
  background: #f2f8fe !important;
}

.feedback-report-v50 .feedback-block-table .feedback-change-row th span,
.feedback-report-v50 .feedback-block-table .feedback-change-row th strong,
.feedback-report-v50 .feedback-block-table .feedback-change-row td strong,
.feedback-report-v50 .feedback-block-table .feedback-change-row td small {
  color: #173f63 !important;
}

.feedback-report-v50 .feedback-block-table .feedback-change-row td strong {
  color: #0b67ad !important;
}

@media (max-width:760px) {
  .feedback-report-v50 .feedback-athlete-identity {
    max-width: 50%;
  }

  .feedback-report-v50 .feedback-athlete-identity h3 {
    font-size: min(var(--athlete-name-size,1.55rem),clamp(1rem,3vw,1.55rem));
  }

  .feedback-report-v50 .feedback-athlete-hero dl {
    max-width: 50%;
  }
}

@media print {
  body.printing-feedback .feedback-report-v50 .feedback-athlete-identity h3 {
    max-width: 74mm;
    overflow: hidden;
    font-size: min(var(--athlete-name-size,1.5rem),18pt);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.printing-feedback .feedback-report-v50 .feedback-block-table .feedback-change-row th,
  body.printing-feedback .feedback-report-v50 .feedback-block-table .feedback-change-row td {
    background: #fff !important;
    color: #173f63 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body.printing-feedback .feedback-report-v50 .feedback-block-table .feedback-change-row th,
  body.printing-feedback .feedback-report-v50 .feedback-block-table .feedback-change-row td:last-child {
    background: #f2f8fe !important;
  }
}

/* ================================================================
   v55 featured leaderboard + FR / LOLF / BK rankings
   ================================================================ */
.leaderboard-control-grid {
  grid-template-columns: minmax(220px,1fr) minmax(160px,.6fr);
  max-width: 720px;
}

.leaderboard-grid,
.leaderboard-grid.is-single {
  display: block;
}

.leaderboard-featured {
  width: 100%;
}

.leaderboard-group-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 14px;
  margin-top: 16px;
  align-items: start;
}

.leaderboard-card-header {
  min-height: 92px;
}

.leaderboard-card.is-featured .leaderboard-card-header {
  min-height: 106px;
  padding: 18px 24px;
  background:
    radial-gradient(circle at 83% 20%,rgba(96,192,255,.42),transparent 30%),
    linear-gradient(120deg,#063865 0%,#086dad 58%,#0b8fc8 100%);
}

.leaderboard-card.is-featured .leaderboard-card-header h3 {
  font-size: 2.15rem;
}

.leaderboard-card-meta {
  display: grid;
  gap: 4px;
  justify-items: end;
  text-align: right;
}

.leaderboard-card-header .leaderboard-card-meta > strong {
  max-width: none;
  color: #fff;
  font-size: .69rem;
  letter-spacing: .06em;
}

.leaderboard-card-header .leaderboard-card-meta > span {
  opacity: .72;
  color: #fff;
  font-size: .58rem;
  font-weight: 900;
  letter-spacing: .08em;
}

.leaderboard-podium-list,
.leaderboard-standard-list,
.leaderboard-extra-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.leaderboard-podium-list .leaderboard-rank-row.is-podium {
  min-height: 91px;
  grid-template-columns: 34px 58px minmax(0,1fr) auto;
  padding: 12px;
}

.leaderboard-podium-list .leaderboard-athlete-photo {
  width: 58px;
  height: 58px;
  border-width: 3px;
}

.leaderboard-podium-list .leaderboard-athlete-copy strong {
  font-size: 1rem;
}

.leaderboard-podium-list .leaderboard-time strong {
  font-size: 1.18rem;
}

.leaderboard-card.is-featured .leaderboard-podium-list {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 12px;
  padding: 16px;
  background: #f3f8fd;
}

.leaderboard-card.is-featured .leaderboard-rank-row.is-podium {
  position: relative;
  display: grid;
  grid-template-areas:
    "photo photo"
    "name name"
    "time time";
  grid-template-columns: 1fr 1fr;
  justify-items: center;
  gap: 7px;
  min-height: 226px;
  padding: 15px 12px;
  border: 1px solid #c8dfef;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(22,75,111,.08);
  text-align: center;
}

.leaderboard-card.is-featured .leaderboard-rank-row.rank-1 {
  border-color: #e3bc42;
  background: linear-gradient(145deg,#fff8d5 0%,#fff 64%);
  box-shadow: 0 10px 24px rgba(177,126,0,.15);
}

.leaderboard-card.is-featured .leaderboard-rank-row.is-podium .leaderboard-rank-number {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 36px;
  height: 36px;
  font-size: 1rem;
}

.leaderboard-card.is-featured .leaderboard-rank-row.is-podium .leaderboard-athlete-photo {
  grid-area: photo;
  width: 94px;
  height: 94px;
  justify-self: center;
}

.leaderboard-card.is-featured .leaderboard-rank-row.is-podium .leaderboard-athlete-copy {
  grid-area: name;
  width: 100%;
}

.leaderboard-card.is-featured .leaderboard-rank-row.is-podium .leaderboard-athlete-copy strong {
  font-size: 1.2rem;
}

.leaderboard-card.is-featured .leaderboard-rank-row.is-podium .leaderboard-athlete-copy span {
  font-size: .72rem;
}

.leaderboard-card.is-featured .leaderboard-rank-row.is-podium .leaderboard-time {
  grid-area: time;
  text-align: center;
}

.leaderboard-card.is-featured .leaderboard-rank-row.is-podium .leaderboard-time strong {
  font-size: 1.7rem;
}

.leaderboard-card.is-featured .leaderboard-rank-row.is-podium .leaderboard-time span {
  font-size: .69rem;
}

.leaderboard-standard-list,
.leaderboard-extra-list {
  border-top: 1px solid #d9e8f3;
}

.leaderboard-rank-row.is-standard,
.leaderboard-rank-row.is-extra {
  min-height: 64px;
  grid-template-columns: 30px 44px minmax(0,1fr) auto;
  padding: 8px 12px;
}

.leaderboard-rank-row.is-standard .leaderboard-athlete-photo,
.leaderboard-rank-row.is-extra .leaderboard-athlete-photo {
  width: 44px;
  height: 44px;
}

.leaderboard-card.is-featured .leaderboard-standard-list,
.leaderboard-card.is-featured .leaderboard-extra-list {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
}

.leaderboard-card.is-featured .leaderboard-rank-row:nth-child(even) {
  border-left: 1px solid #e0ecf5;
}

.leaderboard-extra-list[hidden] {
  display: none !important;
}

.leaderboard-detail-area {
  border-top: 1px solid #d9e8f3;
  background: #f6faff;
}

.leaderboard-detail-area.is-expanded .leaderboard-extra-list {
  background: #fff;
}

.leaderboard-detail-button {
  display: block;
  width: calc(100% - 24px);
  min-height: 46px;
  margin: 11px 12px;
  border: 1px solid #75acda;
  border-radius: 12px;
  background: #e9f4fd;
  color: #0d5c96;
  font-size: .78rem;
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
}

.leaderboard-detail-button:active {
  transform: scale(.985);
}

.leaderboard-detail-area.is-expanded .leaderboard-detail-button {
  background: #dceefa;
}

@media (max-width:1100px) {
  .leaderboard-group-grid {
    gap: 10px;
  }

  .leaderboard-podium-list .leaderboard-rank-row.is-podium {
    grid-template-columns: 29px 49px minmax(0,1fr) auto;
    gap: 7px;
    padding-inline: 9px;
  }

  .leaderboard-podium-list .leaderboard-athlete-photo {
    width: 49px;
    height: 49px;
  }

  .leaderboard-podium-list .leaderboard-athlete-copy strong {
    font-size: .86rem;
  }

  .leaderboard-podium-list .leaderboard-time strong {
    font-size: 1rem;
  }
}

@media (max-width:900px) {
  .leaderboard-group-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width:760px) {
  .leaderboard-control-grid,
  .leaderboard-card.is-featured .leaderboard-podium-list,
  .leaderboard-card.is-featured .leaderboard-standard-list,
  .leaderboard-card.is-featured .leaderboard-extra-list {
    grid-template-columns: 1fr;
  }

  .leaderboard-card.is-featured .leaderboard-rank-row.is-podium {
    grid-template-areas: none;
    grid-template-columns: 34px 64px minmax(0,1fr) auto;
    justify-items: stretch;
    min-height: 96px;
    text-align: left;
  }

  .leaderboard-card.is-featured .leaderboard-rank-row.is-podium .leaderboard-rank-number,
  .leaderboard-card.is-featured .leaderboard-rank-row.is-podium .leaderboard-athlete-photo,
  .leaderboard-card.is-featured .leaderboard-rank-row.is-podium .leaderboard-athlete-copy,
  .leaderboard-card.is-featured .leaderboard-rank-row.is-podium .leaderboard-time {
    align-self: center;
    justify-self: stretch;
    transform: none;
  }

  .leaderboard-card.is-featured .leaderboard-rank-row.is-podium .leaderboard-rank-number {
    position: static;
    grid-area: auto;
  }

  .leaderboard-card.is-featured .leaderboard-rank-row.is-podium .leaderboard-athlete-photo,
  .leaderboard-card.is-featured .leaderboard-rank-row.is-podium .leaderboard-athlete-copy,
  .leaderboard-card.is-featured .leaderboard-rank-row.is-podium .leaderboard-time {
    grid-area: auto;
  }

  .leaderboard-card.is-featured .leaderboard-rank-row.is-podium .leaderboard-athlete-photo {
    width: 64px;
    height: 64px;
  }

  .leaderboard-card.is-featured .leaderboard-rank-row.is-podium .leaderboard-time {
    text-align: right;
  }

  .leaderboard-card.is-featured .leaderboard-rank-row:nth-child(even) {
    border-left: 0;
  }
}

/* v56 final leaderboard overrides */
.leaderboard-control-grid {
  grid-template-columns: minmax(210px,1fr) minmax(140px,.55fr) minmax(250px,1.15fr);
  max-width: 980px;
}

.leaderboard-card-header h3,
.leaderboard-card.is-featured .leaderboard-card-header h3 {
  color: #fff !important;
  -webkit-text-fill-color: #fff;
  text-shadow: 0 2px 8px rgba(0,31,61,.22);
}

.leaderboard-time strong small {
  white-space: nowrap;
}

@media (max-width:900px) {
  .leaderboard-control-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }

  .leaderboard-control-grid .field:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width:760px) {
  .leaderboard-control-grid,
  .leaderboard-control-grid .field:last-child {
    grid-template-columns: 1fr;
    grid-column: auto;
  }
}

/* ================================================================
   v57 Performance Set-only feedback report
   ================================================================ */
.performance-set-report {
  --performance-blue: #0878df;
  --performance-cyan: #20c3ea;
  --performance-navy: #061d36;
  --performance-ice: #edf7ff;
}

.performance-set-report .performance-set-hero {
  background:
    radial-gradient(circle at 77% -45%,rgba(61,210,244,.58),transparent 43%),
    linear-gradient(118deg,#04162b 0%,#073b6b 62%,#0878bd 100%);
}

.performance-set-report .performance-set-hero::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 7px;
  background: linear-gradient(180deg,#20c3ea,#0878df);
  content: "";
}

.performance-set-tag strong {
  background: #fff;
  color: #075b9c;
}

.performance-set-kpis {
  display: grid;
  grid-template-columns: 1.18fr 1fr 1fr 1.08fr;
  gap: 9px;
  padding: 13px 16px 10px;
  background: #f4f9fe;
}

.performance-set-kpi {
  position: relative;
  display: grid;
  align-content: center;
  min-height: 82px;
  padding: 10px 12px;
  overflow: hidden;
  border: 1px solid #d5e6f3;
  border-top: 5px solid var(--rating-color,#1689ce);
  border-radius: 12px;
  background: #fff;
}

.performance-set-kpi::after {
  position: absolute;
  right: -22px;
  bottom: -31px;
  width: 76px;
  height: 76px;
  border: 13px solid rgba(8,120,223,.06);
  border-radius: 50%;
  content: "";
}

.performance-set-kpi.is-primary {
  border-top-color: #0878df;
  background: linear-gradient(135deg,#fff 20%,#e9f6ff 100%);
}

.performance-set-kpi.is-decrease {
  border-top-color: #20a9d3;
}

.performance-set-kpi > span {
  color: #5c7891;
  font-size: .49rem;
  font-weight: 950;
  letter-spacing: .12em;
}

.performance-set-kpi > strong {
  position: relative;
  z-index: 1;
  margin: 4px 0 2px;
  color: #093d69;
  font-size: 1.72rem;
  font-variant-numeric: tabular-nums;
  font-weight: 950;
  letter-spacing: -.035em;
  line-height: 1;
}

.performance-set-kpi > strong small {
  margin-left: 3px;
  color: #4f718c;
  font-size: .55rem;
  letter-spacing: 0;
}

.performance-set-kpi > strong.performance-set-rating {
  color: var(--rating-color,#0a639f);
  font-size: clamp(1rem,2vw,1.38rem);
  letter-spacing: -.015em;
}

.performance-set-kpi > em {
  color: #6f879c;
  font-size: .45rem;
  font-style: normal;
  font-weight: 900;
  letter-spacing: .08em;
}

.performance-set-insights {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  margin: 0 16px 10px;
  overflow: hidden;
  border: 1px solid #d4e4f0;
  border-radius: 10px;
  background: #fff;
}

.performance-set-insights > div {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px 10px;
  border-right: 1px solid #dce8f1;
}

.performance-set-insights > div:last-child {
  border-right: 0;
}

.performance-set-insights > div.has-review {
  background: #fff7d7;
}

.performance-set-insights span {
  color: #6a8297;
  font-size: .43rem;
  font-weight: 950;
  letter-spacing: .1em;
}

.performance-set-insights strong {
  overflow: hidden;
  color: #173f63;
  font-size: .64rem;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.performance-block-section {
  overflow: hidden;
}

.performance-block-grid {
  display: grid;
  grid-template-columns: repeat(var(--feedback-block-count,5),minmax(0,1fr));
  gap: 7px;
  padding: 9px;
  background: #f5f9fd;
}

.performance-block-card {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0,1fr);
  grid-template-rows: auto auto auto;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #cfe0ed;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(17,74,119,.07);
}

.performance-block-card.is-fastest {
  border-color: #168fd0;
  box-shadow: 0 0 0 2px rgba(17,144,209,.12);
}

.performance-block-card.is-review {
  border-color: #dbb025;
  background: #fffdf3;
}

.performance-block-card > header {
  grid-row: 1 / 3;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 8px 5px;
  background: linear-gradient(180deg,#0a6caf,#084b7d);
  color: #fff;
}

.performance-block-card > header span,
.performance-block-card > header small {
  color: #ccecff;
  font-size: .39rem;
  font-weight: 900;
  letter-spacing: .08em;
}

.performance-block-card > header strong {
  margin: 2px 0;
  color: #fff;
  font-size: 1.45rem;
  font-weight: 950;
  line-height: 1;
}

.performance-block-value {
  display: grid;
  align-content: center;
  min-height: 52px;
  padding: 7px 8px;
  border-bottom: 1px solid #dce8f1;
}

.performance-block-value.is-per-rep {
  background: #edf7ff;
}

.performance-block-value > span,
.performance-block-card > footer span {
  color: #6a8297;
  font-size: .39rem;
  font-weight: 950;
  letter-spacing: .075em;
}

.performance-block-value > strong {
  margin-top: 2px;
  color: #123e64;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.performance-block-value.is-per-rep > strong {
  color: #0876bc;
}

.performance-block-value > strong small {
  margin-left: 2px;
  color: #70869a;
  font-size: .42rem;
}

.performance-block-card > footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
  padding: 5px 8px;
  background: #fff;
}

.performance-block-card > footer strong {
  color: #0a639f;
  font-size: .63rem;
  font-variant-numeric: tabular-nums;
}

.performance-block-best,
.performance-block-review {
  position: absolute;
  top: 4px;
  right: 5px;
  padding: 2px 4px;
  border-radius: 999px;
  background: #dff4ff;
  color: #086da9;
  font-size: .33rem;
  font-style: normal;
  font-weight: 950;
  letter-spacing: .05em;
}

.performance-block-review {
  top: auto;
  right: 5px;
  bottom: 31px;
  background: #ffe07a;
  color: #644800;
}

.performance-set-chart-section .feedback-chart {
  max-height: 183px;
}

.performance-set-commentary {
  grid-template-columns: 1.35fr 1fr 1fr !important;
}

.performance-set-guide > div:last-child {
  background: #e8f5ff;
}

@media (max-width:760px) {
  .performance-set-report {
    min-width: 760px;
  }
}

@media print {
  body.printing-feedback .performance-set-report .performance-set-kpis {
    gap: 2mm;
    padding: 2.8mm 3.5mm 2mm;
  }

  body.printing-feedback .performance-set-report .performance-set-kpi {
    min-height: 19mm;
    padding: 2.2mm 2.5mm;
  }

  body.printing-feedback .performance-set-report .performance-set-kpi > strong {
    font-size: 17pt;
  }

  body.printing-feedback .performance-set-report .performance-set-insights {
    margin: 0 3.5mm 2mm;
  }

  body.printing-feedback .performance-set-report .performance-block-grid {
    gap: 1.5mm;
    padding: 2mm;
  }

  body.printing-feedback .performance-set-report .performance-block-card {
    grid-template-columns: 11mm minmax(0,1fr);
  }

  body.printing-feedback .performance-set-report .performance-block-value {
    min-height: 11mm;
    padding: 1.4mm;
  }

  body.printing-feedback .performance-set-report .performance-set-chart-section {
    min-height: 41mm;
  }

  body.printing-feedback .performance-set-report .performance-set-chart-section .feedback-chart {
    max-height: 35mm;
  }
}

/* ================================================================
   v59 AST / AST-BK feedback and leaderboard switching
   ================================================================ */
.leaderboard-control-grid {
  grid-template-columns:
    minmax(150px,.7fr)
    minmax(200px,1fr)
    minmax(120px,.55fr)
    minmax(240px,1.15fr);
  max-width: 1160px;
}

.leaderboard-summary {
  grid-template-columns: repeat(5,minmax(0,1fr));
}

@media (max-width:900px) {
  .leaderboard-control-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }

  .leaderboard-control-grid .field:last-child {
    grid-column: auto;
  }

  .leaderboard-summary {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
}

/* ================================================================
   v60 feedback report cleanup and unified table system
   ================================================================ */
.feedback-report-v50 {
  --feedback-table-line: #bfd4e4;
  --feedback-table-strong: #86afd0;
  border: 1px solid #bed5e7;
  background: #f7fbff;
  box-shadow: 0 26px 68px rgba(8,49,84,.22);
}

.feedback-report-v50 .feedback-report-hero {
  border-bottom: 4px solid #20bde8;
}

.feedback-report-v50 .feedback-kpi-grid,
.feedback-report-v50 .performance-set-kpis {
  background:
    linear-gradient(180deg,#f8fcff 0%,#edf6fd 100%);
}

.feedback-report-v50 .feedback-section {
  overflow: hidden;
  border: 1px solid var(--feedback-table-line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(11,76,123,.06);
}

.feedback-report-v50 .feedback-section-heading {
  min-height: 40px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--feedback-table-line);
  background: linear-gradient(90deg,#f0f8fe 0%,#fff 72%);
}

.feedback-report-v50 .feedback-section-heading h4 {
  color: #073f70;
  font-size: .75rem;
  letter-spacing: .08em;
}

.feedback-report-v50 .feedback-section-heading p {
  color: #5d7890;
  font-size: .55rem;
}

.feedback-report-v50 .feedback-block-table {
  width: 100%;
  border: 0;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
}

.feedback-report-v50 .feedback-block-table thead th,
.feedback-report-v50 .feedback-block-table tbody th,
.feedback-report-v50 .feedback-block-table tbody td {
  box-sizing: border-box;
  border-top: 0 !important;
  border-right: 1px solid var(--feedback-table-line) !important;
  border-bottom: 1px solid var(--feedback-table-line) !important;
  border-left: 0 !important;
  vertical-align: middle;
}

.feedback-report-v50 .feedback-block-table thead th {
  height: 47px;
  background: #edf6fd;
  color: #153f62;
}

.feedback-report-v50 .feedback-block-table thead th:first-child {
  background: #e3f0fa;
}

.feedback-report-v50 .feedback-block-table thead th:last-child {
  border-right: 0 !important;
  background: #e3f0fa;
}

.feedback-report-v50 .feedback-block-table tbody tr.feedback-block-time-row td:last-child,
.feedback-report-v50 .feedback-block-table tbody tr.feedback-change-row td:last-child {
  border-right: 0 !important;
}

.feedback-report-v50 .feedback-block-table tbody tr.feedback-per-rep-row td:last-child {
  border-right: 1px solid var(--feedback-table-line) !important;
}

.feedback-report-v50 .feedback-block-table tbody tr:last-child th,
.feedback-report-v50 .feedback-block-table tbody tr:last-child td {
  border-bottom: 0 !important;
}

.feedback-report-v50 .feedback-block-table tbody th {
  background: #f7fbfe;
}

.feedback-report-v50 .feedback-block-table .feedback-per-rep-row th,
.feedback-report-v50 .feedback-block-table .feedback-per-rep-row td {
  background: #f3f9fe;
}

.feedback-report-v50 .feedback-block-table .feedback-drop-cell {
  background: #eaf5fd;
}

.feedback-report-v50 .feedback-block-table .feedback-change-row th,
.feedback-report-v50 .feedback-block-table .feedback-change-row td,
.feedback-report-v50 .feedback-block-table .feedback-change-row td:last-child {
  height: 40px;
  border-top: 0 !important;
  background: #edf6fd !important;
  color: #173f63 !important;
}

.feedback-report-v50 .feedback-block-table .feedback-change-row th {
  box-shadow: inset 4px 0 0 #1689ce;
}

.feedback-report-v50 .feedback-block-table td.is-review {
  background: #fff2b8 !important;
  box-shadow: inset 0 0 0 1px #e4be3d;
}

.feedback-report-v50 .performance-block-grid {
  gap: 8px;
  padding: 10px;
  background: linear-gradient(180deg,#f5fafe,#edf5fb);
}

.feedback-report-v50 .performance-block-card {
  border: 1px solid var(--feedback-table-line);
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(10,67,109,.08);
}

.feedback-report-v50 .performance-block-value {
  border-bottom: 1px solid var(--feedback-table-line);
  border-left: 1px solid var(--feedback-table-line);
}

.feedback-report-v50 .performance-block-card > footer {
  border-top: 1px solid var(--feedback-table-line);
}

.feedback-report-v50 .feedback-chart-section {
  min-height: 0;
  background: #fff;
}

.feedback-report-v50 .feedback-chart {
  max-height: 220px;
}

.feedback-report-v50.performance-set-report .feedback-chart {
  max-height: 205px;
}

.feedback-report-v50 .feedback-rating-guide {
  gap: 10px;
  margin: 0 16px 11px;
}

.feedback-report-v50 .feedback-rating-guide > div {
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid #c8ddea;
  border-left: 4px solid #1689ce;
  border-radius: 9px;
  background: #fff;
}

.feedback-report-v50 .feedback-rating-guide strong {
  color: #075c9d;
  font-size: .5rem;
}

.feedback-report-v50 .feedback-rating-guide span {
  color: #506c84;
  font-size: .48rem;
  line-height: 1.45;
}

.feedback-report-v50 .feedback-sheet-footer {
  border-top: 1px solid #163f63;
}

@media print {
  body.printing-feedback .feedback-report-v50 {
    border: 0;
    background: #fff;
    box-shadow: none;
  }

  body.printing-feedback .feedback-report-v50 .feedback-section,
  body.printing-feedback .feedback-report-v50 .performance-block-card,
  body.printing-feedback .feedback-report-v50 .feedback-rating-guide > div {
    break-inside: avoid;
    page-break-inside: avoid;
    box-shadow: none;
  }

  body.printing-feedback .feedback-report-v50 .feedback-block-table thead th,
  body.printing-feedback .feedback-report-v50 .feedback-block-table tbody th,
  body.printing-feedback .feedback-report-v50 .feedback-block-table tbody td {
    border-color: var(--feedback-table-line) !important;
  }

  body.printing-feedback .feedback-report-v50 .feedback-chart-section {
    min-height: 49mm;
  }

  body.printing-feedback .feedback-report-v50 .feedback-chart {
    max-height: 43mm;
  }

  body.printing-feedback .feedback-report-v50.performance-set-report .feedback-chart-section {
    min-height: 44mm;
  }

  body.printing-feedback .feedback-report-v50.performance-set-report .feedback-chart {
    max-height: 38mm;
  }
}

@media (max-width:760px) {
  .leaderboard-control-grid,
  .leaderboard-summary {
    grid-template-columns: 1fr;
  }
}

/* ================================================================
   v61 Performance Set block table
   ================================================================ */
.feedback-report-v50 .performance-set-table-wrap {
  overflow: hidden;
  background: #fff;
}

.feedback-report-v50 .performance-set-block-table .feedback-measure-head {
  width: 118px;
}

.feedback-report-v50 .performance-set-block-table .feedback-drop-head {
  width: 112px;
}

.feedback-report-v50 .performance-set-block-table thead th {
  height: 52px;
}

.feedback-report-v50 .performance-set-block-table thead th strong {
  font-size: 1rem;
}

.feedback-report-v50 .performance-set-block-table tbody th,
.feedback-report-v50 .performance-set-block-table tbody td {
  height: 42px;
  padding: 6px 7px;
}

.feedback-report-v50 .performance-set-block-table tbody td strong {
  color: #153f62;
  font-size: .85rem;
}

.feedback-report-v50 .performance-set-block-table .feedback-per-rep-row td strong {
  color: #0875bd;
  font-size: .92rem;
}

.feedback-report-v50 .performance-set-block-table td.is-fastest {
  position: relative;
  background: #e7f6ff !important;
  box-shadow: inset 0 3px 0 #1597d2;
}

.feedback-report-v50 .performance-set-block-table td.is-fastest strong {
  color: #05669f;
}

.feedback-report-v50 .performance-set-block-table td.is-fastest em {
  display: block;
  margin-top: 2px;
  color: #0584bd;
  font-size: .35rem;
  font-style: normal;
  font-weight: 950;
  letter-spacing: .08em;
}

.feedback-report-v50 .performance-set-block-table .performance-set-change-row th,
.feedback-report-v50 .performance-set-block-table .performance-set-change-row td {
  height: 43px;
  background: #edf6fd !important;
}

.feedback-report-v50 .feedback-block-table tbody tr.performance-set-change-row td:last-child {
  border-right: 1px solid var(--feedback-table-line) !important;
}

.feedback-report-v50 .performance-set-block-table .performance-set-change-row td strong {
  color: #0b67ad !important;
  font-size: .78rem;
}

.feedback-report-v50 .performance-set-block-table .performance-set-drop-cell {
  border-right: 0 !important;
  border-bottom: 0 !important;
  background: linear-gradient(145deg,#e8f5fd,#f7fbff);
}

.feedback-report-v50 .performance-set-block-table .performance-set-drop-cell strong {
  color: #075f9f;
  font-size: 1rem;
}

.feedback-report-v50 .performance-set-block-table .performance-set-drop-cell small {
  color: #5e7d96;
  font-size: .42rem;
  font-weight: 900;
  white-space: nowrap;
}

.feedback-report-v50 .performance-set-block-table td.is-review {
  background: #fff2b8 !important;
  box-shadow: inset 0 0 0 1px #e4be3d;
}

@media print {
  body.printing-feedback .feedback-report-v50 .performance-set-block-table thead th {
    height: 11mm;
  }

  body.printing-feedback .feedback-report-v50 .performance-set-block-table tbody th,
  body.printing-feedback .feedback-report-v50 .performance-set-block-table tbody td {
    height: 10mm;
    padding: 1.2mm 1.5mm;
  }

  body.printing-feedback .feedback-report-v50 .performance-set-block-table td.is-fastest {
    box-shadow: inset 0 .7mm 0 #1597d2;
  }
}
