:root {
  --green-950: #243426;
  --green-900: #30472f;
  --green-800: #39543a;
  --green-700: #5d785f;
  --sage: #8ba38d;
  --sage-soft: #edf3ee;
  --mint: #dfe9e0;
  --gold: #c9a44f;
  --ink: #15231d;
  --muted: #65756e;
  --line: #dce5df;
  --paper: #f7faf7;
  --white: #ffffff;
  --danger: #b43b31;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  background: linear-gradient(180deg, var(--green-950), var(--green-800));
  color: var(--white);
  min-height: 100vh;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

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

.brand span,
.judge-card span,
.judge-card small,
.eyebrow {
  color: rgba(255, 255, 255, .72);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  border: 1px solid rgba(255, 255, 255, .13);
  background: rgba(255, 255, 255, .05);
  color: var(--white);
  min-height: 44px;
  text-align: left;
  padding: 0 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font: inherit;
  text-decoration: none;
}

.nav-link {
  display: flex;
  align-items: center;
}

.nav-item.is-active {
  background: var(--mint);
  color: var(--green-900);
}

.judge-card {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, .07);
}

.judge-card strong,
.judge-card small {
  display: block;
  margin-top: 6px;
}

.app-shell {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.topbar .eyebrow,
.panel .eyebrow {
  color: var(--green-700);
  margin: 0 0 4px;
  font-weight: 800;
}

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

h1 {
  font-size: 32px;
}

h2 {
  font-size: 20px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  color: var(--green-800);
  background: var(--white);
  font-weight: 700;
  white-space: nowrap;
}

.status-pill span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #23b26d;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr);
  gap: 18px;
}

.player-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
  margin-bottom: 18px;
}

.hero-live {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 18px;
  padding: 24px;
  margin-bottom: 18px;
  border-radius: 8px;
  color: var(--white);
  background: linear-gradient(135deg, var(--green-950), var(--green-700));
  box-shadow: 0 18px 45px rgba(15, 61, 46, .16);
}

.hero-live h2 {
  font-size: 30px;
  margin-bottom: 8px;
}

.hero-live p:not(.eyebrow) {
  margin: 0;
  max-width: 620px;
  color: rgba(255, 255, 255, .78);
  line-height: 1.5;
}

.live-total {
  min-width: 170px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  place-content: center;
  text-align: center;
  background: rgba(255, 255, 255, .08);
}

.live-total strong {
  font-size: 46px;
  line-height: 1;
}

.live-total span {
  margin-top: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, .78);
}

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 18px 45px rgba(15, 61, 46, .08);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  padding: 0 12px;
  font: inherit;
  font-weight: 650;
}

input:focus,
select:focus {
  outline: 3px solid rgba(19, 86, 64, .14);
  border-color: var(--green-700);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.filters {
  display: flex;
  gap: 10px;
  min-width: min(520px, 60%);
}

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

.podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.podium-card {
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 8px;
  align-content: start;
  background: #fbfdfb;
}

.podium-card.rank-1 {
  min-height: 188px;
  background: linear-gradient(180deg, rgba(201, 164, 79, .2), #fbfdfb);
  border-color: rgba(201, 164, 79, .55);
}

.podium-card span {
  width: 38px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: var(--white);
  background: var(--green-800);
  font-weight: 900;
}

.podium-card strong {
  font-size: 18px;
}

.podium-card small {
  color: var(--muted);
  line-height: 1.35;
}

.pending-note {
  width: fit-content;
  border-radius: 999px;
  padding: 5px 8px;
  color: #755615;
  background: rgba(201, 164, 79, .15);
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
  text-transform: uppercase;
}

.podium-card b {
  margin-top: auto;
  font-size: 28px;
  color: var(--green-800);
}

.activity-list {
  display: grid;
  gap: 8px;
}

.activity-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.activity-item strong,
.activity-item span {
  display: block;
}

.activity-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.activity-item b {
  color: var(--green-800);
  font-size: 20px;
}

.provisional-panel {
  margin-bottom: 18px;
}

.sync-note {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(201, 164, 79, .16);
  color: #755615;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.run-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
}

.run-pill.pending {
  color: #755615;
  background: rgba(201, 164, 79, .15);
}

.run-pill.ready {
  color: var(--green-800);
  background: rgba(19, 86, 64, .12);
}

.profile-grid {
  display: grid;
  gap: 18px;
}

.profile-card {
  background: linear-gradient(135deg, var(--white), #eff8f2);
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.profile-stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, .72);
}

.profile-stats span,
.profile-stats strong {
  display: block;
}

.profile-stats span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.profile-stats strong {
  margin-top: 6px;
  color: var(--green-800);
  font-size: 28px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
}

td:last-child,
th:last-child {
  text-align: right;
}

.empty-row {
  text-align: center !important;
  color: var(--muted);
  font-weight: 800;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 850;
}

.badge.official {
  background: rgba(201, 164, 79, .18);
  color: #7b5b13;
}

.badge.club {
  background: rgba(19, 86, 64, .12);
  color: var(--green-800);
}

.badge.training {
  background: rgba(100, 116, 139, .14);
  color: #475569;
}

.row-note {
  margin-left: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    padding: 14px;
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .brand,
  .judge-card {
    display: none;
  }

  .nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-item {
    text-align: center;
    padding: 0 8px;
    font-size: 13px;
  }

  .app-shell {
    padding: 18px;
  }

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

  .work-grid,
  .player-grid,
  .field-row {
    grid-template-columns: 1fr;
  }

  .panel-head {
    flex-direction: column;
  }

  .filters {
    min-width: 0;
    width: 100%;
    flex-direction: column;
  }

  .hero-live {
    flex-direction: column;
  }

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

@media (max-width: 820px) {
  .podium,
  .profile-stats {
    grid-template-columns: 1fr;
  }

  .hero-live h2 {
    font-size: 24px;
  }

  .table-wrap {
    overflow: visible;
  }

  table {
    width: 100%;
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody,
  tr {
    display: block;
    width: 100%;
  }

  tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 10px 12px;
    background: var(--white);
  }

  td {
    display: inline-flex;
    align-items: center;
    width: auto;
    min-width: 0;
    padding: 0;
    border-bottom: 0;
    text-align: left !important;
  }

  td::before {
    content: "";
    display: none;
  }

  td[data-label="Rank"] {
    order: 1;
    flex: 0 0 34px;
    color: var(--green-800);
    font-weight: 950;
  }

  td[data-label="Player"] {
    order: 2;
    flex: 1 1 145px;
    font-weight: 950;
  }

  td[data-label="Total"] {
    order: 3;
    flex: 0 0 auto;
    margin-left: auto;
    color: var(--green-800);
    font-size: 18px;
  }

  td[data-label="Date"] {
    order: 1;
    flex: 1 1 110px;
    color: var(--green-800);
    font-weight: 950;
  }

  td[data-label="Discipline"] {
    order: 4;
    flex: 1 0 100%;
    padding-left: 34px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.3;
  }

  td[data-label="Ride"],
  td[data-label="Run"],
  td[data-label="Type"],
  td[data-label="Country"],
  td[data-label="R1"],
  td[data-label="R2"],
  td[data-label="R3"] {
    order: 5;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.25;
  }

  td[data-label="Ride"] {
    margin-left: 34px;
  }

  td[data-label="Ride"]::after,
  td[data-label="Run"]::after,
  td[data-label="Type"]::after,
  td[data-label="Country"]::after,
  td[data-label="R1"]::after,
  td[data-label="R2"]::after {
    content: "·";
    margin-left: 8px;
    color: var(--line);
  }

  td[data-label="R1"]::before,
  td[data-label="R2"]::before,
  td[data-label="R3"]::before {
    display: inline;
    content: attr(data-label) " ";
    margin-right: 3px;
    color: var(--green-800);
    font-weight: 900;
  }

  td[data-label="Type"] .badge,
  td[data-label="Run"] .run-pill {
    height: 22px;
    padding: 0 8px;
    font-size: 11px;
  }

  .empty-row {
    display: block;
    width: 100%;
    text-align: left !important;
  }

  .empty-row::before {
    content: "";
    display: none;
  }
}
