/* TVS TriUnity Challenge 2026 — full members listing.
   A deliberately distinctive look from the dashboard: dark banded hero, team
   "cards" with coloured rails, and zebra tables. Brand: #144f92 / #f47c22. */
:root {
  --blue: #144f92;
  --blue-dark: #0e3a6e;
  --orange: #f47c22;
  --ink: #1a2433;
  --muted: #6b7a90;
  --bg: #0e1b2e;
  --card: #ffffff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  /* Distinctive deep diagonal backdrop. */
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(244, 124, 34, 0.18), transparent 60%),
    linear-gradient(160deg, #0e1b2e 0%, #13294a 60%, #0e3a6e 100%);
  background-attachment: fixed;
  min-height: 100vh;
}
a { color: var(--orange); }

/* ===== Hero ===== */
.m-hero {
  max-width: 1200px; margin: 0 auto; padding: 2.6rem 1.5rem 1.4rem;
  color: #fff;
}
.m-hero .crumb {
  display: inline-flex; align-items: center; gap: 0.4rem;
  color: #cfe0f5; text-decoration: none; font-size: 0.85rem; opacity: 0.9;
}
.m-hero .crumb:hover { opacity: 1; }
.m-hero h1 {
  margin: 0.6rem 0 0.3rem; font-size: clamp(1.7rem, 4vw, 2.6rem); font-weight: 800;
  letter-spacing: -0.01em;
}
.m-hero h1 span { color: var(--orange); }
.m-hero .sub { margin: 0; color: #b9cbe4; }
.m-hero .sub .clear-filter { margin-left: 0.5rem; color: var(--orange); font-weight: 600; }
.m-hero .sub .clear-filter:hover { text-decoration: underline; }
.m-hero .phase-note {
  margin: 0.5rem 0 0; font-size: 0.82rem; color: #9fb4d1;
}
.m-hero .phase-note i { color: var(--orange); margin-right: 0.3rem; }
.m-hero .phase-note a { margin-left: 0.4rem; color: var(--orange); font-weight: 600; }
.m-hero .phase-note a:hover { text-decoration: underline; }
.m-hero-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem;
  margin-top: 1.4rem;
}
.m-count {
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px; padding: 0.45rem 1rem; font-size: 0.85rem; color: #dce8f7;
}
.m-count strong { color: #fff; }
.export-group {
  margin-left: auto; display: inline-flex; align-items: center; gap: 0.55rem; flex-wrap: wrap;
}
.export-date-label {
  font-size: 0.82rem; color: #c8d8ef; font-weight: 600; white-space: nowrap;
}
.export-date-input {
  padding: 0.45rem 0.6rem; border-radius: 8px; border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.1); color: #fff; font-size: 0.85rem;
  cursor: pointer; outline: none;
}
.export-date-input::-webkit-calendar-picker-indicator { filter: invert(1); opacity: 0.7; cursor: pointer; }
.export-date-input:focus { border-color: rgba(255,255,255,0.5); background: rgba(255,255,255,0.15); }
.btn-export {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--orange); color: #fff; border: none; cursor: pointer; font-weight: 700;
  padding: 0.65rem 1.2rem; border-radius: 10px;
  box-shadow: 0 8px 22px rgba(244, 124, 34, 0.35);
  transition: transform 0.15s ease, filter 0.15s ease; font-size: 0.9rem;
}
.btn-export:hover { transform: translateY(-2px); filter: brightness(1.05); }

/* ===== Sections ===== */
.m-wrap { max-width: 1200px; margin: 0 auto; padding: 0.6rem 1.5rem 3rem; }
.no-results {
  text-align: center; color: var(--muted); font-size: 0.95rem;
  background: var(--card); border-radius: 14px; padding: 2.5rem 1rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}
.team-section {
  background: var(--card); border-radius: 16px; overflow: hidden;
  margin-bottom: 1.6rem; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  border-left: 6px solid var(--blue);
}
.team-section:nth-child(odd) { border-left-color: var(--orange); }

.team-head {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 1.1rem 1.4rem; color: #fff;
  background: linear-gradient(120deg, var(--blue-dark), var(--blue));
}
.team-section:nth-child(odd) .team-head {
  background: linear-gradient(120deg, #c8631a, var(--orange));
}
.team-badge {
  width: 44px; height: 44px; flex: none; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.16); font-weight: 800; font-size: 1.1rem;
}
.team-head h2 { margin: 0; font-size: 1.2rem; }
.team-head .team-meta { margin: 0; font-size: 0.8rem; opacity: 0.85; }

/* ===== Table ===== */
.m-table { width: 100%; border-collapse: collapse; }
.m-table th {
  text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); padding: 0.7rem 1rem; border-bottom: 2px solid #eef2f7;
  background: #f7fafe;
}
.m-table td { padding: 0.65rem 1rem; border-bottom: 1px solid #f1f5fa; font-size: 0.92rem; }
.m-table tbody tr:nth-child(even) { background: #fafcff; }
.m-table tbody tr:hover { background: #fff6ec; }
.m-table .col-no { width: 3rem; color: var(--muted); font-weight: 700; text-align: center; }
.m-table .col-rank { width: 4rem; text-align: center; }
.rank-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.7rem; height: 1.7rem; border-radius: 50%; font-weight: 800; font-size: 0.82rem;
}
.rank-1 { background: #ffd700; color: #7a5500; }
.rank-2 { background: #c0c0c0; color: #444; }
.rank-3 { background: #cd7f32; color: #fff; }
.rank-plain { color: var(--muted); font-weight: 700; font-size: 0.88rem; }
.m-table .col-user { font-family: "SF Mono", ui-monospace, Menlo, monospace;
  color: var(--blue); font-weight: 700; white-space: nowrap; }
.m-table .col-name { font-weight: 600; }

/* ===== Inactive members (dimmed, points still counted) ===== */
.m-table tbody tr.is-inactive { opacity: 0.5; }
.m-table tbody tr.is-inactive:hover { opacity: 0.75; }
.inactive-tag {
  display: inline-block; font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); background: #eef2f7;
  border-radius: 999px; padding: 0.1rem 0.5rem; margin-left: 0.3rem; vertical-align: middle;
}
.m-table .col-strava { color: var(--muted); }
.m-table .col-strava-status { white-space: nowrap; }
.strava-status { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.82rem; font-weight: 600; }
.strava-status.connected { color: #fc4c02; }
.strava-status.not-connected { color: var(--muted); font-weight: 500; }
.m-table .col-score { text-align: right; font-weight: 800; color: var(--blue); white-space: nowrap; }
.m-table .muted { color: #b5c0cf; }
.m-table tbody tr:first-child .col-score { color: var(--orange); }

/* ===== Detail (stats) button ===== */
.m-table .col-detail { width: 3.6rem; text-align: center; }
.detail-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.15rem; height: 2.15rem; padding: 0; line-height: 1; font-size: 1.05rem;
  border: 1px solid #dde7f3; border-radius: 8px; background: #f3f8fe; cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.detail-btn:hover { background: #e7f0fb; border-color: var(--blue); transform: scale(1.08); }
.detail-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

@media (max-width: 720px) {
  .m-table .col-bu, .m-table .col-team, .m-table .col-strava-status { display: none; }
}

/* ===== Mobile card layout (≤ 600px) ===== */
@media (max-width: 600px) {
  .m-hero { padding: 1.5rem 1rem 1rem; }
  .m-hero h1 { font-size: 1.7rem; }
  .m-hero .sub { font-size: 0.88rem; }
  .m-hero-bar { flex-direction: column; align-items: stretch; gap: 0.6rem; }
  .export-group { margin-left: 0; flex-direction: column; align-items: stretch; }
  .export-date-input { width: 100%; box-sizing: border-box; }
  .btn-export { justify-content: center; }

  .m-wrap { padding: 0.4rem 0.75rem 2rem; }
  .team-section { border-radius: 12px; margin-bottom: 1.2rem; }
  .team-head { padding: 0.9rem 1rem; }
  .team-badge { width: 36px; height: 36px; font-size: 0.95rem; border-radius: 10px; }
  .team-head h2 { font-size: 1.05rem; }

  /* ---- Card layout: each <tr> becomes a member card ---- */
  .m-table thead { display: none; }
  .m-table tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    row-gap: 0.08rem;
    column-gap: 0.5rem;
    padding: 0.85rem 1rem 0.75rem;
    border-bottom: 1px solid #eef2f7;
  }
  .m-table td { padding: 0; border: none; }

  /* Hidden on mobile */
  .m-table .col-no { display: none; }
  .m-table .col-rank { display: none; }
  .m-table .col-team { display: none; }
  .m-table .col-strava { display: none; }

  /* BU was hidden at 720px — bring it back for the card */
  .m-table .col-bu { display: block; }

  /* Grid placement */
  .m-table .col-name  { grid-column: 1; grid-row: 1; font-size: 0.97rem; }
  .m-table .col-score { grid-column: 2; grid-row: 1 / 4; align-self: center;
                        font-size: 1.1rem; white-space: nowrap; }
  .m-table .col-user  { grid-column: 1; grid-row: 2; font-size: 0.78rem; display: block; }
  .m-table .col-bu    { grid-column: 1; grid-row: 3; font-size: 0.76rem;
                        color: var(--muted); }
  .m-table .col-detail { grid-column: 1 / 3; grid-row: 4; text-align: right;
                        padding-top: 0.5rem; }
}

/* ===== Footer ===== */
.m-foot { text-align: center; color: #9fb3cf; font-size: 0.85rem; padding: 0 0 2rem; }
.m-foot a { color: #cfe0f5; }

/* ===== Member detail stats modal ===== */
.ms-overlay {
  display: none; position: fixed; inset: 0; z-index: 1000;
  background: rgba(10, 20, 36, 0.72);
  align-items: center; justify-content: center; padding: 1.2rem;
}
.ms-overlay.open { display: flex; }

.ms-modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 900px;
  max-height: 96vh; overflow-y: auto; position: relative; color: var(--ink);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}
.ms-close {
  position: absolute; top: 0.7rem; right: 0.9rem; z-index: 2;
  width: 2.1rem; height: 2.1rem; border: none; border-radius: 50%;
  background: rgba(255, 255, 255, 0.18); color: #fff; cursor: pointer;
  font-size: 1.3rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.ms-close:hover { background: var(--orange); }

.ms-header {
  padding: 1.1rem 3rem 0.8rem 1.7rem; border-radius: 16px 16px 0 0; color: #fff;
  background: linear-gradient(120deg, var(--blue-dark), var(--blue));
}
.ms-header h2 { margin: 0 0 0.15rem; font-size: 1.3rem; }
.ms-sub { margin: 0 0 0.5rem; font-size: 0.85rem; color: #cfe0f5; }
.ms-rank-badges { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.ms-badge {
  background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px; padding: 0.3rem 0.85rem; font-size: 0.78rem; font-weight: 600;
}
.ms-badge i { color: var(--orange); margin-right: 0.3rem; }

.ms-body { padding: 1.1rem 1.7rem 1.3rem; }
.ms-loading { text-align: center; color: var(--muted); padding: 2.5rem 0; font-size: 0.95rem; }
.ms-loading i { margin-right: 0.4rem; }
.ms-error {
  display: none; text-align: center; color: #c0392b; padding: 1.2rem 0; font-weight: 600;
}

/* Summary cards */
.ms-summary {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.8rem; margin-bottom: 1rem;
}
.ms-card {
  background: #f7fafe; border: 1px solid #eef2f7; border-radius: 12px;
  padding: 0.7rem 0.7rem; text-align: center;
}
.ms-card.accent { background: #fff6ec; border-color: #ffe2c2; }
.ms-card-num { display: block; font-size: 1.35rem; font-weight: 800; color: var(--blue); }
.ms-card.accent .ms-card-num { color: var(--orange); }
.ms-card-lbl {
  display: block; font-size: 0.74rem; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.04em; margin-top: 0.2rem;
}

/* Per-type table + activity highlights headings */
#msTypeSection h3, #msExtraSection h3 { margin: 0 0 0.5rem; font-size: 1rem; color: var(--blue); }
#msTypeSection h3 i, #msExtraSection h3 i { color: var(--orange); margin-right: 0.4rem; }

.ms-table-wrap { overflow-x: auto; margin-bottom: 1rem; }
.ms-type-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; white-space: nowrap; }
.ms-type-table th {
  text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); padding: 0.5rem 0.7rem; border-bottom: 2px solid #eef2f7; background: #f7fafe;
}
.ms-type-table td { padding: 0.55rem 0.7rem; border-bottom: 1px solid #f1f5fa; }
.ms-type-table .ms-num { text-align: right; font-weight: 700; }

.ms-type-badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  border-radius: 999px; padding: 0.2rem 0.6rem; font-weight: 700; font-size: 0.78rem;
}
.ms-type-walk { background: #e6f4ea; color: #145525; }
.ms-type-run  { background: #e7f0fb; color: var(--blue); }
.ms-type-ride { background: #fff3cd; color: #856404; }

/* Charts */
.ms-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; margin-bottom: 1rem; }
.ms-chart-box { background: #f7fafe; border: 1px solid #eef2f7; border-radius: 12px; padding: 0.7rem; }
.ms-chart-box h4 { margin: 0 0 0.4rem; font-size: 0.88rem; color: var(--blue); }
.ms-chart-box h4 i { color: var(--orange); margin-right: 0.35rem; }
.ms-no-data { display: none; text-align: center; color: var(--muted); font-size: 0.85rem; padding: 2.5rem 0; }

/* Points-by-activity doughnut: 40% smaller than the trend chart */
.ms-chart-shrink { max-width: 60%; margin: 0 auto; }

/* Activity highlights */
.ms-extra-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; }
.ms-extra-stat {
  background: #f7fafe; border: 1px solid #eef2f7; border-radius: 12px;
  padding: 0.6rem 0.6rem; text-align: center;
}
.ms-extra-num { display: block; font-size: 1.2rem; font-weight: 800; color: var(--blue); }
.ms-extra-lbl {
  display: block; font-size: 0.72rem; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.04em; margin-top: 0.2rem;
}

@media (max-width: 720px) {
  .ms-summary { grid-template-columns: repeat(2, 1fr); }
  .ms-charts { grid-template-columns: 1fr; }
  .ms-extra-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .ms-header { padding: 1.3rem 2.6rem 1rem 1.2rem; }
  .ms-body { padding: 1.2rem 1rem 1.5rem; }
}
