:root {
  color-scheme: light;
  --bg: #f7f4ee;
  --surface: #fffdf8;
  --surface-muted: #f0ebe2;
  --ink: #24211d;
  --muted: #6f685f;
  --quiet: #8a8176;
  --line: #d9d0c2;
  --line-strong: #b9ac9a;
  --accent: #2b6f68;
  --accent-2: #8b4a2f;
  --focus: rgba(43, 111, 104, 0.25);
  font-family:
    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
}

a {
  color: inherit;
}

.app-header {
  display: flex;
  width: min(1420px, calc(100vw - 36px));
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin: 0 auto;
  padding: 26px 0 18px;
  border-bottom: 1px solid var(--line-strong);
}

.brand-block {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 14px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 4px;
  object-fit: cover;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent-2);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 4rem);
  font-weight: 500;
  line-height: 0.98;
}

h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  font-weight: 500;
}

h3 {
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
}

.dek {
  max-width: 620px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.45;
}

.header-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-link,
.ghost-button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.ghost-button {
  flex: 1;
}

.icon-link:hover,
.ghost-button:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.dashboard-shell {
  width: min(1420px, calc(100vw - 36px));
  margin: 0 auto 26px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 18px 0 22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metric {
  min-height: 72px;
  padding: 13px 18px 14px 0;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
  padding-left: 18px;
}

.metric + .metric {
  padding-left: 18px;
}

.metric-label {
  display: block;
  color: var(--quiet);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 7px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 2.2vw, 2.25rem);
  font-weight: 500;
  line-height: 1;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(250px, 292px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.filters {
  position: sticky;
  top: 14px;
  display: grid;
  gap: 14px;
  padding: 0 0 18px;
  border-top: 3px solid var(--ink);
}

.filter-group {
  display: grid;
  gap: 6px;
}

.filter-group:first-child {
  padding-top: 14px;
}

.two-col {
  grid-template-columns: 1fr 1fr;
}

label {
  color: var(--quiet);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

input {
  padding: 0 10px;
}

select {
  padding: 0 8px;
}

input::placeholder {
  color: var(--quiet);
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.toggle-row {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.toggle-row input {
  width: 17px;
  min-height: 17px;
  accent-color: var(--accent);
}

.results-panel {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.sort-control {
  display: grid;
  min-width: 168px;
  gap: 6px;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}

.chart-block {
  min-height: 210px;
  padding: 14px 16px;
}

.chart-block + .chart-block {
  border-left: 1px solid var(--line);
}

.chart-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.chart-heading span {
  color: var(--quiet);
  font-size: 0.8rem;
  font-weight: 700;
}

.bar-chart {
  display: grid;
  min-height: 145px;
  grid-auto-flow: column;
  grid-auto-columns: minmax(24px, 1fr);
  align-items: end;
  gap: 7px;
}

.bar-item {
  display: grid;
  min-width: 0;
  gap: 5px;
  justify-items: center;
}

.chart-button {
  appearance: none;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: inherit;
  cursor: pointer;
}

.chart-button:hover .bar,
.bar-item.is-active .bar {
  background: var(--accent-2);
}

.chart-button:hover .bar-label,
.chart-button:hover .bar-value,
.bar-item.is-active .bar-label,
.bar-item.is-active .bar-value {
  color: var(--ink);
}

.bar {
  width: 100%;
  min-height: 4px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
}

.bar-label,
.bar-value {
  color: var(--quiet);
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
}

.rank-chart {
  display: grid;
  gap: 9px;
}

.rank-row {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(100px, 1.25fr) 32px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 2px 0;
  color: var(--quiet);
  font-size: 0.82rem;
  font-weight: 700;
}

.rank-row:hover .rank-name,
.rank-row.is-active .rank-name {
  color: var(--accent-2);
}

.rank-row:hover .rank-fill,
.rank-row.is-active .rank-fill {
  background: var(--accent-2);
}

.rank-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-track {
  height: 6px;
  overflow: hidden;
  border-radius: 0;
  background: rgba(36, 33, 29, 0.08);
}

.rank-fill {
  display: block;
  height: 100%;
  background: var(--accent);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 1060px;
  border-collapse: collapse;
  table-layout: fixed;
  background: var(--surface);
}

.year-col {
  width: 76px;
}

.title-col {
  width: 43%;
}

.category-col {
  width: 18%;
}

.publication-col {
  width: 22%;
}

.links-col {
  width: 170px;
}

th,
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  color: var(--quiet);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #faf5eb;
}

.year-cell {
  width: 74px;
  color: var(--accent-2);
  font-weight: 850;
}

.paper-title {
  color: var(--ink);
  font-weight: 760;
  line-height: 1.35;
  text-decoration-color: rgba(43, 111, 104, 0.45);
  text-underline-offset: 3px;
}

.paper-title:hover {
  color: var(--accent);
}

.category-cell,
.publication-cell {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.links-cell {
  min-width: 150px;
  overflow-wrap: normal;
}

.links-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill,
.link-pill {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
}

.pill {
  padding: 0 7px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.link-pill {
  padding: 0 7px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--accent);
  text-decoration: none;
}

.link-pill:hover {
  border-color: var(--accent);
  background: #f3efe7;
}

.link-pill.code {
  color: var(--accent-2);
}

.empty-state {
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
}

.site-footer {
  display: grid;
  width: min(1420px, calc(100vw - 36px));
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin: 0 auto 40px;
  padding: 20px 0 4px;
  border-top: 1px solid var(--line-strong);
  color: var(--muted);
}

.footer-section p {
  margin: 0;
  line-height: 1.55;
}

.footer-section a {
  color: var(--ink);
  font-weight: 800;
  text-decoration-color: rgba(43, 111, 104, 0.45);
  text-underline-offset: 3px;
}

.small-note {
  margin-top: 8px;
  font-size: 0.85rem;
}

@media (max-width: 1000px) {
  .summary-grid,
  .chart-grid,
  .workbench,
  .site-footer {
    grid-template-columns: 1fr;
  }

  .metric,
  .metric:last-child,
  .metric + .metric {
    padding-left: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric:last-child {
    border-bottom: 0;
  }

  .filters {
    position: static;
  }

  .chart-block + .chart-block {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 680px) {
  .app-header,
  .panel-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .brand-block {
    align-items: center;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

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

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .dashboard-shell,
  .app-header,
  .site-footer {
    width: min(100% - 22px, 1420px);
  }
}
