/* TVS TriUnity Challenge 2026 — dashboard styles.
   Brand: deep blue #144f92, jasper orange #f47c22 (spec §6). */
:root {
  --blue: #144f92;
  --blue-dark: #0e3a6e;
  --orange: #f47c22;
  --ink: #1a2433;
  --muted: #6b7a90;
  --bg: #eef2f7;
  --card: #ffffff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: var(--blue); }

/* ===== Hero ===== */
.hero {
  background: linear-gradient(120deg, var(--blue-dark) 0%, var(--blue) 55%, #1f6fc4 100%);
  color: #fff;
  padding: 2.4rem 1.5rem;
  box-shadow: 0 6px 24px rgba(20, 79, 146, 0.35);
}
.hero-inner {
  max-width: 1650px; margin: 0 auto;   /* 1.5x the original 1100px (desktop only) */
  display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap;
}
.logomark {
  width: 84px; height: 84px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
.hero-text { flex: 1; min-width: 240px; }
.kicker { text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.72rem;
  opacity: 0.85; margin: 0 0 0.3rem; }
.hero h1 { margin: 0; font-size: clamp(1.8rem, 4.5vw, 3rem); font-weight: 800; }
.hero h1 span { color: var(--orange); }
.tagline { margin: 0.4rem 0 0; opacity: 0.9; }
.login-group { display: flex; flex-direction: column; align-items: flex-end; gap: 0.6rem; }
.login-btn {
  background: var(--orange); color: #fff; text-decoration: none; font-weight: 700;
  padding: 0.7rem 1.3rem; border-radius: 10px; white-space: nowrap;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.login-btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.login-hint {
  display: flex; align-items: flex-start; gap: 0.5rem;
  background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.22);
  border-radius: 10px; padding: 0.6rem 0.9rem;
  font-size: 0.8rem; color: #dce8f7; line-height: 1.55; max-width: 320px;
}
.login-hint i { color: var(--orange); margin-top: 0.15rem; flex: none; }
.login-hint code {
  background: rgba(255,255,255,0.15); border-radius: 4px;
  padding: 0.05rem 0.35rem; font-family: ui-monospace, monospace; color: #fff;
}
.guide-link {
  display: inline-flex; align-items: center; gap: 0.45rem;
  color: #cfe0f5; text-decoration: none; font-size: 0.82rem; font-weight: 600;
  padding: 0.45rem 0.8rem; border-radius: 8px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.18);
  transition: background 0.15s ease, color 0.15s ease;
}
.guide-link:hover { background: rgba(255,255,255,0.16); color: #fff; }
.guide-link i { color: var(--orange); font-size: 0.85rem; }
.strava-link {
  display: inline-flex; align-items: center;
  text-decoration: none;
  transition: filter 0.15s ease, transform 0.15s ease;
}
.strava-link:hover { filter: brightness(1.06); transform: translateY(-1px); }
.strava-link img { height: 38px; width: auto; display: block; }
.strava-connected {
  display: inline-flex; align-items: center; gap: 0.45rem;
  color: #a8f0c6; font-size: 0.82rem; font-weight: 600;
  padding: 0.45rem 0.8rem; border-radius: 8px;
  background: rgba(40,200,100,0.15); border: 1px solid rgba(40,200,100,0.35);
}
@media (max-width: 600px) { .login-group { align-items: stretch; } .login-hint { max-width: 100%; } .guide-link { justify-content: center; } .strava-link { justify-content: center; } .strava-connected { justify-content: center; } }
.frozen-badge {
  display: inline-flex; align-items: center; gap: 0.45rem;
  margin: 0.5rem 0 0; padding: 0.35rem 0.85rem; border-radius: 20px;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em;
  background: rgba(255,255,255,0.18); border: 1px solid rgba(255,255,255,0.40);
  color: #e0ecff;
}
.frozen-badge i { color: var(--orange); }
.phase2-badge {
  display: inline-flex; align-items: center; gap: 0.45rem;
  margin: 0.5rem 0 0; padding: 0.35rem 0.85rem; border-radius: 20px;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em;
  background: rgba(244,124,34,0.22); border: 1px solid rgba(244,124,34,0.55);
  color: #ffe0c0;
}
.phase2-badge i { color: var(--orange); }

/* ===== Layout ===== */
/* Desktop content area widened 1.5x (1100px -> 1650px). On narrower screens this
   cap is never reached, so tablet/mobile keep full-width-minus-padding layout. */
.wrap { max-width: 1650px; margin: 0 auto; padding: 1.5rem; }
.panel {
  background: var(--card); border-radius: 16px; padding: 1.5rem 1.6rem;
  margin-bottom: 1.5rem; box-shadow: 0 8px 30px rgba(20, 79, 146, 0.08);
}
.panel h2 { margin: 0 0 1.1rem; color: var(--blue); font-size: 1.2rem; }
.panel h2 i { color: var(--orange); margin-right: 0.4rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } }

/* ===== Stats strip ===== */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; margin: -3rem 0 1.5rem; }
.stat {
  background: var(--card); border-radius: 14px; padding: 1.1rem 0.8rem; text-align: center;
  box-shadow: 0 8px 24px rgba(20, 79, 146, 0.12);
}
.stat i { color: var(--blue); font-size: 1.3rem; }
.stat.accent i { color: var(--orange); }
.stat .num { display: block; font-size: 1.6rem; font-weight: 800; margin-top: 0.25rem; }
.stat .lbl { display: block; font-size: 0.75rem; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.05em; }
@media (max-width: 700px) { .stats { grid-template-columns: repeat(2, 1fr); margin-top: 1rem; } }

/* ===== Podium ===== */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 1rem; }
.podium-col { flex: 1; max-width: 220px; text-align: center; }
.podium-card {
  background: linear-gradient(160deg, #fff, #f3f7fc); border: 1px solid #e3ebf5;
  border-radius: 14px 14px 0 0; padding: 1.1rem 0.8rem 1.4rem; position: relative;
}
.rank-badge {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  background: var(--blue); color: #fff; font-weight: 800; font-size: 0.8rem;
  width: 30px; height: 30px; line-height: 30px; border-radius: 50%;
}
.podium-card h3 { margin: 0.7rem 0 0.2rem; color: var(--blue); font-size: 1rem; }
.podium-score { font-size: 1.5rem; font-weight: 800; margin: 0.3rem 0 0; }
.podium-meta { font-size: 0.78rem; color: var(--muted); margin: 0.1rem 0 0; }
.podium-base {
  color: #fff; font-weight: 800; font-size: 1.4rem; border-radius: 0 0 8px 8px;
  display: flex; align-items: center; justify-content: center;
}
.place-1 .podium-base { background: var(--orange); height: 90px; }
.place-1 .rank-badge { background: var(--orange); }
.place-2 .podium-base { background: var(--blue); height: 62px; }
.place-3 .podium-base { background: #6f8db5; height: 44px; }

/* ===== Bars ===== */
.bars { list-style: none; padding: 0; margin: 0; }
.bars li { margin-bottom: 0.9rem; }
.bar-head { display: flex; justify-content: space-between; font-size: 0.9rem; margin-bottom: 0.3rem; }
.bar-head strong { color: var(--blue); }
.bar-head .cap { color: var(--muted); font-weight: 600; font-size: 0.78rem; margin-left: 0.4rem; }
.bar-head .cap i { color: var(--orange); margin-right: 0.2rem; }
.bar-track { background: #e6ecf4; border-radius: 8px; height: 14px; overflow: hidden; }
.bar-fill {
  height: 100%; border-radius: 8px;
  background: linear-gradient(90deg, var(--blue), #2f7fd0);
  transition: width 0.6s ease;
}
.bars li:first-child .bar-fill { background: linear-gradient(90deg, var(--orange), #ffa459); }

/* ===== Leaderboard table ===== */
table.leaderboard { width: 100%; border-collapse: collapse; }
table.leaderboard th { text-align: left; font-size: 0.75rem; text-transform: uppercase;
  color: var(--muted); padding: 0.4rem 0.5rem; border-bottom: 2px solid #eef2f7; }
table.leaderboard td { padding: 0.5rem; border-bottom: 1px solid #f1f5fa; font-size: 0.92rem; }
table.leaderboard .rk { font-weight: 800; color: var(--blue); width: 2rem; }
table.leaderboard .score { font-weight: 700; text-align: right; }
table.leaderboard .sub { display: block; font-size: 0.74rem; color: var(--muted); }
table.leaderboard tr.gold td { background: #fff6ec; }
table.leaderboard tr.gold .rk { color: var(--orange); }

/* "See full list" links below the Top Individuals table */
.see-all {
  margin: 1rem 0 0; text-align: center;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem;
}
.see-all-link {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-weight: 700; font-size: 0.9rem; text-decoration: none; color: var(--blue);
  padding: 0.55rem 1.1rem; border-radius: 10px; background: #eef3fa;
  border: 1px solid #dce7f4; transition: background 0.15s ease, transform 0.15s ease;
}
.see-all-link:hover { background: #fff1e3; color: var(--orange); transform: translateY(-1px); }
.see-all-link i { font-size: 0.85rem; }

/* ===== Category champions ===== */
.champs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 700px) { .champs { grid-template-columns: 1fr; } }
.champ {
  text-align: center; padding: 1.3rem 1rem; border-radius: 14px; color: #fff;
  background: linear-gradient(155deg, var(--blue), var(--blue-dark));
}
.champ-run { background: linear-gradient(155deg, var(--orange), #d9641a); }
.champ i { font-size: 1.8rem; opacity: 0.9; }
.champ h4 { margin: 0.5rem 0 0.6rem; text-transform: uppercase; letter-spacing: 0.08em; }
.champ-name { font-size: 1.1rem; font-weight: 700; margin: 0; }
.champ-name.muted { opacity: 0.75; font-weight: 500; font-size: 0.95rem; }
.champ-pts { margin: 0.2rem 0 0; opacity: 0.92; }

/* ===== Rules ===== */
.rules-meta { color: var(--muted); font-size: 0.9rem; }
.rules-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 1rem 0; }
@media (max-width: 820px) { .rules-grid { grid-template-columns: 1fr; } }
.rule-card { background: #f6f9fd; border: 1px solid #e6eef7; border-radius: 12px; padding: 1.1rem; }
.rule-card h4 { margin: 0 0 0.5rem; color: var(--blue); }
.rule-card h4 i { color: var(--orange); margin-right: 0.35rem; }
.rule-card ul { margin: 0.4rem 0 0; padding-left: 1.1rem; }
.rule-card li { margin: 0.25rem 0; }
.rules-sub { color: var(--blue); margin-bottom: 0.3rem; }

/* ===== Activity feed ===== */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li {
  display: flex; align-items: center; gap: 0.8rem; padding: 0.6rem 0.2rem;
  border-bottom: 1px solid #f1f5fa;
}
.feed-ico {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: #eef3fa; color: var(--blue);
}
.feed-main { flex: 1; display: flex; flex-direction: column; }
.feed-sub { font-size: 0.78rem; color: var(--muted); }
.feed-pts { font-weight: 800; color: var(--orange); }
.feed-date { font-size: 0.78rem; color: var(--muted); width: 5.5rem; text-align: right; }
@media (max-width: 560px) { .feed-date { display: none; } }

/* ===== Inactive members (dimmed, points still counted) ===== */
table.leaderboard tr.is-inactive td,
.fluct-table tr.is-inactive td,
.tvs-table tbody tr.is-inactive td { opacity: 0.5; }
.feed li.is-inactive { opacity: 0.5; }
.champ.is-inactive { opacity: 0.5; }
.inactive-tag {
  display: inline-block; font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); background: #eef2f7;
  border-radius: 999px; padding: 0.05rem 0.45rem; vertical-align: middle;
}
.champ .inactive-tag { background: rgba(255,255,255,0.25); color: #fff; }

/* ===== Footer ===== */
.foot { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 1rem 0 2rem; }
.powered-by-strava { margin-top: 0.6rem; opacity: 0.65; }
.powered-by-strava img { height: 20px; width: auto; }

/* ===== Activity log heading meta ===== */
.panel h2 .log-meta {
  font-size: 0.78rem; font-weight: 400; color: var(--muted);
  margin-left: 0.6rem; letter-spacing: 0;
}

/* ===== Period label (week/month date range) ===== */
.period-label { font-size: 0.78rem; color: var(--muted); margin: -0.5rem 0 0.8rem; }
.period-label i { color: var(--orange); margin-right: 0.3rem; }

/* ===== Fluctuation / top-users table ===== */
.fluct-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.fluct-table thead th {
  text-align: left; font-size: 0.72rem; text-transform: uppercase;
  color: var(--muted); padding: 0.35rem 0.5rem; border-bottom: 2px solid #eef2f7;
}
.fluct-table tbody td { padding: 0.45rem 0.5rem; border-bottom: 1px solid #f1f5fa; vertical-align: middle; }
.fluct-table tbody tr:last-child td { border-bottom: none; }
.fluct-table .rk { font-weight: 800; color: var(--blue); width: 2rem; }
.fluct-table .pts { font-weight: 700; text-align: right; color: var(--orange); }
.fluct-table tr.top1 td { background: #fff6ec; }
.fluct-table tr.top1 .rk { color: var(--orange); }
.no-data { color: var(--muted); font-size: 0.88rem; font-style: italic; padding: 0.5rem; }

/* ===== Public Activity Log table ===== */
.tvs-toolbar {
  display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.6rem; flex-wrap: wrap;
}
.tvs-search {
  flex: 1; min-width: 180px; padding: 0.4rem 0.7rem;
  border: 1px solid #dce7f4; border-radius: 8px; font-size: 0.87rem;
}
.tvs-search:focus {
  outline: none; border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(244,124,34,.15);
}
.tvs-count { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }

.tvs-table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid #dce7f4; }
.tvs-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
.tvs-table thead tr { background: var(--blue); color: #fff; }
.tvs-table thead th {
  padding: 0.55rem 0.7rem; text-align: left; font-weight: 700;
  white-space: nowrap; cursor: pointer; user-select: none;
}
.tvs-table thead th:hover { background: var(--blue-dark); }
.tvs-table thead th .sort-icon { opacity: 0.5; margin-left: 0.2rem; font-size: 0.7rem; }
.tvs-table thead th.sorted .sort-icon { opacity: 1; }
.tvs-table tbody tr:nth-child(even) { background: #f6f9fd; }
.tvs-table tbody tr:hover { background: #fff6ec; }
.tvs-table tbody td { padding: 0.45rem 0.7rem; border-bottom: 1px solid #eef2f7; vertical-align: middle; }
.tvs-table tbody tr:last-child td { border-bottom: none; }
.tvs-table code {
  background: #eef3fa; border-radius: 4px; padding: .05rem .35rem;
  font-size: .85em; color: var(--blue-dark);
}
.tvs-badge {
  display: inline-block; border-radius: 999px; padding: 0.15rem 0.5rem;
  font-size: 0.72rem; font-weight: 700;
}
.tvs-badge-walk { background: #e6f4ea; color: #145525; }
.tvs-badge-run  { background: #e7f0fb; color: var(--blue); }
.tvs-badge-ride { background: #fff3cd; color: #856404; }
.tvs-badge-other { background: #f1eefb; color: #5b4b8a; }
.tvs-badge-manual { background: #e7f0fb; color: var(--blue); }
.tvs-badge-excel  { background: #e6f4ea; color: #145525; }

/* ===== Pagination controls ===== */
.pg-controls {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  margin-top: 1rem; flex-wrap: wrap;
}
.pg-btn {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.4rem 0.85rem; border-radius: 8px; border: 1px solid #dce7f4;
  background: #fff; color: var(--blue); text-decoration: none;
  font-size: 0.85rem; font-weight: 600;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.pg-btn:hover { background: var(--blue); color: #fff; border-color: var(--blue); }
.pg-btn.disabled { opacity: 0.38; pointer-events: none; }
.pg-info { font-size: 0.85rem; color: var(--muted); padding: 0 0.3rem; }

/* ===== Mobile (≤ 600px) ===== */
@media (max-width: 600px) {
  .hero { padding: 1.5rem 1rem; }
  .hero-inner { gap: 0.75rem; }
  .logomark { width: 60px; height: 60px; }
  .hero-text { min-width: 180px; }
  .hero h1 { font-size: 1.6rem; }

  .wrap { padding: 1rem 0.75rem; }
  .panel { padding: 1.1rem 1rem; }
  .panel h2 { font-size: 1.1rem; }

  /* Stats: 3 columns on narrow screens instead of 2 */
  .stats { grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
  .stat { padding: 0.85rem 0.4rem; }
  .stat .num { font-size: 1.3rem; }
  .stat .lbl { font-size: 0.65rem; }
  .stat i { font-size: 1.1rem; }

  /* Podium: stack vertically in rank order */
  .podium { flex-direction: column; align-items: stretch; gap: 0.5rem; }
  .podium-col { max-width: 100%; flex: none; display: flex; flex-direction: column; }
  .place-1 { order: 1; }
  .place-2 { order: 2; }
  .place-3 { order: 3; }
  .podium-card { border-radius: 10px; padding: 0.8rem 1rem 0.8rem 2.8rem; }
  .rank-badge {
    position: absolute; top: 50%; left: 0.9rem; transform: translateY(-50%);
    width: 26px; height: 26px; line-height: 26px; font-size: 0.75rem; border-radius: 8px;
  }
  .podium-card h3 { margin: 0 0 0.15rem; font-size: 0.95rem; }
  .podium-score { font-size: 1.25rem; margin: 0; }
  .podium-meta { margin: 0; font-size: 0.75rem; }
  .place-1 .podium-base { height: 36px; }
  .place-2 .podium-base { height: 30px; }
  .place-3 .podium-base { height: 26px; }
  .podium-base { font-size: 1rem; border-radius: 0 0 6px 6px; }

  /* Top Individuals leaderboard: hide Team column */
  table.leaderboard th:nth-child(3),
  table.leaderboard td:nth-child(3) { display: none; }
}
