/* Colour scheme from northwardtech.co.uk: ink + cloud neutrals, Northward blue accent, amber highlight. */
:root {
  --bg: #f4f6f9;          /* cloud */
  --surface: #ffffff;     /* paper */
  --ink: #0b0d10;
  --muted: #4a5260;       /* slate */
  --line: #dde2ea;        /* rule */
  --accent: #0057ff;      /* Northward blue */
  --accent-hover: #0046cc;
  --accent-ink: #ffffff;
  --accent-soft: #e5edff;
  --good: #1e7a4c;
  --good-soft: #e2f3ea;
  --bad: #b42318;
  --bad-soft: #fdeceb;
  --future: #eef1f5;
  --expected: #d5dbe4;
  --bet: #ffb020;         /* amber */
  --bet-ink: #0b0d10;
  --bet-soft: #fff1d6;
  --bet-text: #7a4b00;
  --foot-bg: #0b0d10;
  --foot-ink: #aeb6c2;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(11, 13, 16, .05), 0 1px 3px rgba(11, 13, 16, .07);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d10;
    --surface: #1b2028;
    --ink: #f4f6f9;
    --muted: #aeb6c2;
    --line: #2c333e;
    --accent: #3d8bff;
    --accent-hover: #5c9dff;
    --accent-ink: #0b0d10;
    --accent-soft: #14264a;
    --good: #4fc98a;
    --good-soft: #15302a;
    --bad: #ff7a6e;
    --bad-soft: #3a1f1d;
    --future: #232a34;
    --expected: #364253;
    --bet: #ffb020;
    --bet-ink: #0b0d10;
    --bet-soft: #3a2c12;
    --bet-text: #ffc85a;
    --foot-bg: #000000;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 0 0 .75rem; line-height: 1.2; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; font-weight: 700; }
code, .mono { font-family: ui-monospace, Consolas, monospace; font-size: .92em; }
.muted, .hint { color: var(--muted); }
.hint { font-size: .87rem; margin: .5rem 0 0; }
.empty { color: var(--muted); margin: .25rem 0; }
.pad { padding: 1rem; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 1.25rem; padding-bottom: 2rem; }
/* dark footer with company logo; body is a column so the footer sits at the bottom on short pages */
body { display: flex; flex-direction: column; min-height: 100vh; }
main.wrap { flex: 1 0 auto; width: 100%; }
.site-foot { background: var(--foot-bg); color: var(--foot-ink); margin-top: 1.5rem; }
.site-foot-inner { display: flex; justify-content: center; padding-top: 1.4rem; padding-bottom: 1.4rem; }
.foot-brand { display: flex; flex-direction: column; align-items: center; gap: .45rem; text-align: center; }
.foot-logo { display: block; max-height: 44px; max-width: 200px; width: auto; height: auto; }
.foot-club { font-size: .85rem; font-weight: 600; letter-spacing: .02em; }
@media (max-width: 640px) { .foot-logo { max-height: 38px; } }

/* top bar: white like the Northward site header */
.topbar { background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; min-height: 60px; padding-top: 6px; padding-bottom: 6px; }
.brand { display: flex; align-items: center; gap: .6rem; color: inherit; text-decoration: none; font-weight: 800; letter-spacing: -.01em; }
.brand-mark { display: block; width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0; }
.nav { display: flex; align-items: center; gap: .15rem; flex-wrap: wrap; }
.nav a, .nav .linkish { color: var(--ink); text-decoration: none; padding: .35rem .6rem; border-radius: var(--radius-sm); font-size: .92rem; font-weight: 500; }
.nav a:hover, .nav .linkish:hover { background: var(--future); }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.linkish { background: none; border: 0; font: inherit; cursor: pointer; }
.inline { display: inline; margin: 0; }

/* layout */
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.page-head h1 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.grid2.wide-left { grid-template-columns: 1.6fr 1fr; }
.stack { display: grid; gap: 1rem; align-content: start; }
@media (max-width: 860px) { .grid2, .grid2.wide-left { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.grid2 > .card, .stack > .card { margin-bottom: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 560px; margin: 1rem auto; }
.card.danger { border-color: var(--bad); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.card-head h2 { margin: 0; }

/* flash */
.flash { padding: .65rem .9rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid; }
.flash.ok { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.flash.err { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1rem; }
.tiles.compact { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 760px) { .tiles { grid-template-columns: repeat(2, 1fr); gap: .65rem; } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.tile-label { color: var(--muted); font-size: .82rem; }
.tile-value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile-value small { font-size: .9rem; color: var(--muted); font-weight: 500; }
.tile.warn .tile-value { color: var(--bad); }

.status-banner { display: flex; flex-direction: column; gap: .15rem; padding: 1rem 1.1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.status-banner strong { font-size: 1.15rem; }
.status-banner.good { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.status-banner.behind { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }

/* forms */
.form { display: grid; gap: .8rem; }
.form fieldset { border: 1px solid var(--line); border-radius: 10px; padding: .9rem; margin: 0; display: grid; gap: .8rem; }
.form legend { font-weight: 600; padding: 0 .35rem; }
.form label { display: grid; gap: .3rem; font-size: .9rem; font-weight: 500; }
.form label.check { display: flex; align-items: flex-start; gap: .5rem; font-weight: 400; }
.form label.check input { margin-top: .25rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } }
input:not([type=checkbox]), textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: .55rem .65rem; width: 100%; min-width: 0;
}
input:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.with-btn { display: flex; gap: .4rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  padding: .55rem 1rem; border-radius: var(--radius-sm); border: 2px solid var(--line);
  background: var(--surface); color: var(--ink); white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); justify-self: start; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; justify-self: start; }
.btn.small { padding: .3rem .65rem; font-size: .85rem; }
.pager { display: flex; gap: .4rem; flex-wrap: wrap; }

/* tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: .55rem .75rem; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table thead th { font-size: .8rem; color: var(--muted); font-weight: 600; background: var(--surface); }
.table tbody tr:last-child > * { border-bottom: 0; }
.table.simple th, .table.simple td { padding: .45rem .4rem; }
.table .num { text-align: right; }
.table a { text-decoration: none; font-weight: 600; }
.table tr.inactive td { opacity: .55; }
.table tr.me-row td { background: var(--accent-soft); }
.simple { margin-top: 1rem; }

.pill { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; background: var(--future); color: var(--muted); margin-left: .25rem; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }

/* schedule grid */
.table.grid th, .table.grid td { padding: .4rem; text-align: center; }
.table.grid .sticky { position: sticky; left: 0; background: var(--surface); text-align: left; z-index: 1; padding-left: .9rem; box-shadow: 1px 0 0 var(--line); }
.table.grid tbody th.sticky { font-weight: 600; }
.wk-head { min-width: 58px; }
.wk-head span { display: block; color: var(--ink); }
.wk-head small { display: block; font-weight: 500; }
.wk-head.current { background: var(--accent-soft); }
.wk-head.current span { color: var(--accent); }
.cell.current { background: var(--accent-soft); }
.cell.na { color: var(--muted); }
.tiny { font: inherit; font-size: .7rem; padding: 0 .35rem; margin-top: .2rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--muted); cursor: pointer; }
.tiny:hover { color: var(--accent); border-color: var(--accent); }
.tick {
  width: 36px; height: 36px; border-radius: 8px; cursor: pointer;
  border: 2px solid var(--line); background: var(--surface); color: #fff;
  font-size: 1.05rem; font-weight: 800; line-height: 1;
}
.tick.missed { border-color: var(--bad); border-style: dashed; background: var(--bad-soft); }
.tick.future { border-style: dashed; }
.tick.paid { background: var(--good); border-color: var(--good); border-style: solid; }
button.tick:hover { transform: scale(1.06); }
.tick.static { display: inline-grid; place-items: center; width: 28px; height: 28px; font-size: .9rem; }
.tick:disabled { opacity: .6; cursor: wait; }

/* chips (dashboard quick tick) */
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; }
.chip { font: inherit; display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .8rem .4rem .45rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.chip-mark { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 2px dashed var(--muted); font-size: .8rem; font-weight: 800; color: #fff; }
.chip.paid { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.chip.paid .chip-mark { background: var(--good); border: 2px solid var(--good); }

/* bar chart */
.bars { display: flex; align-items: stretch; gap: 6px; height: 200px; }
.bar-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.bar-track { flex: 1; position: relative; }
.bar-track span { position: absolute; bottom: 0; left: 15%; right: 15%; border-radius: 4px 4px 0 0; }
.bar-expected { background: var(--expected); }
.bar-collected { background: var(--accent); left: 28% !important; right: 28% !important; }
.bar-x { font-size: .68rem; color: var(--muted); text-align: center; margin-top: .3rem; white-space: nowrap; overflow: hidden; }
@media (max-width: 520px) { .bar-x { font-size: .6rem; } .bars { gap: 3px; } }

.legend { font-size: .8rem; color: var(--muted); display: inline-flex; align-items: center; gap: .35rem; flex-wrap: wrap; margin: .75rem 0 0; }
.card-head .legend { margin: 0; }
.key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-left: .4rem; }
.key.paid { background: var(--good); }
.card-head .key.paid { background: var(--accent); }
.key.expected { background: var(--expected); }
.key.missed { background: var(--bad-soft); border: 1px dashed var(--bad); }
.key.future { background: var(--future); }
.key.current { background: transparent; border: 2px solid var(--accent); }

/* member timeline */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; }
.wk { border-radius: 8px; padding: .4rem .2rem; text-align: center; border: 2px solid transparent; display: flex; flex-direction: column; gap: .1rem; }
.wk-date { font-size: .72rem; }
.wk-mark { font-weight: 800; height: 1.2em; }
.wk.paid { background: var(--good); color: #fff; }
.wk.missed { background: var(--bad-soft); color: var(--bad); }
.wk.future { background: var(--future); color: var(--muted); }
.wk.current { border-color: var(--accent); }

.progress { height: 12px; background: var(--future); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--good); border-radius: 999px; }
.bar-label { margin: 1rem 0 .4rem; }
.bar-label.first { margin-top: 0; }
.spaced-form { margin-top: .6rem; }
.range-title { margin: 0; }

/* club dashboard (members' view) */
.dash { margin-bottom: 1.25rem; }
.dash-title { background: var(--accent); color: var(--accent-ink); text-align: center; margin: 0; padding: .55rem; border-radius: var(--radius) var(--radius) 0 0; font-size: 1rem; }
.dash-row { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border: 1px solid var(--line); border-bottom: 2px solid var(--accent); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-top: .75rem; }
.dash-row.four { grid-template-columns: repeat(4, 1fr); margin-top: 0; border-top: 0; border-radius: 0 0 var(--radius) var(--radius); }
.dash-cell { display: flex; flex-direction: column; min-width: 0; border-left: 1px solid var(--line); }
.dash-cell:first-child { border-left: 0; }
.dash-cell span { background: var(--future); color: var(--muted); font-size: .78rem; font-weight: 600; text-align: center; padding: .4rem .3rem; }
.dash-cell strong { font-size: 1.35rem; text-align: center; padding: .6rem .3rem .7rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; line-height: 1.2; }
.dash .hint { text-align: center; }
.pos { color: var(--good); }
.neg { color: var(--bad); }

/* bet history list */
.bet-hist { list-style: none; margin: 0; padding: 0; }
.bet-hist li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.bet-hist li:last-child { border-bottom: 0; }
.bh-main { display: flex; flex-direction: column; min-width: 0; }
.bh-who { font-weight: 700; }
.bh-sel { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.bh-res { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.bh-res .pill { margin: 0; text-transform: capitalize; }

/* members' payments grid: full names + status column on wide screens, compact on phones */
.club-grid .short, .club-grid .m-status { display: none; }
.club-grid .wd, .club-grid .wm { display: inline; }
.club-grid .wd::after { content: ' '; }
.hide-sm { display: inline; }

@media (max-width: 640px) {
  main.wrap { padding-top: .9rem; }
  h1 { font-size: 1.35rem; }
  .topbar-inner { min-height: 0; gap: .4rem; }
  .nav a, .nav .linkish { padding: .3rem .5rem; font-size: .88rem; }
  .hide-sm { display: none; }

  .dash-row, .dash-row.four { grid-template-columns: repeat(2, 1fr); }
  .dash-row .dash-cell:nth-child(odd) { border-left: 0; }
  .dash-row .dash-cell:nth-child(n+3) { border-top: 1px solid var(--line); }
  .dash-row:not(.four) .dash-cell:nth-child(3) { grid-column: span 2; }
  .dash-cell span { font-size: .72rem; padding: .35rem .25rem; }
  .dash-cell strong { font-size: 1.15rem; padding: .45rem .25rem .55rem; }

  .grid-head { margin-bottom: .5rem; }
  .grid-head .range-title { font-size: .95rem; }
  .club-grid .full, .club-grid .status-col { display: none; }
  .club-grid .short { display: inline; }
  .club-grid .m-status { display: block; font-size: .66rem; font-weight: 600; line-height: 1.15; white-space: normal; }
  .club-grid .m-status.good { color: var(--good); }
  .club-grid .m-status.bad { color: var(--bad); }
  .club-grid .wd, .club-grid .wm { display: block; }
  .club-grid .wd::after { content: none; }
  .club-grid .wd { font-size: .8rem; color: var(--ink); }
  .club-grid .wm { font-size: .62rem; color: var(--muted); font-weight: 500; }
  .table.club-grid th, .table.club-grid td { padding: .3rem .1rem; }
  .table.club-grid .sticky { padding-left: .5rem; padding-right: .3rem; white-space: normal; max-width: 84px; }
  .club-grid .wk-head { min-width: 0; }
  .club-grid .tick.static { width: 22px; height: 22px; min-width: 22px; font-size: .75rem; border-radius: 6px; }
  .club-grid .tick.bet { padding: 0; font-size: .7rem; }
  .legend { font-size: .72rem; }
  .bh-sel { font-size: .8rem; }
}

/* admin bets */
.bet-list { display: grid; gap: .75rem; }
.bet-list .card { margin: 0; }
.bet-row.res-won { border-left: 4px solid var(--good); }
.bet-row.res-lost { border-left: 4px solid var(--bad); }
.bet-row.res-void { border-left: 4px solid var(--muted); }
.bet-head { display: flex; align-items: center; gap: .5rem 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.bet-week { color: var(--muted); font-size: .85rem; }
.bet-punter { font-weight: 700; }
.bet-form { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; }
.bet-form label { display: grid; gap: .25rem; font-size: .82rem; font-weight: 500; flex: 0 1 120px; }
.bet-form label.grow { flex: 1 1 220px; }

/* rotation bet weeks */
.tick.bet { background: var(--bet); border: 2px solid var(--bet); color: var(--bet-ink); font-size: .68rem; font-weight: 700; width: auto; min-width: 28px; padding: 0 .3rem; }
.chip.bet { background: var(--bet-soft); border-color: var(--bet); color: var(--bet-text); cursor: default; }
.chip.bet .chip-mark { background: var(--bet); border: 2px solid var(--bet); color: var(--bet-ink); }
.key.bet { background: var(--bet); }

/* record payment */
.pay-form { display: flex; align-items: flex-end; gap: .75rem; flex-wrap: wrap; }
.pay-form label { display: grid; gap: .3rem; font-size: .9rem; font-weight: 500; flex: 1 1 180px; }
.pay-form .btn { flex: 0 0 auto; }
select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .65rem; width: 100%; min-width: 0; }

/* rotation */
.rota-card { display: flex; align-items: center; gap: 1.25rem 2rem; flex-wrap: wrap; border-left: 4px solid var(--accent); }
.rota-now { display: flex; flex-direction: column; gap: .15rem; }
.rota-who { font-size: 1.5rem; font-weight: 700; color: var(--accent); }
.rota-next { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; flex: 1; font-size: .9rem; }
.rota-next .muted { font-size: .8rem; margin-right: .2rem; }
.rota-manage { font-size: .85rem; }
.rota { list-style: none; margin: 0; padding: 0; }
.rota li { display: flex; align-items: center; gap: .5rem; padding: .4rem .25rem; border-bottom: 1px solid var(--line); }
.rota li:last-child { border-bottom: 0; }
.rota li.turn { background: var(--accent-soft); border-radius: 8px; }
.rota-pos { width: 1.5rem; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.rota-name { flex: 1; text-decoration: none; font-weight: 600; }
.rota-move { display: inline-flex; gap: .25rem; }
.rota .tiny { margin-top: 0; padding: .1rem .45rem; font-size: .8rem; }
.rota .tiny:disabled { opacity: .35; cursor: default; }
.pill.turn-pill { background: var(--accent); color: var(--accent-ink); }
.wk-turn { display: block; font-style: normal; font-size: .7rem; font-weight: 600; color: var(--accent); }
h2.spaced { margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; background: var(--accent-soft); border: 1px solid var(--accent); }

.paylist { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow: auto; }
.paylist li { display: flex; justify-content: space-between; padding: .35rem 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
