/* ==========================================================================
   iPico Wiz Results — design system
   Light, modern, race-timing aesthetic (comparable to modern timing sites,
   but distinct: teal accent, Manrope, warm-grey background).
   ========================================================================== */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;
  --border: #e5e9ef;
  --border-strong: #d7dce3;
  --accent: #0d9488;
  --accent-strong: #0f766e;
  --accent-ink: #0b5f57;
  --accent-soft: #e2f6f3;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --warning: #b45309;
  --warning-soft: #fdf3e3;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .07), 0 1px 3px rgba(15, 23, 42, .05);
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  margin: 0;
}

a { color: var(--accent-strong); text-decoration: none; }
a:hover { color: var(--accent-ink); }

/* ------------------------------------------------------------------ header */
.site-header {
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: .8rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -.02em;
  color: var(--text);
}
.brand:hover { color: var(--text); }
.brand-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.brand-sub { color: var(--faint); font-weight: 600; font-size: .8rem; letter-spacing: .02em; margin-left: auto; }

/* ----------------------------------------------------------------- layout */
.container-page { max-width: 1120px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }

.page-title { font-weight: 800; font-size: 1.9rem; letter-spacing: -.025em; margin: 0; line-height: 1.15; }
.page-sub { color: var(--muted); margin: .4rem 0 0; font-size: .95rem; }

/* ------------------------------------------------------- segmented tabs */
.tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  background: #e9edf2;
  border-radius: 999px;
  padding: 4px;
}
.tab {
  padding: .42rem 1.05rem;
  border-radius: 999px;
  font-weight: 650;
  font-size: .86rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.tab:hover { color: var(--text); }
.tab.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }
.tab .badge-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: .4rem; vertical-align: middle; }

/* ------------------------------------------------------------- sections */
.section { margin-top: 1.6rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .5rem; margin-bottom: .85rem; }
.section-title { font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.count { color: var(--muted); font-size: .88rem; }

/* -------------------------------------------------------------- cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 1.15rem; }

/* race cards (landing) */
.race-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.race-card { display: flex; flex-direction: column; }
.race-card .race-date {
  text-transform: uppercase;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--accent-strong);
  margin-bottom: .45rem;
}
.race-card .race-name { font-weight: 800; font-size: 1.08rem; letter-spacing: -.01em; line-height: 1.25; }
.race-card .race-actions { margin-top: auto; padding-top: 1rem; display: flex; flex-wrap: wrap; gap: .5rem; }

/* ------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-family: var(--font);
  font-weight: 650;
  font-size: .86rem;
  border-radius: 999px;
  padding: .5rem 1.05rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  line-height: 1.2;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); color: #fff; }
.btn-outline { background: #fff; color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #eceff3; color: var(--text); }
.btn-sm { padding: .38rem .85rem; font-size: .82rem; }

/* -------------------------------------------------------------- inputs */
.form-control, .form-select {
  font-family: var(--font);
  font-size: .9rem;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: .5rem .75rem;
  min-height: 40px;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}
.form-control::placeholder { color: var(--faint); }
.form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .7rem center;
  padding-right: 2.1rem;
}
.form-label { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .35rem; display: block; }

/* filter bar */
.filterbar { padding: 1rem 1.1rem; }
.filter-grid { display: flex; flex-wrap: wrap; gap: .85rem; align-items: flex-end; }
.filter-field { display: flex; flex-direction: column; }
.filter-field .form-control, .filter-field .form-select { min-width: 150px; }
.filter-field.grow { flex: 1 1 280px; }
.filter-field.grow .form-control { width: 100%; min-width: 0; }

/* ---------------------------------------------------------------- table */
.table-wrap { overflow-x: auto; }
.results-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.results-table thead th {
  background: #eef1f5;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  text-align: left;
  padding: .55rem .85rem;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.results-table thead th:first-child { border-top-left-radius: var(--radius-sm); border-bottom-left-radius: var(--radius-sm); }
.results-table thead th:last-child { border-top-right-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }
.results-table tbody td {
  padding: .6rem .85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.results-table tbody tr:last-child td { border-bottom: none; }
.results-table tbody tr:hover td { background: #fafbfc; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.place {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--faint);
  text-align: right;
  width: 2.4rem;
}
.place.top1 { color: var(--warning); }
.place.top2 { color: var(--muted); }
.place.top3 { color: #b0783a; }
.bib { font-variant-numeric: tabular-nums; font-weight: 700; }
.name-cell { font-weight: 650; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.chip {
  display: inline-block;
  padding: .14rem .55rem;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 650;
  background: #eef1f5;
  color: var(--muted);
  white-space: nowrap;
}

/* search match highlight */
.results-table tbody tr.highlight td { background: #fef3c7; }
.results-table tbody tr.highlight td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
.results-table tbody tr.highlight:hover td { background: #fdf0d0; }

/* live row kinds */
.live-start td { background: var(--accent-soft) !important; }
.live-start .name-cell { color: var(--accent-ink); font-style: normal; font-weight: 700; }

/* -------------------------------------------------------------- footer */
.site-footer { border-top: 1px solid var(--border); margin-top: 2rem; padding: 1.5rem 1.25rem; }
.site-footer-inner { max-width: 1120px; margin: 0 auto; color: var(--faint); font-size: .82rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* empty state */
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty .empty-emoji { font-size: 2rem; display: block; margin-bottom: .5rem; }

/* follow input */
.follow-box { display: flex; gap: .6rem; max-width: 520px; }
.follow-box .form-control { flex: 1 1 auto; }

@media (max-width: 600px) {
  .page-title { font-size: 1.5rem; }
  .filter-grid { flex-direction: column; align-items: stretch; }
  .filter-field .form-control, .filter-field .form-select { min-width: 0; width: 100%; }
}
