:root {
  color-scheme: light;
  --ink: #16211c;
  --muted: #65736d;
  --line: #d7ded9;
  --surface: #ffffff;
  --page: #f4f6f1;
  --accent: #0f766e;
  --accent-strong: #0a534e;
  --gold: #9b6b15;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 28px 0 22px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1;
  letter-spacing: 0;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 10px;
  min-width: min(100%, 500px);
}

.hero-stats div,
.toolbar,
.person-card,
.contribution-form,
.notes {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hero-stats div {
  padding: 14px;
}

.hero-stats span {
  display: block;
  font-size: 18px;
  font-weight: 800;
  overflow-wrap: anywhere;
  white-space: nowrap;
}

.hero-stats small,
.person-meta,
.year-pill small,
.empty {
  color: var(--muted);
}

.lookup-section,
.add-section {
  margin-top: 22px;
}

.section-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 0 0 12px;
}

.step {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

h2 {
  margin: 0;
  font-size: 22px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px 150px;
  gap: 12px;
  margin: 0 0 22px;
  padding: 14px;
}

.contribution-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 14px;
}

label {
  display: grid;
  gap: 6px;
}

label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

input[type="file"] {
  padding: 9px 12px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.2);
  border-color: var(--accent);
}

.results-wrap {
  display: grid;
  gap: 12px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

#activeQuery {
  margin-left: 8px;
  color: var(--muted);
}

#clearButton {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--accent-strong);
  cursor: pointer;
  padding: 0 14px;
  font-weight: 700;
}

.filename-preview {
  display: grid;
  gap: 6px;
  grid-column: span 2;
  align-content: start;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
}

.filename-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.filename-preview strong {
  overflow-wrap: anywhere;
}

.form-actions {
  display: flex;
  grid-column: 1 / -1;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

#submitContribution {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  padding: 0 18px;
}

#submitContribution:disabled {
  cursor: wait;
  opacity: 0.65;
}

#submissionStatus {
  margin: 0;
  color: var(--muted);
  text-align: right;
}

#submissionStatus[data-tone="success"] {
  color: var(--accent-strong);
  font-weight: 700;
}

#submissionStatus[data-tone="error"] {
  color: #a03b2f;
  font-weight: 700;
}

.notes {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
}

.notes span {
  color: var(--muted);
}

.results {
  display: grid;
  gap: 10px;
}

.person-card {
  overflow: clip;
}

.person-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 16px;
  text-align: left;
}

.person-name,
.person-meta {
  display: block;
  overflow-wrap: anywhere;
}

.person-name {
  font-size: 18px;
}

.person-total {
  color: var(--accent-strong);
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
}

.person-detail {
  display: grid;
  gap: 14px;
  padding: 0 16px 16px;
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}

.year-pill {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.year-pill strong,
.year-pill small {
  display: block;
}

.timeline {
  display: grid;
  gap: 6px;
}

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

.bar {
  height: 8px;
  border-radius: 999px;
  background: #c9d8d3;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  min-width: 4px;
  background: var(--accent);
}

.empty {
  padding: 28px;
  text-align: center;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1120px);
    padding-top: 18px;
  }

  .hero {
    display: grid;
    align-items: start;
  }

  .hero-stats,
  .toolbar,
  .contribution-form {
    grid-template-columns: 1fr;
  }

  .filename-preview,
  .form-actions {
    grid-column: auto;
  }

  .form-actions {
    display: grid;
  }

  #submissionStatus {
    text-align: left;
  }

  .timeline-row {
    grid-template-columns: 92px minmax(0, 1fr) auto;
    font-size: 14px;
  }
}
