:root {
  --navy: #002250;
  --navy-2: #0d3370;
  --navy-soft: #e6ebf4;
  --cream: #f6f4ec;
  --card: #ffffff;
  --ink: #0e1a33;
  --muted: #5b6478;
  --line: #e2dfd3;
  --red: #d3262f;
  --red-soft: #fdecec;
  --green: #1f8a4c;
  --green-soft: #e5f4ea;
  --amber: #b86e00;
  --amber-soft: #fff3dc;
  --radius: 16px;
  --tap: 48px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --display: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  --text: 'Nunito Sans', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--text); font-size: 15px; }
body { min-height: 100dvh; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.splash { min-height: 100dvh; display: grid; place-content: center; text-align: center; color: var(--muted); gap: 8px; }
.splash img { width: 96px; height: 96px; margin: 0 auto; }

/* Layout --------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--navy); color: #fff;
  padding: calc(var(--safe-t) + 12px) 16px 14px;
  display: flex; align-items: center; gap: 12px;
}
.topbar img.logo { width: 36px; height: 36px; border-radius: 50%; flex: none; }
.topbar .t { flex: 1; min-width: 0; }
.topbar .kicker { font-size: 12px; opacity: .75; font-weight: 600; }
.topbar h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 24px; letter-spacing: .3px; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .back { background: none; border: 0; color: #fff; font-size: 30px; line-height: 1; width: 40px; height: 40px; margin-left: -8px; }
.topbar .icon-btn { background: rgba(255,255,255,.14); border: 0; color: #fff; border-radius: 12px; padding: 8px 12px; font-weight: 700; font-size: 14px; }

main { padding: 16px 16px calc(96px + var(--safe-b)); max-width: 640px; margin: 0 auto; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  background: var(--card); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding-bottom: var(--safe-b);
}
.tabbar a { text-decoration: none; display: grid; place-items: center; gap: 2px; padding: 9px 0 7px; font-size: 11px; font-weight: 700; color: var(--muted); min-height: 60px; }
.tabbar a svg { width: 22px; height: 22px; display: block; }
.tabbar a.on { color: var(--navy); }

.fab {
  position: fixed; right: 18px; bottom: calc(78px + var(--safe-b)); z-index: 7;
  width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: var(--navy); color: #fff; font-size: 30px; line-height: 1;
  box-shadow: 0 6px 18px rgba(0,34,80,.35);
}

@media (min-width: 900px) {
  main { max-width: 760px; }
}

/* Text ------------------------------------------------------------------ */
h2 { font-family: var(--display); font-size: 19px; font-weight: 700; margin: 22px 0 10px; letter-spacing: .3px; display: flex; align-items: baseline; gap: 8px; }
h2 .count { font-family: var(--text); font-size: 13px; color: var(--muted); font-weight: 700; }
h2:first-child { margin-top: 4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 18px; text-align: center; }

/* Cards ------------------------------------------------------------------ */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.card.link { display: flex; align-items: center; gap: 12px; text-decoration: none; min-height: 60px; width: 100%; text-align: left; }
.card.link .grow { flex: 1; min-width: 0; }
.card.link .chev { color: var(--muted); font-size: 26px; }
.card .title { font-weight: 800; font-size: 15.5px; }
.card .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card.done { opacity: .62; }
.card.cancelled .title { text-decoration: line-through; }
.time { font-family: var(--display); font-size: 19px; font-weight: 700; color: var(--navy); min-width: 64px; }

.alert { background: var(--red-soft); border: 1.5px solid #f3b9bc; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.alert h3 { margin: 0 0 6px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--red); }
.alert .row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid #f6d3d5; }
.alert .row:first-of-type { border-top: 0; }
.alert .row .grow { flex: 1; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 800; background: var(--navy-soft); color: var(--navy); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.grey { background: #eceae3; color: var(--muted); }

/* Buttons ---------------------------------------------------------------- */
.btn { min-height: var(--tap); border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); padding: 0 16px; font-weight: 800; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.danger { color: var(--red); border-color: #f3b9bc; }
.btn.wa { background: #1ea952; border-color: #1ea952; color: #fff; }
.btn.block { width: 100%; }
.btn.small { min-height: 38px; padding: 0 12px; font-size: 13.5px; border-radius: 12px; }
.btn:disabled { opacity: .5; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.btn-row.three { grid-template-columns: 1fr 1fr 1fr; }
.linkish { background: none; border: 0; color: var(--muted); font-weight: 700; text-decoration: underline; padding: 14px; width: 100%; }

/* Chips (tap-to-pick) ---------------------------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 42px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); font-weight: 700; font-size: 14px; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }

/* Attendance --------------------------------------------------------------- */
.att { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 6px 6px 14px; margin-bottom: 8px; min-height: 58px; }
.att .name { flex: 1; font-weight: 800; font-size: 15.5px; }
.att .name small { display: block; font-weight: 600; color: var(--muted); font-size: 13px; }
.att button { min-width: 96px; min-height: 46px; border-radius: 999px; border: 1.5px solid var(--line); background: #f3f2ed; font-weight: 800; }
.att button.present { background: var(--green-soft); border-color: #9fd4b2; color: var(--green); }
.att button.late { background: var(--amber-soft); border-color: #f1cf8f; color: var(--amber); }
.att button.absent { background: var(--red-soft); border-color: #f3b9bc; color: var(--red); }

/* Tasks -------------------------------------------------------------------- */
.task { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 12px 6px 6px; margin-bottom: 8px; min-height: 60px; }
.task .tick { width: 48px; height: 48px; flex: none; border: 0; background: none; display: grid; place-items: center; }
.task .tick span { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--navy); display: grid; place-items: center; color: #fff; font-size: 16px; font-weight: 900; }
.task.is-done .tick span { background: var(--navy); }
.task .grow { flex: 1; min-width: 0; }
.task .ttl { font-weight: 700; font-size: 14.5px; }
.task.is-done .ttl { text-decoration: line-through; color: var(--muted); }
.task .when { font-size: 13px; color: var(--muted); }
.task .when.overdue { color: var(--red); font-weight: 800; }
.task .del { background: none; border: 0; color: var(--muted); font-size: 22px; width: 40px; height: 40px; }

/* Week strip --------------------------------------------------------------- */
.week { display: grid; grid-template-columns: 40px repeat(7, 1fr) 40px; gap: 6px; align-items: center; margin-bottom: 8px; }
.week .nav { height: 56px; border: 0; background: none; font-size: 26px; color: var(--navy); }
.day { border: 1.5px solid var(--line); background: var(--card); border-radius: 14px; height: 64px; display: grid; place-content: center; text-align: center; gap: 0; padding: 0; position: relative; }
.day b { font-family: var(--display); font-size: 22px; line-height: 1; }
.day span { font-size: 11.5px; font-weight: 800; color: var(--muted); }
.day.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.day.on span { color: #c9d4ea; }
.day.today:not(.on) { border-color: var(--navy); }
.day i { position: absolute; bottom: 6px; left: 50%; width: 6px; height: 6px; border-radius: 50%; background: var(--red); transform: translateX(-50%); }
.day.on i { background: #fff; }

/* Stats ------------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 10px; text-align: center; }
.stat b { display: block; font-family: var(--display); font-size: 24px; color: var(--navy); line-height: 1.05; }
.stat span { font-size: 12px; font-weight: 700; color: var(--muted); }
.meter { height: 10px; background: #ebe8de; border-radius: 99px; overflow: hidden; margin-top: 10px; }
.meter > div { height: 100%; background: var(--navy); border-radius: 99px; }
.meter.low > div { background: var(--red); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 700; }
.kv dd { margin: 0; }

.list-row { display: flex; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); align-items: center; }
.list-row:first-child { border-top: 0; }
.list-row .grow { flex: 1; min-width: 0; }

.search { width: 100%; min-height: var(--tap); border: 1.5px solid var(--line); border-radius: 14px; padding: 0 16px; background: var(--card); margin-bottom: 12px; font-size: 16px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #e9e6dc; border-radius: 14px; padding: 4px; gap: 4px; margin-bottom: 14px; }
.seg button { border: 0; background: none; min-height: 44px; border-radius: 11px; font-weight: 800; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--navy); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* Sheets (pop-up forms) ---------------------------------------------------- */
.backdrop { position: fixed; inset: 0; background: rgba(5,15,35,.45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease-out; }
.sheet { background: var(--cream); width: 100%; max-width: 640px; max-height: 92dvh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 10px 16px calc(20px + var(--safe-b)); animation: up .2s ease-out; }
.sheet .grab { width: 44px; height: 5px; border-radius: 9px; background: #cfcbbd; margin: 0 auto 10px; }
.sheet h3 { font-family: var(--display); font-size: 22px; margin: 4px 0 14px; }
@media (min-width: 700px) { .backdrop { align-items: center; } .sheet { border-radius: 22px; } }
@keyframes up { from { transform: translateY(30px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 800; font-size: 13px; margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; min-height: var(--tap); border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); padding: 10px 14px; font-size: 16px; }
.field textarea { min-height: 88px; resize: vertical; }
.field .hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 12px; min-height: var(--tap); background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 0 14px; margin-bottom: 8px; font-weight: 700; }
.check input { width: 24px; height: 24px; accent-color: var(--navy); }

/* Toast -------------------------------------------------------------------- */
#toast { position: fixed; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 14px; font-weight: 700; display: flex; gap: 14px; align-items: center; opacity: 0; pointer-events: none; transition: .2s; z-index: 30; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.show button { pointer-events: auto; }
#toast button { background: none; border: 0; color: #9fc3ff; font-weight: 900; text-transform: uppercase; font-size: 14px; }

/* Login -------------------------------------------------------------------- */
.login { min-height: 100dvh; background: var(--navy); color: #fff; display: grid; place-items: center; padding: 24px; }
.login .box { width: 100%; max-width: 380px; text-align: center; }
.login img { width: 132px; height: 132px; }
.login h1 { font-family: var(--display); font-size: 34px; margin: 10px 0 4px; }
.login p { opacity: .8; margin: 0 0 22px; }
.login input { width: 100%; min-height: var(--tap); border-radius: 14px; border: 0; padding: 0 16px; margin-bottom: 10px; font-size: 16px; color: var(--ink); }
.login .btn { width: 100%; background: #fff; color: var(--navy); border: 0; }
.login .err { background: rgba(211,38,47,.25); padding: 10px; border-radius: 12px; margin-bottom: 10px; font-weight: 700; }
.setup { background: var(--card); color: var(--ink); text-align: left; border-radius: 16px; padding: 16px; line-height: 1.5; }

/* Month calendar ------------------------------------------------------------ */
.month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.month-nav b { font-family: var(--display); font-size: 19px; }
.month-nav .nav { width: 48px; height: 44px; border: 0; background: none; font-size: 26px; color: var(--navy); }
.month-nav .nav:disabled { opacity: .25; }
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 4px; }
.month .wd { text-align: center; font-size: 11px; font-weight: 800; color: var(--muted); padding: 2px 0 4px; }
.mday { height: 48px; border: 1.5px solid transparent; background: var(--card); border-radius: 12px; padding: 0; display: grid; place-content: center; gap: 1px; text-align: center; }
.mday b { font-weight: 800; font-size: 14.5px; line-height: 1.1; }
.mday i { font-style: normal; color: var(--red); font-size: 11px; line-height: 1; letter-spacing: 1px; height: 11px; }
.mday.out { background: transparent; color: #b3ae9f; }
.mday.today { border-color: var(--navy); }
.mday.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.mday.on i { color: #fff; }

/* Fold-away payment card --------------------------------------------------- */
.drop { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.drop summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; min-height: 56px; }
.drop summary::-webkit-details-marker { display: none; }
.drop .caret { color: var(--muted); transition: transform .15s; }
.drop[open] .caret { transform: rotate(180deg); }
.drop .grow { flex: 1; }
.drop-body { padding: 0 14px 12px; border-top: 1px solid var(--line); padding-top: 10px; }

.big-money { font-family: var(--display); font-size: 40px; font-weight: 700; color: var(--navy); line-height: 1.1; margin: 4px 0; }

/* Payment type tag on the player list */
.ptype { display: inline-block; font-size: 11.5px; font-weight: 800; padding: 2px 8px; border-radius: 6px; margin-right: 6px; vertical-align: 1px; }
.ptype.pkg { background: var(--navy); color: #fff; }
.ptype.pps { background: #fff; color: var(--navy); border: 1.5px solid var(--navy); padding: 1px 7px; }
