:root {
  color-scheme: light;
  --content-width: 1400px;
  --table-min-width: 1320px;
  --bg: #f7f8f5;
  --surface: #ffffff;
  --surface-subtle: #eef4f2;
  --text: #17211d;
  --muted: #5f6d66;
  --line: #d8e0dc;
  --accent: #0f766e;
  --accent-strong: #14532d;
  --accent-soft: #d8f3ea;
  --warning: #9a3412;
  --shadow: 0 16px 40px rgba(20, 43, 35, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

.site-header {
  background:
    linear-gradient(120deg, rgba(15, 118, 110, 0.92), rgba(20, 83, 45, 0.9)),
    url("assets/header-pattern.svg");
  background-size: cover;
  color: #fff;
}

.header-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px;
  align-items: end;
  width: min(var(--content-width), calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 30px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #c7f9e6;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 12px;
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1;
  letter-spacing: 0;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.header-actions a {
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

main {
  width: min(var(--content-width), calc(100% - 40px));
  margin: 0 auto;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(160px, 1fr));
  gap: 14px;
  margin: 24px 0 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  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(--text);
  font: inherit;
  font-size: 0.95rem;
  text-transform: none;
}

input {
  padding: 0 12px;
}

select {
  padding: 0 10px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.summary > div {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
}

.summary strong {
  display: block;
  color: var(--accent-strong);
  font-size: 1.75rem;
  line-height: 1.1;
}

.summary span {
  color: var(--muted);
  font-size: 0.92rem;
}

.table-section {
  margin-bottom: 36px;
}

.table-heading {
  display: flex;
  gap: 16px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 10px;
}

.table-heading h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
}

.table-heading p {
  margin-bottom: 0;
  color: var(--muted);
}

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

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

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

th {
  background: #f1f5f3;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

th:nth-child(1),
td:nth-child(1) {
  width: 20%;
}

th:nth-child(2),
td:nth-child(2) {
  width: 12%;
}

th:nth-child(3),
td:nth-child(3) {
  width: 9%;
}

th:nth-child(4),
td:nth-child(4) {
  width: 10%;
}

th:nth-child(5),
td:nth-child(5) {
  width: 10%;
}

th:nth-child(6),
td:nth-child(6) {
  width: 14%;
}

th:nth-child(7),
td:nth-child(7) {
  width: 13%;
}

th:nth-child(8),
td:nth-child(8) {
  width: 12%;
}

td:nth-child(3),
td:nth-child(4),
td:nth-child(5),
td:nth-child(7),
td:nth-child(8) {
  white-space: nowrap;
}

.challenge-link {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.challenge-link:hover {
  text-decoration: underline;
}

.meta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.86rem;
}

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

.tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 700;
}

.status {
  display: inline-flex;
  min-width: 74px;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #374151;
  font-size: 0.8rem;
  font-weight: 800;
}

.status.open,
.status.ongoing {
  background: #dcfce7;
  color: #166534;
}

.status.upcoming {
  background: #dbeafe;
  color: #1d4ed8;
}

.status.closed {
  background: #ffedd5;
  color: var(--warning);
}

.status.finished,
.status.archived {
  background: #f3f4f6;
  color: #4b5563;
}

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

@media (max-width: 860px) {
  .header-inner,
  .toolbar,
  .summary {
    grid-template-columns: 1fr;
  }

  .header-inner {
    padding: 40px 0 32px;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .table-heading {
    display: block;
  }
}

@media (max-width: 520px) {
  .header-inner,
  main,
  .toolbar {
    width: min(100% - 28px, var(--content-width));
  }

  h1 {
    font-size: 2.3rem;
  }

  .toolbar {
    padding: 12px;
  }
}
