/* ---- Series Results (scroll-first layout) ---- */
:root {
  --sr-font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --sr-text: #111;
  --sr-muted: #666;
  --sr-border: #ccc;
  --sr-bg: #fff;
  --sr-head-bg-1: #fdfdfd; /* dates row */
  --sr-head-bg-2: #fafafa; /* race names row */
  --sr-head-h1: 30px;  /* dates row height */
  --sr-head-h2: 34px;  /* race names row height */
  
}


html, body { height: 100%; }
body.series-page {
  margin: 0;
  font-family: var(--sr-font);
  color: var(--sr-text);
  background: var(--sr-bg);
  display: flex;
  flex-direction: column;
}

/* Header bar */
.sr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--sr-border);
  background: #fff;
  position: sticky; top: 0; z-index: 20;
}
.sr-title { margin: 0; font-size: 18px; font-weight: 600; }
.sr-actions { display: inline-flex; gap: 8px; }
.sr-btn {
  appearance: none;
  border: 1px solid var(--sr-border);
  background: #f6f6f6;
  color: #000;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
}
.sr-btn:hover { background: #eaeaea; }

/* Read-only controls (e.g., Discards: 2) */
.sr-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--sr-border);
  background: #fff;
}
.sr-controls .sr-label { color: var(--sr-muted); }

/* SCROLL AREA:
   Fill remaining viewport; both axes scroll as needed */
.sr-table-wrap {
  flex: 1 1 auto;
  min-height: 0;              /* required for overflow in flex layouts */
  overflow: auto;             /* vertical & horizontal scroll */
}

/* Table: keep type size readable; don’t shrink further */
.sr-table {
  width: max-content;         /* grow to fit columns; triggers horizontal scroll */
  min-width: 100%;            /* at least full viewport width */
  border-collapse: separate;  /* better with sticky col borders */
  border-spacing: 0;
  table-layout: fixed;        /* predictable column widths */
  font-size: 14px;            /* fixed, doesn’t shrink */
}

/* Cells: compact but readable */
.sr-table th,
.sr-table td {
  padding: 6px 8px;           /* a bit more than ultra-dense */
  border-bottom: 1px solid var(--sr-border);
  border-right: 1px solid var(--sr-border);
  white-space: nowrap;
}
.sr-table th:last-child,
.sr-table td:last-child { border-right: none; }

/* Sticky headers (two rows) */
.sr-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  text-align: center;
  color: #000;
  background: var(--sr-head-bg-2);
}
.sr-table thead tr:first-child th {
  background: var(--sr-head-bg-1);
  font-weight: 500;
  color: var(--sr-muted);
}

/* Optional: Sticky first column (Helm) */
.sr-sticky-col {
  position: sticky;
  left: 0;
  z-index: 6;                 /* above header cells */
  background: #fff;           /* solid bg to cover content beneath */
  border-right: 1px solid var(--sr-border);
}

/* Alignments */
.sr-td--score { text-align: center; }
.sr-td--total, .sr-td--nett { text-align: right; font-weight: 600; }

/* Hover row */
.sr-table tbody tr:hover { background: #fcfcfc; }

/* Print: keep headers on each page and allow wide output */
@media print {
  .sr-header, .sr-controls { display: none !important; }
  .sr-table { font-size: 11px; width: 100%; }
  .sr-table thead { display: table-header-group; }
  .sr-table th, .sr-table td { padding: 3px 6px; }
}
/* Normalize header cell heights */
.sr-table thead th {
  height: var(--sr-head-h2);      /* default for row 2 */
  line-height: var(--sr-head-h2);
  padding: 0 8px;                 /* keep compact while ensuring fixed height */
}

/* Row 1 (dates) */
.sr-table thead tr:first-child th {
  position: sticky;
  top: 0;
  z-index: 7;                     /* above row 2 */
  background: var(--sr-head-bg-1);
  font-weight: 500;
  color: var(--sr-muted);
  height: var(--sr-head-h1);
  line-height: var(--sr-head-h1);
}

/* Row 2 (race names) */
.sr-table thead tr:nth-child(2) th {
  position: sticky;
  top: var(--sr-head-h1);         /* sit directly beneath dates row */
  z-index: 6;
  background: var(--sr-head-bg-2);
  font-weight: 600;
  color: #000;
}

/* Base sticky col for all first-column cells */
.sr-sticky-col {
  position: sticky;
  left: 0;
  background: #fff;               /* cover scrolled content underneath */
  z-index: 8;                     /* above body cells, below top date row */
  border-right: 1px solid var(--sr-border);
}

/* First column in header row 1 (dates) */
.sr-table thead tr:first-child th.sr-sticky-col {
  top: 0;
  z-index:  nine;                 /* above row-2 header and other cells */
  background: var(--sr-head-bg-1);
}

/* First column in header row 2 (race names) */
.sr-table thead tr:nth-child(2) th.sr-sticky-col {
  top: var(--sr-head-h1);         /* sits under dates row */
  z-index: 9;                     /* above body cells */
  background: var(--sr-head-bg-2);
}

/* Optional: subtle shadow to indicate stickiness */
.sr-sticky-col {
  box-shadow: 2px 0 4px rgba(0,0,0,0.05);
}

/* Keep alignment consistent for Helm cells */
.sr-td--helm { font-weight: 600; }