:root {
  --surface: #ffffff;
  --neutral: #f7f7f8;
  --ink: #101010;
  --muted: #5b5b5b;
  --rule: #d7d7d7;
  --accent: #e4002b;
}

* {
  box-sizing: border-box;
}

html {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--surface);
  font-variant-numeric: tabular-nums;
}

body {
  margin: 0;
  background: var(--surface);
}

button,
input {
  font: inherit;
}

.masthead {
  min-height: 320px;
  display: grid;
  grid-template-columns: minmax(120px, 18vw) 1fr;
  gap: 1px;
  background: var(--rule);
  border-bottom: 1px solid var(--rule);
}

.masthead > * {
  background: var(--surface);
}

.folio {
  color: var(--accent);
  font-size: clamp(48px, 10vw, 164px);
  font-weight: 700;
  line-height: 0.82;
  padding: 22px 18px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.masthead h1 {
  max-width: 1180px;
  margin: 0;
  padding: 26px 28px 0;
  font-size: clamp(56px, 12vw, 180px);
  font-weight: 700;
  line-height: 0.86;
  letter-spacing: 0;
}

.masthead p {
  max-width: 860px;
  margin: 18px 0 0;
  padding: 0 28px 32px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}

main {
  display: grid;
  grid-template-columns: 1fr;
}

.summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  border-bottom: 1px solid var(--rule);
  background: var(--rule);
  gap: 1px;
}

.metric {
  min-height: 132px;
  padding: 16px 18px;
  background: var(--neutral);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric strong {
  font-size: clamp(34px, 5vw, 72px);
  line-height: 0.92;
  letter-spacing: 0;
}

.metric span {
  color: var(--muted);
  font-size: 14px;
}

.workspace {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  border-bottom: 1px solid var(--rule);
}

.tabs {
  display: grid;
  align-content: start;
  border-right: 1px solid var(--rule);
  background: var(--surface);
}

.tab {
  min-height: 58px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  padding: 0 18px;
  cursor: pointer;
}

.tab:hover,
.tab.is-active {
  color: var(--accent);
}

.toolbar {
  grid-column: 2;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  min-height: 154px;
  padding: 18px 20px 20px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}

.section-number {
  color: var(--accent);
  font-size: 86px;
  font-weight: 700;
  line-height: 0.84;
}

.toolbar h2 {
  margin: 10px 0 0;
  font-size: 28px;
  line-height: 1;
}

.search {
  width: min(380px, 42vw);
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: center;
  border: 1px solid var(--rule);
}

.search span {
  padding: 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.search input {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-left: 1px solid var(--rule);
  padding: 0 12px;
  outline: none;
  background: var(--surface);
}

.search input:focus {
  box-shadow: inset 0 -3px 0 var(--accent);
}

.table-wrap {
  grid-column: 2;
  overflow: auto;
  max-height: calc(100vh - 170px);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  padding: 8px 10px;
  vertical-align: top;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  font-weight: 700;
  cursor: pointer;
}

th.sorted {
  color: var(--accent);
}

td.numeric {
  text-align: right;
}

td.long {
  min-width: 260px;
  max-width: 420px;
  white-space: normal;
}

tbody tr:hover td {
  background: var(--neutral);
}

.source {
  display: grid;
  grid-template-columns: 220px 1fr;
  border-bottom: 1px solid var(--rule);
}

.source h2,
.source p {
  margin: 0;
  padding: 20px;
}

.source h2 {
  border-right: 1px solid var(--rule);
  color: var(--accent);
  font-size: 44px;
  line-height: 0.9;
}

.source p {
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 900px) {
  .masthead {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .folio {
    writing-mode: horizontal-tb;
    font-size: 44px;
    border-bottom: 1px solid var(--rule);
  }

  .summary {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .tabs,
  .toolbar,
  .table-wrap {
    grid-column: 1;
  }

  .tabs {
    grid-template-columns: repeat(5, minmax(96px, 1fr));
    overflow-x: auto;
    border-right: 0;
  }

  .tab {
    border-right: 1px solid var(--rule);
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search {
    width: 100%;
  }

  .source {
    grid-template-columns: 1fr;
  }

  .source h2 {
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }
}
