:root {
  --green: #1f4d3a;
  --green-dark: #16382a;
  --cream: #faf8f3;
  --red: #c0392b;
  --blue: #2f6f9f;
  --ink: #23302b;
  --muted: #6b7772;
  --line: #e3ded2;
  --white: #ffffff;
  --shadow: 0 10px 30px rgba(31, 77, 58, 0.08);
}

* {
  box-sizing: border-box;
}

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

a {
  color: var(--green);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--green);
  color: var(--white);
}

.brand {
  color: var(--white);
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-header nav a {
  color: var(--white);
  text-decoration: none;
  opacity: 0.9;
}

.site-header nav a:hover {
  opacity: 1;
  text-decoration: underline;
}

.site-header nav a.active {
  opacity: 1;
  text-decoration: underline;
}

/* People dropdown. <details> gives us open/close without any JavaScript. */
.nav-menu {
  position: relative;
}

.nav-menu summary {
  color: var(--white);
  cursor: pointer;
  opacity: 0.9;
  list-style: none;
}

.nav-menu summary::-webkit-details-marker {
  display: none;
}

.nav-menu summary::after {
  content: " ▾";
  font-size: 0.75em;
}

.nav-menu summary:hover,
.nav-menu summary.active,
.nav-menu[open] summary {
  opacity: 1;
  text-decoration: underline;
}

.nav-menu-list {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 20;
  min-width: 10rem;
  display: flex;
  flex-direction: column;
  padding: 0.35rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

/* The panel is a white card, so its links must be dark. These selectors are
   scoped through .site-header nav so they outrank the white header-bar links
   (.site-header nav a) that would otherwise win on specificity. */
.site-header nav .nav-menu-list a {
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  color: var(--ink);
  opacity: 1;
}

.site-header nav .nav-menu-list a:hover {
  background: rgba(31, 77, 58, 0.08);
  text-decoration: none;
}

.site-header nav .nav-menu-list a.active {
  color: var(--green-dark);
  font-weight: 700;
  text-decoration: none;
}

.nav-menu-empty {
  margin: 0;
  padding: 0.45rem 0.65rem;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Keep the add link green even though it is also matched by the dark-text
   rule for links inside the panel. */
.site-header nav .nav-menu-list a.nav-menu-add {
  margin-top: 0.35rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
  font-weight: 600;
  color: var(--green-dark);
}

/* Summary cards on the per-person pages. */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat {
  padding: 1.1rem 1.25rem;
}

.stat-label {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-value {
  margin: 0.15rem 0 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--green-dark);
}

.anchor-nav {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.section {
  margin-bottom: 1.25rem;
}

.section h2,
.section-heading {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  color: var(--green-dark);
}

.section-heading {
  margin-top: 1.75rem;
}

/* Christmas Wrapped hero and the Winnings award cards. */
.hero {
  padding: 2.5rem 2rem;
  margin-bottom: 1.5rem;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: var(--white);
  box-shadow: var(--shadow);
}

.hero-kicker {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.85;
}

.hero-title {
  margin: 0.25rem 0 0;
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  line-height: 1;
}

.hero-sub {
  margin: 0.5rem 0 0;
  opacity: 0.9;
}

.champion {
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  border: 2px solid var(--green);
  border-radius: 16px;
  background: var(--white);
  box-shadow: var(--shadow);
  text-align: center;
}

.champion-label {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.champion-name {
  margin: 0.2rem 0;
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--green-dark);
}

.award-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.award-card {
  padding: 1.25rem 1rem;
  text-align: center;
}

.award-emoji {
  margin: 0;
  font-size: 1.8rem;
  line-height: 1;
}

.award-title {
  margin: 0.4rem 0 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.award-winner {
  margin: 0.15rem 0 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--green-dark);
}

.award-card .muted {
  margin-top: 0.3rem;
  font-size: 0.82rem;
}

.wrapped-line {
  margin: 0 0 0.5rem;
}

.page {
  width: min(1100px, 100% - 2rem);
  margin: 2rem auto 4rem;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.muted {
  color: var(--muted);
  margin: 0.25rem 0 0;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 2rem 1rem;
}

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.card.narrow {
  max-width: 620px;
  margin: 0 auto;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 1.25rem;
}

.chart-card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  color: var(--green-dark);
}

.chart-card .vega-embed {
  width: 100%;
}

.chart-card .vega-embed canvas,
.chart-card .vega-embed svg {
  max-width: 100%;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  padding: 0.6rem 0.55rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

thead th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tfoot th {
  border-bottom: 0;
  color: var(--green-dark);
}

tbody tr:hover {
  background: #fbfaf6;
}

.actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.actions form {
  margin: 0;
}

.btn {
  display: inline-block;
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 1.1rem;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--green);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--green-dark);
}

.btn-outline {
  border: 1px solid var(--green);
  color: var(--green);
  background: transparent;
}

.btn-outline:hover {
  background: rgba(31, 77, 58, 0.06);
}

.link-danger {
  border: 0;
  background: none;
  padding: 0;
  color: var(--red);
  font: inherit;
  cursor: pointer;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  font: inherit;
  color: var(--ink);
}

.field textarea {
  resize: vertical;
  min-height: 5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.5;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0 1rem;
}

.hint {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0 0 0.4rem;
}

.error {
  color: var(--red);
  font-size: 0.85rem;
  margin: 0.3rem 0 0;
}

.flashes {
  margin-bottom: 1rem;
}

.flash {
  margin: 0 0 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
}

.flash-error {
  background: #fbe9e7;
  color: #8e2b20;
}

.flash-success {
  background: #e7f2ec;
  color: var(--green-dark);
}

.flash-info {
  background: #f4efe2;
  color: #6b5a1f;
}

@media (max-width: 700px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .page {
    width: min(100% - 1.25rem, 1100px);
    margin-top: 1.25rem;
  }
}
