:root {
  --ink: #17212b;
  --muted: #64717d;
  --bg: #f6f8fa;
  --surface: #ffffff;
  --line: #d8e0e6;
  --teal: #17796f;
  --teal-soft: #dff0ed;
  --blue: #315f9b;
  --blue-soft: #e4ecf7;
  --green: #2f7d4a;
  --green-soft: #e2f1e7;
  --amber: #a85f12;
  --amber-soft: #f4eadc;
  --red: #b24646;
  --red-soft: #f4e2e2;
  --shadow: 0 18px 48px rgba(23, 33, 43, 0.08);
  --math-serif: Georgia, "Times New Roman", Times, serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(49, 95, 155, 0.08), transparent 32rem),
    linear-gradient(315deg, rgba(23, 121, 111, 0.09), transparent 28rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 12px clamp(16px, 3vw, 40px);
  border-bottom: 1px solid rgba(216, 224, 230, 0.85);
  background: rgba(246, 248, 250, 0.92);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 230px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(23, 121, 111, 0.32);
  border-radius: 8px;
  color: var(--teal);
  background: var(--teal-soft);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1rem;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topnav a {
  padding: 8px 11px;
  border-radius: 8px;
  color: #394856;
  font-size: 0.92rem;
  text-decoration: none;
}

.topnav a:hover {
  background: rgba(49, 95, 155, 0.09);
}

.section-inner {
  width: min(1200px, calc(100vw - 32px));
  margin: 0 auto;
}

section {
  border-bottom: 1px solid rgba(216, 224, 230, 0.8);
}

.dashboard-section {
  display: flex;
  align-items: center;
  padding: 42px 0 34px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 430px);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 10px;
  font-family: var(--math-serif);
  font-size: clamp(2.25rem, 5vw, 4.1rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-family: var(--math-serif);
  font-size: clamp(1.45rem, 3vw, 2.3rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.lead {
  max-width: 760px;
  color: #43505c;
  font-size: 1rem;
}

.paper-citation {
  max-width: 760px;
  margin-bottom: 12px;
  color: #33424e;
  font-family: var(--math-serif);
  font-size: 1.04rem;
}

.hero-actions,
.quick-actions,
.tool-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  flex-wrap: wrap;
  margin-top: 15px;
  color: var(--muted);
  font-size: 0.82rem;
}

.sync-status-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #285947;
  font-weight: 800;
}

.sync-status-label i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.sync-status a {
  color: var(--blue);
  font-weight: 700;
  text-underline-offset: 3px;
}

.button,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font-weight: 700;
  text-decoration: none;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.button:hover,
.file-button:hover {
  transform: translateY(-1px);
  border-color: rgba(23, 121, 111, 0.45);
  background: #fbfcfd;
}

.button.primary {
  border-color: var(--teal);
  color: white;
  background: var(--teal);
}

.button.danger {
  color: var(--red);
  border-color: rgba(178, 70, 70, 0.35);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-card {
  min-height: 128px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.stat-label,
.stat-card small {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.stat-card strong {
  display: block;
  margin: 7px 0;
  font-family: var(--math-serif);
  font-size: clamp(1.9rem, 4vw, 3.1rem);
  line-height: 1;
  letter-spacing: 0;
}

.progress-section,
.explorer-section,
.updates-section,
.curator-section {
  padding: 52px 0;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 28px;
  align-items: start;
}

.section-heading {
  margin-bottom: 20px;
}

.section-heading p:last-child {
  max-width: 800px;
  color: var(--muted);
}

.section-heading.compact h2 {
  font-size: 1.35rem;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.86rem;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
}

.chart-legend i {
  display: inline-block;
  width: 18px;
  height: 10px;
  border-radius: 999px;
}

.legend-open {
  background: var(--blue);
}

.legend-solved {
  background: var(--green);
}

.legend-partial {
  background: var(--amber);
}

.legend-watching {
  background: var(--teal);
}

.legend-total {
  border: 1px solid rgba(216, 224, 230, 0.95);
  background: #edf2f5;
}

.progress-chart {
  display: grid;
  gap: 10px;
}

.chart-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 86px;
  gap: 10px;
  align-items: center;
}

.chart-label {
  overflow: hidden;
  color: #30404f;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-track {
  position: relative;
  height: 28px;
  overflow: hidden;
  border: 1px solid rgba(216, 224, 230, 0.9);
  border-radius: 8px;
  background: #edf2f5;
}

.chart-open,
.chart-solved,
.chart-partial,
.chart-watching {
  position: absolute;
  top: 0;
  bottom: 0;
}

.chart-open {
  left: 0;
  background: var(--blue);
}

.chart-solved {
  background: var(--green);
}

.chart-partial {
  background: var(--amber);
}

.chart-watching {
  background: var(--teal);
}

.chart-total {
  color: var(--muted);
  font-size: 0.84rem;
  text-align: right;
}

.watchlist {
  position: sticky;
  top: 96px;
}

.smallest-list,
.problem-list,
.update-log {
  display: grid;
  gap: 12px;
}

.small-card,
.problem-card,
.update-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.small-card {
  width: 100%;
  padding: 14px;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.small-card strong,
.small-card span {
  display: block;
}

.small-card .equation {
  margin-top: 6px;
  font-size: 0.95rem;
}

.explorer-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(4, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

label span {
  display: block;
  margin-bottom: 6px;
  color: #475662;
  font-size: 0.78rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
}

input,
select {
  min-height: 42px;
  padding: 8px 10px;
}

textarea {
  padding: 10px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(23, 121, 111, 0.24);
  outline-offset: 2px;
}

.status-tabs,
.view-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.status-tab,
.view-tab {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #3e4b56;
  background: var(--surface);
  font-weight: 800;
}

.status-tab.active,
.view-tab.active {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-soft);
}

.view-tabs {
  margin-top: -4px;
  margin-bottom: 18px;
}

.results-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 370px);
  gap: 18px;
  align-items: start;
}

.results-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.results-meta strong {
  color: var(--ink);
}

.problem-card {
  padding: 16px 16px 15px;
  border-left: 4px solid rgba(49, 95, 155, 0.58);
}

.problem-card.selected {
  border-color: rgba(49, 95, 155, 0.7);
  box-shadow: 0 16px 42px rgba(49, 95, 155, 0.13);
}

.problem-topline,
.card-actions,
.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.problem-topline {
  justify-content: space-between;
  margin-bottom: 10px;
}

.meta-line {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.pill.status-open {
  color: var(--blue);
  background: var(--blue-soft);
}

.pill.status-solved {
  color: var(--green);
  background: var(--green-soft);
}

.pill.status-partial {
  color: var(--amber);
  background: var(--amber-soft);
}

.pill.status-watching {
  color: var(--teal);
  background: var(--teal-soft);
}

.pill.neutral {
  color: #455461;
  background: #eef2f5;
}

.equation {
  overflow-wrap: anywhere;
  font-family: var(--math-serif);
  font-size: 1.08rem;
  line-height: 1.42;
}

.math-equation {
  font-family: var(--math-serif);
}

.source-citation {
  display: block;
  margin: -3px 0 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-style: normal;
}

.problem-card .equation {
  margin-bottom: 10px;
}

.problem-card p {
  margin-bottom: 8px;
}

.tag-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0 0;
}

.tag {
  color: #52606c;
  font-size: 0.75rem;
}

.card-actions {
  margin-top: 12px;
}

.icon-button {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: #32404d;
  font-size: 0.82rem;
  font-weight: 800;
}

.detail-panel {
  position: sticky;
  top: 96px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.detail-panel h3 {
  margin-bottom: 12px;
  font-size: 1.25rem;
}

.detail-panel .equation {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.detail-panel .source-citation {
  margin-top: -5px;
}

.problem-index-list {
  min-width: 0;
}

.index-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.problem-index {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.problem-index th,
.problem-index td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.problem-index th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #33424e;
  background: #f3f6f8;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.problem-index tr.selected td {
  background: var(--blue-soft);
}

.problem-index td:nth-child(1) {
  width: 92px;
}

.problem-index td:nth-child(2) {
  width: 90px;
  color: #33424e;
  font-weight: 800;
}

.problem-index td:nth-child(3) {
  min-width: 270px;
}

.problem-index td:nth-child(4) {
  width: 170px;
}

.problem-index td:nth-child(5) {
  width: 220px;
  color: var(--muted);
}

.problem-index td:nth-child(6) {
  min-width: 240px;
  color: #455461;
}

.problem-index small,
.problem-index cite {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
}

.equation-link {
  width: 100%;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.detail-grid {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.detail-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  color: #455461;
  font-size: 0.92rem;
}

.detail-row strong {
  color: var(--ink);
}

.note-box {
  margin-top: 12px;
  padding: 12px;
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  background: var(--teal-soft);
  color: #24433f;
  font-size: 0.92rem;
}

.update-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
}

.update-card time,
.update-card .version {
  display: block;
}

.update-card time {
  color: var(--muted);
  font-size: 0.84rem;
}

.update-card .version {
  color: var(--teal);
  font-weight: 900;
}

.update-card ul {
  margin: 10px 0 0;
  padding-left: 19px;
}

.update-card li {
  margin-bottom: 5px;
  overflow-wrap: anywhere;
}

.curator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 430px);
  gap: 28px;
  align-items: start;
}

.curator-form,
.data-tools {
  display: grid;
  gap: 12px;
}

.data-tools {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.footer {
  padding: 24px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 980px) {
  .dashboard-grid,
  .split-layout,
  .results-layout,
  .curator-grid {
    grid-template-columns: 1fr;
  }

  .watchlist,
  .detail-panel {
    position: static;
  }

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

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .topnav {
    justify-content: flex-start;
  }

  .dashboard-section {
    min-height: 0;
    padding-top: 34px;
  }

  .stats-grid,
  .filters {
    grid-template-columns: 1fr;
  }

  .explorer-heading,
  .results-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .chart-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .chart-total {
    text-align: left;
  }

  .update-card {
    grid-template-columns: 1fr;
  }
}
