:root {
  --border-color: #d9d9d9;
  --header-bg: #f5f5f5;

  --grade-a-bg: #1a9850;
  --grade-b-bg: #feebc0;
  --grade-c-bg: #ffd5bb;
  --grade-d-bg: #fbbdb7;
  --grade-f-bg: #d73027;

  --grade-b-text: #895e01;
  --grade-c-text: #9c4007;
  --grade-d-text: #a61508;

  --grade-light-text: #ffffff;
}

body {
  margin: 0;
  font-family: 'Satoshi', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial,
    sans-serif;
  font-size: 14px;
  color: #332e2e;
}

.table-scroll {
  max-width: 1300px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.scorecard {
  border-collapse: collapse;
  table-layout: fixed;
  width: 100%;
  min-width: 1150px;
}

.scorecard th,
.scorecard td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

.scorecard td {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scorecard thead th {
  background: var(--header-bg);
  cursor: pointer;
  user-select: none;
  white-space: normal;
  position: sticky;
  top: 0;
  z-index: 2;
}

.scorecard thead th:hover {
  background: #ececec;
}

.scorecard thead th sub {
  font-size: 0.65em;
  line-height: 0;
  position: relative;
  bottom: -0.25em;
  vertical-align: baseline;
}

.scorecard thead th::after {
  content: '';
  display: inline-block;
  width: 0.7em;
  margin-left: 4px;
  font-size: 0.7em;
  opacity: 0.4;
  position: relative;
  top: -1px;
}

.scorecard thead th.sort-asc::after {
  content: '▲';
  opacity: 1;
}

.scorecard thead th.sort-desc::after {
  content: '▼';
  opacity: 1;
}

/* Numeric headers keep the arrow after the label (like other columns), so
   the label+arrow group hugs the header's right edge and the label text
   itself sits one arrow-width short of it. Numeric body cells get matching
   extra right padding below so the numbers meet the label at that same
   position instead of the cell's outer edge. */
.scorecard td.col-numeric {
  padding-right: 26px;
}

.scorecard tbody td:not(.grade-cell) {
  background: #ffffff;
}

.scorecard td:first-child,
.scorecard th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  box-shadow: 1px 0 0 var(--border-color);
}

.scorecard tbody td:first-child {
  background: #ffffff;
}

.scorecard thead th:first-child {
  z-index: 3;
  background: var(--header-bg);
}

.scorecard th.col-numeric,
.scorecard td.col-numeric {
  text-align: right;
}

.scorecard th.col-center,
.scorecard td.col-center {
  text-align: center;
}

.scorecard td.grade-cell {
  font-weight: 600;
}

/* Fixed-width letter + arrow slots, centered as a unit, so the letter
   lands in the same spot on every row regardless of whether that row
   has a trend arrow. */
.grade-wrap {
  display: inline-grid;
  grid-template-columns: 1.4em 1em;
  align-items: center;
}

.grade-letter {
  text-align: center;
}

.trend-arrow {
  text-align: left;
  margin-left: -1px;
  font-size: 0.6em;
}

.grade-a {
  background: var(--grade-a-bg);
  color: var(--grade-light-text);
}

.grade-b {
  background: var(--grade-b-bg);
  color: var(--grade-b-text);
}

.grade-c {
  background: var(--grade-c-bg);
  color: var(--grade-c-text);
}

.grade-d {
  background: var(--grade-d-bg);
  color: var(--grade-d-text);
}

.grade-f {
  background: var(--grade-f-bg);
  color: var(--grade-light-text);
}

@media (max-width: 600px) {
  body {
    font-size: 12px;
  }

  .scorecard th,
  .scorecard td {
    padding-top: 5px;
    padding-bottom: 5px;
  }
}

