/* Midwest RTC — Coach App */

:root {
  --navy: #15294b;
  --navy-2: #243a63;
  --blue: #2f6fd0;
  --green: #1e9e54;
  --amber: #d98a16;
  --red: #c43c3c;
  --ink: #1d2433;
  --muted: #6b7686;
  --line: #dde1e9;
  --bg: #eef1f5;
  --card: #ffffff;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
body { touch-action: manipulation; }
.hidden { display: none !important; }
.loading { padding: 60px 20px; text-align: center; color: var(--muted); font-size: 17px; }

/* ---- Header / nav --------------------------------------------------------- */
.app-header {
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.app-header .brand { font-size: 19px; font-weight: 800; white-space: nowrap; }
.topnav { display: flex; gap: 6px; flex: 1; }
.navbtn {
  background: transparent;
  border: none;
  color: #c9d4e6;
  font-size: 16px;
  font-weight: 600;
  padding: 9px 15px;
  border-radius: 9px;
  cursor: pointer;
}
.navbtn.active { background: var(--navy-2); color: #fff; }
.navbtn.ghosted { opacity: 0.4; }
.who { display: flex; align-items: center; gap: 12px; font-size: 14px; color: #c9d4e6; }
.linkbtn { background: none; border: none; color: #9fb6d8; font-size: 14px; cursor: pointer; text-decoration: underline; }

/* ---- Layout --------------------------------------------------------------- */
.wrap { max-width: 940px; margin: 0 auto; padding: 20px 16px 60px; }
.wrap-narrow { max-width: 520px; }
h1.page { font-size: 22px; margin: 4px 0 18px; }
h2.sec { font-size: 17px; margin: 22px 0 10px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---- Cards ---------------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
}

/* ---- Forms ---------------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%;
  font-size: 16px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
}
.field textarea { min-height: 70px; resize: vertical; }
.field.half { flex: 1; min-width: 140px; }
.form-grid { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---- Buttons -------------------------------------------------------------- */
.btn {
  font-size: 16px; font-weight: 700;
  padding: 12px 18px;
  border-radius: 10px; border: none; cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.green { background: var(--green); color: #fff; }
.btn.ghost { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.btn.danger { background: #fff; color: var(--red); border: 1px solid var(--red); }
.btn.sm { font-size: 14px; padding: 8px 13px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- Login ---------------------------------------------------------------- */
.login-screen { max-width: 420px; margin: 8vh auto 0; padding: 0 20px; }
.login-screen .logo { text-align: center; font-size: 26px; font-weight: 800; color: var(--navy); margin-bottom: 4px; }
.login-screen .tag { text-align: center; color: var(--muted); margin-bottom: 26px; }
.coach-pick { display: flex; flex-direction: column; gap: 10px; }
.coach-pick button {
  text-align: left; background: var(--card); border: 1px solid var(--line);
  border-radius: 11px; padding: 15px 16px; font-size: 17px; font-weight: 600; cursor: pointer;
}
.coach-pick button:active { background: #eef2f7; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 8px; }
.keypad button {
  height: 64px; font-size: 26px; font-weight: 600;
  border: none; border-radius: 12px; background: var(--card);
  box-shadow: 0 2px 0 #c9cfd9; cursor: pointer;
}
.keypad button:active { transform: translateY(1px); box-shadow: 0 1px 0 #c9cfd9; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 14px 0; }
.pin-dots .dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--blue); }
.pin-dots .dot.on { background: var(--blue); }
.login-msg { text-align: center; min-height: 22px; margin: 8px 0; font-size: 15px; }
.login-msg.bad { color: var(--red); }

/* ---- Check-in roster ------------------------------------------------------ */
.roster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.athlete-chip {
  background: var(--card); border: 2px solid var(--line); border-radius: 12px;
  padding: 12px; cursor: pointer; display: flex; align-items: center;
  gap: 10px; flex-wrap: wrap;
}
.athlete-chip.in { border-color: var(--green); background: #eaf7ef; }
.athlete-chip.sat-out { border-color: var(--amber); background: #fdf6e9; }
.athlete-chip .avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: var(--navy-2); color: #fff; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 15px; overflow: hidden;
}
.athlete-chip .avatar img { width: 100%; height: 100%; object-fit: cover; }
.athlete-chip .nm { font-size: 15px; font-weight: 600; line-height: 1.2; }
.athlete-chip .check { margin-left: auto; font-size: 20px; color: var(--green); }
.count-pill {
  display: inline-block; background: var(--navy); color: #fff;
  font-size: 14px; font-weight: 700; padding: 3px 11px; border-radius: 999px;
}

/* ---- Athlete list --------------------------------------------------------- */
.athlete-list { list-style: none; margin: 0; padding: 0; }
.athlete-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 6px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.athlete-list li:active { background: #eef2f7; }
.athlete-list .nm { font-weight: 600; font-size: 16px; }
.athlete-list .sub { color: var(--muted); font-size: 13px; }

/* ---- Profile -------------------------------------------------------------- */
.profile-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.profile-head .photo {
  width: 84px; height: 84px; border-radius: 14px; background: var(--navy-2);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; overflow: hidden; flex-shrink: 0;
}
.profile-head .photo img { width: 100%; height: 100%; object-fit: cover; }
.profile-head .pname { font-size: 22px; font-weight: 800; }
.profile-head .pmeta { color: var(--muted); font-size: 14px; margin-top: 2px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 2px solid var(--line); margin: 18px 0 14px; }
.tabs button {
  background: none; border: none; padding: 10px 13px; font-size: 15px; font-weight: 700;
  color: var(--muted); cursor: pointer; white-space: nowrap; border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}
.tabs button.active { color: var(--navy); border-bottom-color: var(--blue); }
.kv { display: flex; flex-wrap: wrap; gap: 6px 28px; }
.kv .item { min-width: 150px; }
.kv .k { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.kv .v { font-size: 16px; }

/* badges */
.badge { display: inline-block; font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; }
.badge.ok { background: #e4f4ea; color: var(--green); }
.badge.no { background: #fbe4e4; color: var(--red); }
.badge.warn { background: #fdf1dc; color: var(--amber); }

/* data tables / lists */
.dlist { list-style: none; margin: 0; padding: 0; }
.dlist li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 15px;
}
.dlist li:last-child { border-bottom: none; }
.dlist .when { color: var(--muted); font-size: 13px; white-space: nowrap; }
.dlist .tag { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); font-size: 14px; padding: 14px 4px; }

/* USA card toggle */
.toggle {
  display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
  font-size: 15px; font-weight: 600;
}
.toggle .track {
  width: 46px; height: 27px; border-radius: 999px; background: #cdd3dd;
  position: relative; transition: background .15s;
}
.toggle .track .knob {
  position: absolute; top: 3px; left: 3px; width: 21px; height: 21px;
  border-radius: 50%; background: #fff; transition: left .15s;
}
.toggle.on .track { background: var(--green); }
.toggle.on .track .knob { left: 22px; }

/* ---- Modal ---------------------------------------------------------------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(20,28,45,.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 30px 14px; z-index: 50; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 16px; padding: 20px;
  width: 100%; max-width: 480px;
}
.modal h3 { margin: 0 0 4px; font-size: 19px; }
.modal .sub { color: var(--muted); font-size: 14px; margin-bottom: 14px; }

.dup-match {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px;
}
.dup-match .nm { font-weight: 600; }
.dup-match .sub { color: var(--muted); font-size: 13px; }

/* photo capture */
.photo-capture { display: flex; align-items: center; gap: 14px; }
.photo-capture .preview {
  width: 76px; height: 76px; border-radius: 12px; background: #e6e9ef;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 12px; overflow: hidden;
}
.photo-capture .preview img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Toast ---------------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 15px; font-weight: 600; z-index: 80; max-width: 90%;
}
.toast.bad { background: var(--red); }
.toast.good { background: var(--green); }

.banner { border-radius: 10px; padding: 11px 14px; font-size: 14px; margin-bottom: 14px; }
.banner.warn { background: #fdf1dc; color: #8a5a09; }
.banner.info { background: #e7eefb; color: #2a4a86; }

/* ---- Added: badges, chip tags, button column, checkbox rows --------------- */
.badge.info { background: #e7eefb; color: #2a4a86; }

/* roster chip tags — sat-out reason + punch-card count */
.chip-tags { display: flex; gap: 5px; flex-wrap: wrap; flex-basis: 100%; margin-top: 2px; }
.chip-tag { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; }
.chip-tag.out { background: #fdf1dc; color: #8a5a09; }
.chip-tag.punch.ok { background: #e4f4ea; color: var(--green); }
.chip-tag.punch.warn { background: #fdf1dc; color: var(--amber); }
.chip-tag.punch.bad { background: #fbe4e4; color: var(--red); }

/* vertical button stack inside modals (sat-out menu, reason picker) */
.btn-col { display: flex; flex-direction: column; gap: 10px; }
.btn-col .btn { width: 100%; }

/* checkbox row — coach program access */
.checkrow {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 2px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.checkrow input { width: 21px; height: 21px; flex-shrink: 0; }

/* ---- Check-in: day stepper + program segmented control ------------------- */
.day-nav { display: flex; align-items: center; gap: 10px; }
.day-nav input[type="date"] {
  flex: 1; min-width: 0; text-align: center; font-size: 17px; font-weight: 600;
  padding: 11px 8px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); font-family: inherit;
}
.step {
  width: 54px; height: 48px; flex-shrink: 0; font-size: 26px; font-weight: 700;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  color: var(--navy); cursor: pointer; line-height: 1;
}
.step:active { background: #eef2f7; transform: translateY(1px); }
.day-label {
  text-align: center; font-size: 15px; font-weight: 700;
  color: var(--muted); margin: 8px 0 14px;
}
.seg { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.seg-btn {
  flex: 1; min-width: 116px; padding: 12px 14px; font-size: 15px; font-weight: 700;
  border: 2px solid var(--line); border-radius: 10px; background: #fff;
  color: var(--navy); cursor: pointer;
}
.seg-btn.on { border-color: var(--blue); background: #eaf1fb; color: var(--blue); }
.seg-btn:active { transform: translateY(1px); }
.ci-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ci-row .inline-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.ci-row select {
  flex: 1; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; color: var(--ink); font-family: inherit;
}
.ci-search {
  width: 100%; font-size: 16px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 9px; font-family: inherit;
}

/* check-in roster — list view with a check box */
.ci-list { list-style: none; margin: 0; padding: 0; }
.ci-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 14px; border-bottom: 1px solid var(--line);
}
.ci-item:last-child { border-bottom: none; }
.ci-item.in { background: #eaf7ef; }
.ci-item.sat-out { background: #fdf6e9; }
.ci-check {
  width: 36px; height: 36px; flex-shrink: 0; cursor: pointer;
  border: 2px solid var(--line); border-radius: 8px; background: #fff;
  font-size: 20px; font-weight: 800; line-height: 1; color: #fff;
}
.ci-item.in .ci-check { background: var(--green); border-color: var(--green); }
.ci-item.sat-out .ci-check { background: var(--amber); border-color: var(--amber); }
.ci-name {
  flex: 1; min-width: 0; text-align: left; cursor: pointer;
  background: none; border: none; padding: 8px 0;
  font-size: 17px; font-weight: 600; color: var(--ink);
}
.ci-name:active { color: var(--blue); }
.ci-tags { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; }

/* ---- Added: profile-from-check-in, paid dot, big count, standing,
   leaderboard, amount chips ----------------------------------------------- */

/* generic round avatar — athlete lists, check-in, leaderboard */
.avatar, .av-img {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--navy-2); color: #fff; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 14px; overflow: hidden;
}
.avatar img, .av-img img { width: 100%; height: 100%; object-fit: cover; }

/* check-in: tappable athlete photo opens the profile */
.ci-avatar {
  width: 40px; height: 40px; flex-shrink: 0; padding: 0;
  border: none; background: none; cursor: pointer;
}
.ci-avatar:active { transform: scale(0.94); }

/* paid / owing dot on the check-in roster */
.pay-dot {
  display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  margin-right: 8px; vertical-align: middle; flex-shrink: 0;
}
.pay-dot.ok   { background: var(--green); }
.pay-dot.due  { background: var(--red); }
.pay-dot.none { background: #c4cad4; }

/* big "checked in" count on the check-in screen */
.ci-bigcount {
  display: flex; align-items: baseline; gap: 12px;
  background: var(--navy); color: #fff; border-radius: 14px;
  padding: 14px 20px; margin-bottom: 8px;
}
.ci-bignum { font-size: 46px; font-weight: 800; line-height: 1; }
.ci-biglabel { font-size: 16px; font-weight: 700; }
.ci-bigof { color: #aebbd2; font-weight: 600; }

/* standing card — first practice + season & all-time rank */
.standing-group { margin-bottom: 12px; }
.standing-label {
  font-size: 12px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: .03em; margin-bottom: 6px;
}
.standing-ranks { display: flex; flex-wrap: wrap; gap: 10px; }
.standing-rank {
  display: flex; align-items: baseline; gap: 8px;
  background: #eaf1fb; border-radius: 10px; padding: 8px 14px;
}
.standing-rank .rk { font-size: 24px; font-weight: 800; color: var(--blue); }
.standing-rank .rkof { font-size: 13px; color: var(--muted); font-weight: 600; }

/* leaderboard list */
.lb-list { list-style: none; margin: 0; padding: 0; }
.lb-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 14px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.lb-item:last-child { border-bottom: none; }
.lb-item:active { background: #eef2f7; }
.lb-rank {
  min-width: 30px; text-align: center; font-size: 16px; font-weight: 800;
  color: var(--muted);
}
.lb-item.lb-top .lb-rank { color: var(--amber); font-size: 19px; }
.lb-name { font-size: 16px; font-weight: 600; min-width: 0; }
.lb-count {
  font-size: 17px; font-weight: 800; color: var(--navy);
  background: #eef1f5; border-radius: 999px; padding: 3px 12px;
}

/* quick amount chips in the payment modal */
.amt-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: -4px 0 14px; }
.amt-chips button {
  font-size: 14px; font-weight: 700; padding: 7px 13px;
  border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--navy); cursor: pointer;
}
.amt-chips button:active { background: #eaf1fb; }

/* profile photo — tappable to take / change the athlete's photo */
.photo-btn {
  position: relative; padding: 0; border: none; background: none;
  cursor: pointer; flex-shrink: 0; line-height: 0;
}
.photo-btn:active { transform: scale(0.97); }
.photo-cam {
  position: absolute; right: -3px; bottom: -3px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--blue); color: #fff; border: 3px solid var(--card);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; line-height: 1;
}

/* ---- Added: absences, the Absent? control, closed/holiday banner -------- */
.ci-item.absent { background: #f4f5f7; }
.ci-item.absent .ci-name { color: var(--muted); }
.ci-item.absent .ci-check { background: #aeb6c2; border-color: #aeb6c2; color: #fff; }

/* chip-tag used as a button (the tappable "Absent · reason" chip) */
button.chip-tag { border: none; font-family: inherit; cursor: pointer; }
.chip-tag.absent { background: #e7e9ee; color: #4a5160; }

/* the small dashed "Absent?" button on a not-yet-checked-in row */
.chip-btn {
  font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px;
  border: 1px dashed var(--line); background: #fff; color: var(--muted);
  cursor: pointer; font-family: inherit;
}
.chip-btn:active { background: #eef2f7; }

/* closed / holiday banner + "mark off" link on the check-in screen */
.ci-closed { margin-top: 10px; }
.closed-banner {
  background: #fdf1dc; color: #8a5a09; border-radius: 9px;
  padding: 9px 12px; font-size: 14px; font-weight: 600;
}
.closed-banner .linkbtn { color: #8a5a09; font-weight: 800; }
.closed-banner.soft { background: #e7eefb; color: #2a4a86; margin-bottom: 8px; }
#ciMarkOff { color: var(--muted); font-size: 13px; }

/* recency tier header inside the Regular Club roster */
.ci-tier {
  list-style: none; padding: 9px 14px 4px; font-size: 12px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  background: #f4f5f7; border-bottom: 1px solid var(--line);
}
