.spreadsheet-page-root,
.spreadsheet-page {
  height: 100vh;
  overflow: hidden;
}

.spreadsheet-page .app-shell {
  max-width: none;
  height: 100vh;
  padding: 0.7rem 0.9rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.spreadsheet-page .panel,
.spreadsheet-page .sheet-panel,
.spreadsheet-page .sheet-wrap {
  min-height: 0;
}

.spreadsheet-page .app-nav,
.spreadsheet-page .hero {
  flex: 0 0 auto;
  transition:
    max-height 180ms ease,
    margin 180ms ease,
    opacity 140ms ease,
    transform 180ms ease;
}

.spreadsheet-page .hero {
  margin-bottom: 0.5rem;
  align-items: center;
}

.spreadsheet-page .hero h1 {
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1;
}

.spreadsheet-page .eyebrow {
  margin-bottom: 0.15rem;
  font-size: 0.62rem;
}

.spreadsheet-page .lede {
  max-width: none;
  font-size: 0.85rem;
}

.sheet-panel {
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.sheet-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  align-items: end;
  transition:
    max-height 180ms ease,
    margin 180ms ease,
    opacity 140ms ease,
    transform 180ms ease;
}

.sheet-filters label {
  gap: 0.2rem;
  font-size: 0.78rem;
}

.sheet-filters input,
.sheet-filters select {
  padding: 0.5rem 0.7rem;
  border-radius: 0.7rem;
}

.sheet-actions {
  display: flex;
  align-items: end;
}

.sheet-actions button {
  width: 100%;
  border: 1px solid rgba(20, 33, 61, 0.15);
  border-radius: 0.7rem;
  padding: 0.55rem 0.8rem;
  background: linear-gradient(135deg, #14213d, #243b67);
  color: #fffaf0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.sheet-summary {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  flex: 0 0 auto;
  transition:
    max-height 180ms ease,
    margin 180ms ease,
    opacity 140ms ease,
    transform 180ms ease;
}

.sheet-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(5.2rem, 1fr));
  gap: 0.45rem;
}

.spreadsheet-page .sheet-summary .summary-card {
  padding: 0.6rem 0.7rem;
}

.spreadsheet-page .sheet-summary .summary-card span {
  font-size: 0.74rem;
}

.spreadsheet-page .sheet-summary .summary-card strong {
  font-size: 1.05rem;
}

.sheet-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.84);
  flex: 1 1 auto;
  min-height: 0;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
  transition: border-radius 180ms ease, box-shadow 180ms ease;
}

.sheet-wrap:focus {
  outline: none;
}

.spreadsheet-page.sheet-immersive .app-nav,
.spreadsheet-page.sheet-immersive .hero,
.spreadsheet-page.sheet-immersive .sheet-filters,
.spreadsheet-page.sheet-immersive .sheet-summary {
  max-height: 0;
  margin: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translateY(-0.5rem);
}

.spreadsheet-page.sheet-immersive .sheet-panel {
  gap: 0;
  padding-top: 0;
}

.spreadsheet-page.sheet-immersive .sheet-wrap {
  border-radius: 0.85rem;
  box-shadow: 0 10px 24px rgba(20, 33, 61, 0.08);
}

.sheet-table {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
}

.sheet-table th,
.sheet-table td {
  border: 1px solid rgba(215, 207, 190, 0.75);
  padding: 0.55rem 0.65rem;
  text-align: center;
  white-space: nowrap;
  position: relative;
}

.sheet-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f8f3e8;
}

.sheet-table .sticky-col-1,
.sheet-table .sticky-col-2 {
  position: sticky;
  background: #fffdf8;
  z-index: 2;
  text-align: left;
}

.sheet-table .sticky-col-1 {
  left: 0;
  min-width: 13rem;
  box-shadow: 1px 0 0 rgba(215, 207, 190, 0.9);
}

.sheet-table .sticky-col-2 {
  left: 13rem;
  min-width: 11rem;
  box-shadow: 1px 0 0 rgba(215, 207, 190, 0.9);
}

.sheet-table thead .sticky-col-1,
.sheet-table thead .sticky-col-2 {
  z-index: 4;
  background: #f8f3e8;
}

.sheet-label-standard {
  font-weight: 700;
}

.sheet-athlete-row th,
.sheet-athlete-row td {
  border-top: 3px solid #111;
}

.sheet-table .sheet-athlete-name {
  background: #111;
  color: #fff;
  font-weight: 700;
  z-index: 5;
}

.sheet-table .sheet-best-label {
  background: #111;
  color: #fff;
  font-weight: 700;
  z-index: 5;
}

.sheet-meet-label {
  background: rgba(20, 33, 61, 0.05);
  font-weight: 600;
}

.sheet-meet-row-inactive th,
.sheet-meet-row-inactive td {
  background: rgba(20, 33, 61, 0.045);
  color: rgba(20, 33, 61, 0.45);
}

.sheet-meet-row-inactive .sheet-meet-label,
.sheet-meet-row-inactive .sticky-col-1 {
  background: rgba(20, 33, 61, 0.06);
}

.sheet-meet-row-inactive .sheet-empty-cell {
  background: rgba(20, 33, 61, 0.055);
}

.sheet-cut-label {
  background: rgba(20, 33, 61, 0.04);
}

.sheet-cut-row.cutoff-regional .sheet-cut-label,
.sheet-cut-row.cutoff-regional .sheet-time {
  color: #6e4f1f;
  background: #f6ead1;
  font-style: italic;
}

.sheet-cut-row.cutoff-age-group .sheet-cut-label,
.sheet-cut-row.cutoff-age-group .sheet-time {
  color: #624600;
  background: #fff1a8;
  font-weight: 800;
}

.sheet-empty-cell {
  background: rgba(20, 33, 61, 0.03);
}

.sheet-time.standard-b {
  background: #f1c9d2;
}

.sheet-time.standard-bb {
  background: #f8edc6;
}

.sheet-time.standard-a {
  background: #d9e7c8;
}

.sheet-time.standard-aa {
  background: #d6e4f1;
}

.sheet-time.standard-aaa {
  background: #cdc5df;
}

.sheet-time.standard-aaaa {
  background: #cfcfcf;
}

.sheet-time.cell-regional {
  font-style: italic;
}

.sheet-time.cell-age-group {
  font-weight: 800;
}

.sheet-selected-cell {
  box-shadow: inset 0 0 0 2px #2f6bff;
  z-index: 1;
}

.sheet-selected-cell::after {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1px solid rgba(47, 107, 255, 0.3);
  pointer-events: none;
}

@media (max-width: 980px) {
  .spreadsheet-page-root,
  .spreadsheet-page {
    height: auto;
    overflow: auto;
  }

  .spreadsheet-page .app-shell {
    height: auto;
    overflow: visible;
  }

  .sheet-panel {
    min-height: 70vh;
  }

  .sheet-filters,
  .sheet-summary,
  .sheet-summary-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .sheet-actions {
    align-items: stretch;
  }
}
