:root {
  color-scheme: light;
  --bg: #f5f4ef;
  --surface: #ffffff;
  --surface-2: #ece8df;
  --ink: #18202a;
  --muted: #65717b;
  --line: #d8d2c6;
  --green: #0f7b6c;
  --red: #b8444f;
  --gold: #c98e24;
  --blue: #356c9b;
  --shadow: 0 18px 45px rgba(24, 32, 42, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0) 260px),
    var(--bg);
  color: var(--ink);
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}

button,
input,
select {
  font: inherit;
}

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

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 0 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 840px;
  font-size: clamp(32px, 4.5vw, 62px);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.source-pill,
.status-label {
  display: inline-flex;
  align-items: center;
  height: 30px;
  border-radius: 999px;
  padding: 0 12px;
  background: #e2efe8;
  color: #145f55;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(24, 32, 42, 0.07);
}

.icon-button:hover {
  border-color: var(--green);
  color: var(--green);
}

.icon-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.icon-button svg {
  width: 20px;
  height: 20px;
}

.status-band {
  display: grid;
  grid-template-columns: 1fr 220px;
  align-items: center;
  gap: 18px;
  min-height: 58px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.status-band > div {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

#statusText {
  min-width: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

progress {
  width: 100%;
  height: 10px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-2);
}

progress::-webkit-progress-bar {
  background: var(--surface-2);
}

progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--green), var(--gold));
}

progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--green), var(--gold));
}

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

.toolbar label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.toolbar span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

select:focus,
input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(15, 123, 108, 0.14);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  min-height: 112px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(24, 32, 42, 0.06);
}

.metric span,
.panel-head span,
.meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.metric strong {
  display: block;
  margin: 10px 0 5px;
  font-size: 28px;
  line-height: 1;
}

.metric b {
  color: var(--green);
  font-size: 12px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
}

.panel {
  grid-column: span 2;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel.wide {
  grid-column: span 4;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
}

.summary-card {
  min-height: 158px;
  padding: 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.summary-card:nth-child(2n) {
  border-right: 0;
}

.summary-card h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.summary-card p {
  color: var(--muted);
  line-height: 1.55;
}

.tagline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.leader-stack {
  padding: 8px 0;
}

.leader-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 46px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.leader-row:last-child {
  border-bottom: 0;
}

.leader-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leader-row span {
  color: var(--muted);
  font-size: 12px;
}

.leader-row b {
  min-width: 46px;
  color: var(--green);
  text-align: right;
}

.compact .leader-row {
  min-height: 38px;
  padding-block: 8px;
}

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

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

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

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

tbody tr:hover {
  background: #fbfaf7;
}

.match-cell {
  display: grid;
  gap: 8px;
}

.team-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.flag {
  width: 22px;
  height: 16px;
  border-radius: 2px;
  object-fit: cover;
  border: 1px solid rgba(24, 32, 42, 0.12);
}

.score {
  font-size: 20px;
  font-weight: 900;
  white-space: nowrap;
}

.event-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.event-badges span {
  padding: 3px 7px;
  border-radius: 6px;
  background: #f0ede6;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.empty {
  padding: 28px 16px;
  color: var(--muted);
}

.tone-green {
  color: var(--green);
}

.tone-red {
  color: var(--red);
}

.tone-gold {
  color: var(--gold);
}

.tone-blue {
  color: var(--blue);
}

@media (max-width: 1120px) {
  .metric-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .panel,
  .panel.wide {
    grid-column: 1 / -1;
  }
}

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

  .topbar,
  .status-band {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    gap: 14px;
  }

  .toolbar,
  .metric-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .summary-card,
  .summary-card:nth-child(2n) {
    border-right: 0;
  }

  h1 {
    font-size: clamp(32px, 12vw, 46px);
  }
}
