:root {
  --bg: #e9edf2;
  --panel: #ffffff;
  --panel-soft: #f7f9fb;
  --text: #20252b;
  --muted: #68717d;
  --line: #cfd6df;
  --line-soft: #e5e9ef;
  --brand: #244f7a;
  --brand-dark: #183a5c;
  --brand-soft: #e7f0f8;
  --link: #1f5d92;
  --danger: #9f3412;
  --shadow: 0 1px 2px rgba(20, 32, 45, .08);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.42;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: linear-gradient(#315f8c, #244f7a);
  border-bottom: 1px solid var(--brand-dark);
  color: #fff;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.brand {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .01em;
}
.brand:hover { color: #fff; text-decoration: none; }
.topnav { display: flex; gap: 6px; align-items: center; }
.topnav a {
  color: #fff;
  padding: 9px 12px;
  border-radius: 3px;
  font-weight: 700;
}
.topnav a:hover { background: rgba(255,255,255,.12); text-decoration: none; }

.topbar { position: sticky; top: 0; z-index: 50; }
.page-title.classic-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.title-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.jump-target { scroll-margin-top: 66px; }

.wrap {
  width: min(1480px, calc(100% - 32px));
  margin: 18px auto 26px;
}

.breadcrumb {
  margin: 0 0 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}
.breadcrumb a { font-weight: 700; }

.page-title,
.event-title,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: var(--shadow);
}
.page-title,
.event-title { padding: 18px 20px; margin-bottom: 14px; }
.classic-title h1,
.event-title h1 { margin: 0; font-size: 26px; line-height: 1.15; }
.classic-title p { margin: 5px 0 0; color: var(--muted); }

.panel { padding: 16px; margin-bottom: 16px; }
.panel h2 {
  font-size: 18px;
  margin: -16px -16px 14px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(#f9fafc, #eef2f6);
  color: #26323f;
}
.panel-head {
  margin: -16px -16px 14px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(#f9fafc, #eef2f6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-head h2 { margin: 0; padding: 0; border: 0; background: transparent; }

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: var(--shadow);
  padding: 13px 14px;
}
.metric-value { font-size: 21px; font-weight: 800; color: #1d3147; }
.metric-label { color: var(--muted); margin-top: 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }

.filters {
  display: grid;
  grid-template-columns: 1.7fr .8fr 1fr auto;
  align-items: end;
  gap: 12px;
}
label { display: grid; gap: 5px; color: #3d4651; font-weight: 700; font-size: 13px; }
input,
select {
  width: 100%;
  height: 36px;
  border: 1px solid #b8c1cc;
  border-radius: 3px;
  background: #fff;
  color: var(--text);
  padding: 7px 9px;
  font: inherit;
}
input:focus,
select:focus {
  outline: 2px solid rgba(36, 79, 122, .18);
  border-color: #7095b7;
}
.filter-actions { display: flex; gap: 8px; align-items: center; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 13px;
  border-radius: 3px;
  border: 1px solid var(--brand-dark);
  background: linear-gradient(#346a9f, #244f7a);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { color: #fff; text-decoration: none; background: linear-gradient(#3a76b2, #285b8c); }
.btn.ghost {
  color: #26323f;
  border-color: #bcc5cf;
  background: linear-gradient(#fff, #eef2f6);
}
.btn.ghost:hover { color: #26323f; background: linear-gradient(#fff, #e3e8ef); }

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: #fff;
}
.data-table th,
.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  vertical-align: top;
}
.data-table th:last-child,
.data-table td:last-child { border-right: 0; }
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(#f5f7fa, #dfe6ee);
  color: #233044;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .035em;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.data-table thead th.sort-asc::after { content: ' ▲'; color: var(--brand); }
.data-table thead th.sort-desc::after { content: ' ▼'; color: var(--brand); }
.data-table tbody tr:nth-child(even) { background: #f9fbfd; }
.data-table tbody tr:hover { background: var(--brand-soft); }
.data-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.data-table .empty { text-align: center; color: var(--muted); padding: 18px; }
.public-events { min-width: 980px; }
.teams-table { min-width: 900px; }
.small-table { min-width: 520px; }
.clickable-row { cursor: pointer; }

.datatable-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.datatable-controls label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #3d4651;
}
.datatable-controls input { width: min(320px, 48vw); height: 32px; }
.datatable-info { color: var(--muted); font-size: 13px; white-space: nowrap; }

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

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border: 1px solid var(--line);
  background: #f2f5f8;
  margin: 0 0 16px;
  border-radius: 3px;
  box-shadow: var(--shadow);
}
.tab {
  display: inline-flex;
  padding: 10px 14px;
  border-right: 1px solid var(--line);
  color: #34475a;
  font-weight: 800;
}
.tab:hover { background: #fff; text-decoration: none; }
.tab.active { background: #fff; color: var(--brand); box-shadow: inset 0 3px 0 var(--brand); }

.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.details { display: grid; grid-template-columns: 135px 1fr; gap: 8px 14px; margin: 0; }
.details dt { color: var(--muted); font-weight: 700; }
.details dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.color-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: var(--dot, #64748b);
  border: 1px solid rgba(0,0,0,.3);
  vertical-align: -1px;
  margin-right: 7px;
}
.country-flag {
  display: inline-block;
  width: 1.6em;
  font-size: 17px;
  vertical-align: -1px;
}

.legacy-text {
  color: #20252b;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.html-content > :first-child { margin-top: 0; }
.html-content > :last-child { margin-bottom: 0; }
.html-content p { margin: 0 0 .75em; }
.html-content ul,
.html-content ol { margin-top: .4em; margin-bottom: .8em; }
.html-content img { max-width: 100%; height: auto; border: 1px solid var(--line); padding: 2px; background: #fff; }
.html-content table { border-collapse: collapse; max-width: 100%; margin: 10px 0; }
.html-content th,
.html-content td { border: 1px solid var(--line); padding: 6px 8px; }
.html-content blockquote { margin: 10px 0; padding: 8px 12px; border-left: 4px solid var(--line); background: var(--panel-soft); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: #f4f6f8;
  color: #394656;
  font-size: 12px;
  font-weight: 800;
}

.footer {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto 24px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.page-loader {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(233,237,242,.72);
  backdrop-filter: blur(2px);
  z-index: 9999;
}
.page-loader.visible { display: flex; }
.loader-box {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 6px 24px rgba(15,23,42,.22);
  font-weight: 800;
  color: #26323f;
}
.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid #cbd5e1;
  border-top-color: var(--brand);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 960px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: 1fr; }
  .grid.two { grid-template-columns: 1fr; }
  .details { grid-template-columns: 1fr; }
  .details dt { margin-top: 6px; }
}

@media (max-width: 560px) {
  .wrap { width: min(100% - 20px, 1480px); margin-top: 12px; }
  .topbar { padding: 6px 12px; min-height: 48px; gap: 8px; flex-wrap: wrap; }
  .brand { font-size: 16px; }
  .topnav { gap: 4px; }
  .topnav a { padding: 7px 9px; }
  .page-title.classic-title { align-items: flex-start; flex-direction: column; }
  .title-actions { width: 100%; }
  .title-actions .btn { flex: 1; }
  .metrics { grid-template-columns: 1fr; }
  .classic-title h1,
  .event-title h1 { font-size: 22px; }
  .datatable-controls { align-items: stretch; flex-direction: column; }
  .datatable-controls label { justify-content: space-between; }
  .datatable-controls input { width: 100%; }
  .filter-actions { align-items: stretch; }
  .btn { flex: 1; }
}
