:root {
  --canvas: #f4f5f0;
  --surface: #ffffff;
  --ink: #18201b;
  --muted: #6f766f;
  --line: #dfe2da;
  --green: #286246;
  --green-soft: #e7f0e9;
  --red: #a7463d;
  --red-soft: #f6e9e7;
  --amber: #9a6a12;
  --amber-soft: #f5edd9;
  --sidebar: #1b241f;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}
button, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 216px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar);
  color: #f5f7f3;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; padding: 0 8px 26px; }
.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: #d7ad42;
  color: #172019;
  font-weight: 800;
  border-radius: 6px;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 2px; color: #aab3ac; font-size: 11px; }
.nav-list { display: grid; gap: 4px; }
.nav-list a {
  color: #aeb8b1;
  text-decoration: none;
  padding: 10px 12px;
  border-left: 2px solid transparent;
}
.nav-list a:hover, .nav-list a.active { color: #fff; background: #27322c; border-left-color: #d7ad42; }
.sidebar-status { margin-top: auto; padding: 12px 8px 0; color: #aeb8b1; font-size: 12px; display: flex; align-items: center; gap: 8px; }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: #58a778; box-shadow: 0 0 0 3px rgba(88, 167, 120, .14); }

main { min-width: 0; padding: 0 40px 64px; }
.topbar { min-height: 156px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.eyebrow, .section-kicker { margin: 0 0 8px; color: var(--green); font-size: 11px; font-weight: 800; }
h1, h2, p { letter-spacing: 0; }
h1 { margin: 0; font-size: 30px; line-height: 1.2; }
h2 { margin: 0; font-size: 20px; line-height: 1.25; }
.updated { margin: 9px 0 0; color: var(--muted); font-size: 12px; }
.refresh-button { border: 1px solid #bfc5bc; background: var(--surface); color: var(--ink); padding: 9px 14px; border-radius: 5px; cursor: pointer; }
.refresh-button:hover { border-color: var(--green); color: var(--green); }
.refresh-button:disabled { opacity: .55; cursor: wait; }

.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; margin-top: 28px; }
.metric-item { padding: 22px 24px; min-width: 0; }
.metric-item + .metric-item { border-left: 1px solid var(--line); }
.metric-item span, .metric-item small { display: block; color: var(--muted); }
.metric-item span { font-size: 12px; font-weight: 700; }
.metric-item strong { display: block; margin: 9px 0 5px; font-size: 28px; line-height: 1; }
.metric-item small { font-size: 11px; }

.content-section { padding-top: 42px; scroll-margin-top: 18px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.segmented { display: inline-flex; border: 1px solid #cfd4cc; border-radius: 5px; overflow: hidden; background: var(--surface); }
.segmented button { min-width: 66px; border: 0; border-right: 1px solid #cfd4cc; background: transparent; padding: 8px 12px; color: var(--muted); cursor: pointer; }
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: var(--ink); color: #fff; }

.table-frame { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
table { width: 100%; min-width: 720px; border-collapse: collapse; }
th, td { padding: 13px 16px; text-align: left; border-bottom: 1px solid #eceee9; white-space: nowrap; }
th { color: var(--muted); font-size: 11px; font-weight: 700; background: #fafbf8; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbf8; }
.league-name strong, .match-name strong { display: block; font-size: 13px; }
.league-name small, .match-name small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.match-name a { color: var(--ink); text-decoration: none; }
.match-name a:hover { color: var(--green); text-decoration: underline; }
.rate-cell { min-width: 190px; }
.rate-line { display: flex; align-items: center; gap: 10px; }
.rate-value { min-width: 48px; font-weight: 750; }
.meter { width: 94px; height: 5px; background: #e7e9e3; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--green); }
.sample-note { color: var(--muted); font-size: 12px; }

.records-heading { align-items: end; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.filters select { border: 1px solid #cfd4cc; background: var(--surface); color: var(--ink); border-radius: 5px; padding: 8px 30px 8px 10px; }
.role-label { color: var(--muted); font-size: 12px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.hit { color: var(--green); }
.status.miss { color: var(--red); }
.status.pending { color: var(--amber); }
.status.other { color: var(--muted); }
.empty-state { margin: 14px 0 0; color: var(--muted); }

.parlay-summary { display: flex; gap: 18px; color: var(--muted); font-size: 12px; }
.parlay-summary strong { color: var(--ink); }
.parlay-list { display: grid; gap: 10px; }
.parlay-row { display: grid; grid-template-columns: 140px minmax(0, 1fr) 100px 92px; align-items: center; gap: 20px; padding: 17px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.parlay-role strong { display: block; }
.parlay-role small { color: var(--muted); }
.parlay-legs { min-width: 0; }
.parlay-legs span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.parlay-legs span + span { margin-top: 5px; }
.combined-odds { font-size: 18px; font-weight: 800; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 176px minmax(0, 1fr); }
  main { padding-left: 24px; padding-right: 24px; }
  .metric-item { padding: 20px 16px; }
  .parlay-row { grid-template-columns: 125px minmax(0, 1fr) 80px; }
  .parlay-row .status { grid-column: 3; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; }
  .brand { padding: 0; }
  .brand-mark { width: 32px; height: 32px; }
  .nav-list { grid-column: 1 / -1; display: flex; overflow-x: auto; border-top: 1px solid #303b35; padding-top: 8px; }
  .nav-list a { padding: 8px 10px; border-left: 0; border-bottom: 2px solid transparent; white-space: nowrap; }
  .nav-list a:hover, .nav-list a.active { border-left-color: transparent; border-bottom-color: #d7ad42; }
  .sidebar-status { margin: 0; padding: 0; }
  main { padding: 0 16px 42px; }
  .topbar { min-height: 132px; }
  h1 { font-size: 25px; }
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-item:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .metric-item:nth-child(4) { border-top: 1px solid var(--line); }
  .section-heading, .records-heading { align-items: stretch; flex-direction: column; }
  .segmented { align-self: flex-start; }
  .filters { justify-content: flex-start; }
  .parlay-summary { flex-wrap: wrap; gap: 8px 16px; }
  .parlay-row { grid-template-columns: 1fr auto; gap: 12px; }
  .parlay-legs { grid-column: 1 / -1; }
  .parlay-row .status { grid-column: auto; }
}

@media (max-width: 430px) {
  .sidebar-status { display: none; }
  .refresh-button { padding: 8px 10px; }
  .metric-item { padding: 17px 14px; }
  .metric-item strong { font-size: 24px; }
  .filters select { flex: 1 1 120px; min-width: 0; }
}
