/* =====================================================================
   Chinook Bengals Cricket Club app — all styling
   Colours come from the club logo. Phone layout first; wider screens
   (900px and up) get a top menu and two columns.
   ===================================================================== */
:root {
  --bg: #141214;        /* page */
  --bg2: #1B181A;       /* bars, tables */
  --panel: #221E21;     /* cards */
  --panel2: #2C272A;    /* boxes inside cards */
  --rule: #3D3B3C;      /* borders (logo charcoal) */
  --rule2: #4A4547;
  --ink: #F4F1EE;       /* text */
  --ink2: #D9D2D5;
  --muted: #B5ACB0;
  --faint: #8A8286;
  --maroon: #8D2540;    /* primary (logo fur) */
  --maroon-d: #7F0025;
  --gold: #F2B33D;      /* accent (tiger's eyes) */
  --cream: #FAE7C6;     /* headings */
  --owed: #F07A93;      /* money owed */
  --gold-bg: #3A2A12;
  --owed-bg: #3A1A24;
}
* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.45 Barlow, system-ui, sans-serif; }
a { color: var(--gold); }
a:hover { color: var(--cream); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.noscript { padding: 24px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- type ---------- */
.hd { font-family: 'Barlow Condensed', sans-serif; font-style: italic; font-weight: 800; text-transform: uppercase; letter-spacing: .01em; margin: 0; line-height: 1.05; }
.h1 { font-size: 30px; color: var(--cream); }
.h2 { font-size: 22px; color: var(--cream); }
.big { font-size: 34px; color: var(--cream); line-height: 1; }
.lbl { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.tight { margin: 0; }
.owed { color: var(--owed); }
.gold { color: var(--gold); }
.num { font-variant-numeric: tabular-nums; }
.err { color: var(--owed); margin: 0; min-height: 0; font-size: 14px; }
.err:empty { display: none; }
.ok { color: var(--gold); margin: 0; font-size: 14px; }
.ok:empty { display: none; }

/* ---------- boot / loading ---------- */
.boot { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.loading { padding: 48px 0; text-align: center; color: var(--muted); }

/* ---------- app shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid #2C272A; padding-top: env(safe-area-inset-top, 0px); }
.top-in { max-width: 1160px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: 1; min-width: 0; }
.logo { width: 36px; height: 39px; flex: none; }
.bname { display: block; font-family: 'Barlow Condensed', sans-serif; font-style: italic; font-weight: 800; font-size: 17px; line-height: 1.05; text-transform: uppercase; color: var(--cream); }
.bsub { display: block; font-size: 12px; color: var(--muted); }
.tnav { display: none; gap: 4px; }
.tnav a { min-height: 40px; padding: 0 12px; border-radius: 10px; display: flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink2); font-weight: 600; font-size: 15px; white-space: nowrap; }
.tnav a:hover { background: var(--panel); color: var(--cream); }
.tnav a.on { background: var(--panel2); color: var(--gold); }
.me { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--maroon); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; text-decoration: none; overflow: hidden; background-size: cover; background-position: center; }
.page { flex: 1; width: 100%; max-width: 1160px; margin: 0 auto; padding: 16px 16px calc(112px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px; }
.page.narrow { max-width: 560px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.bnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--bg2); border-top: 1px solid var(--rule); padding-bottom: max(10px, env(safe-area-inset-bottom, 0px)); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 4px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; position: relative; min-width: 0; }
.tab svg { width: 24px; height: 24px; }
.tab.on { color: var(--gold); }
.badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--owed); color: #1B1408; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.tnav .badge { position: static; }
.ic { width: 20px; height: 20px; flex: none; }

/* sub-menu for admin pages */
.subnav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--rule); display: flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink2); font-weight: 600; font-size: 14px; }
.subnav a.on { background: var(--panel2); color: var(--gold); border-color: var(--panel2); }

/* ---------- cards and rows ---------- */
.card { background: var(--panel); border: 1px solid var(--rule); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card.hot { border-color: var(--maroon); }
.card.flat { background: transparent; }
.card.dash { background: transparent; border-style: dashed; border-color: var(--gold); }
.box { background: var(--panel2); border-radius: 10px; padding: 10px 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--panel2); min-width: 0; }
.li:first-child { border-top: 0; }
.li .t { font-weight: 600; }
.ico { flex: none; width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.ico.c { background: var(--owed-bg); color: var(--owed); }
.ico.p { background: var(--gold-bg); color: var(--gold); }
.ico.x { background: var(--panel2); color: var(--muted); }
.pill { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; background: var(--panel2); color: var(--ink2); }
.pill.open { background: var(--gold-bg); color: var(--gold); }
.pill.going { background: var(--gold); color: #1B1408; }
.pill.cx { background: var(--owed-bg); color: var(--owed); }
.av { flex: none; width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; background: #5A1830; background-size: cover; background-position: center; overflow: hidden; }
.av.lg { width: 84px; height: 84px; font: italic 800 32px 'Barlow Condensed', sans-serif; background-color: var(--maroon); }
.stack-av { display: flex; align-items: center; padding-left: 8px; }
.stack-av .av { width: 30px; height: 30px; border: 2px solid var(--panel); margin-left: -8px; font-size: 11px; }
.people { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
.pp { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pp .n { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp .s { display: block; font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); padding: 8px 0; margin: 0; }
.notice { border: 1px solid var(--gold); background: var(--gold-bg); color: var(--cream); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.notice.bad { border-color: var(--owed); background: var(--owed-bg); }

/* ---------- buttons ---------- */
.btn { min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--rule2); background: transparent; color: var(--ink); font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--muted); color: var(--ink); }
.btn.primary { background: var(--maroon); border-color: var(--maroon); color: #fff; font-weight: 700; }
.btn.primary:hover { background: #9E2B4A; color: #fff; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #1B1408; font-weight: 700; }
.btn.outline-gold { border-color: var(--gold); color: var(--gold); font-weight: 700; }
.btn.danger { border-color: var(--maroon); color: var(--owed); }
.btn.ghost { border-color: transparent; color: var(--ink2); }
.btn.sm { min-height: 34px; padding: 0 12px; border-radius: 9px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn.cta { min-height: 52px; font: italic 700 18px 'Barlow Condensed', sans-serif; text-transform: uppercase; letter-spacing: .05em; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--gold); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.back { align-self: flex-start; min-height: 44px; display: inline-flex; align-items: center; gap: 4px; font-weight: 600; text-decoration: none; }

/* vote buttons */
.votes { display: flex; gap: 10px; }
.vbtn { flex: 1; min-height: 52px; border-radius: 12px; font: italic 700 18px 'Barlow Condensed', sans-serif; text-transform: uppercase; letter-spacing: .04em; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; background: transparent; color: var(--ink); border: 2px solid var(--rule); }
.vbtn.yes.on { background: var(--gold); color: #1B1408; border-color: var(--gold); }
.vbtn.no.on { background: var(--rule); color: #fff; border-color: #8A8286; }
.vbtn:disabled { opacity: .45; cursor: not-allowed; }

/* segmented choice + chips */
.seg { display: flex; gap: 4px; background: var(--panel); border-radius: 12px; padding: 4px; }
.seg button { flex: 1; min-height: 42px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--rule); color: #fff; }
.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.chips.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chip { min-height: 44px; border-radius: 12px; border: 2px solid var(--rule); background: transparent; color: var(--ink); font-weight: 600; cursor: pointer; }
.chip.on { background: var(--gold); color: #1B1408; border-color: var(--gold); }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.f { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink2); min-width: 0; }
.f .hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.in { min-height: 48px; width: 100%; border-radius: 12px; border: 1px solid var(--rule2); background: var(--panel); color: var(--ink); padding: 0 14px; font-size: 16px; }
textarea.in { padding: 10px 14px; min-height: 80px; resize: vertical; }
select.in { padding-right: 10px; }
.in:focus, .btn:focus-visible, .vbtn:focus-visible, .chip:focus-visible, .tab:focus-visible, .tnav a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: 15px; }
.check input { width: 22px; height: 22px; accent-color: var(--gold); }
.money-in { position: relative; display: flex; }
.money-in span { position: absolute; left: 14px; top: 12px; font-size: 18px; color: var(--muted); }
.money-in .in { padding-left: 30px; font-size: 20px; font-weight: 700; }
.meter { height: 6px; border-radius: 3px; background: var(--panel2); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--owed); transition: width .2s; }
.meter[data-level="2"] i { background: var(--gold); }
.meter[data-level="3"] i, .meter[data-level="4"] i { background: #E9C46A; }

/* ---------- sign-in screens ---------- */
.split { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); }
.hero { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 48px 28px 8px; }
.hero img { width: 112px; height: 121px; }
.hero .title { font-size: 30px; color: var(--cream); }
.side { display: flex; flex-direction: column; justify-content: center; padding: 24px 28px 40px; }
.authbox { width: 100%; max-width: 420px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.steps { display: flex; flex-direction: column; gap: 14px; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.dot { flex: none; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; border: 2px solid var(--rule2); color: var(--muted); }
.dot.done { background: var(--gold); border-color: var(--gold); color: #1B1408; }
.dot.now { border-color: var(--gold); color: var(--gold); }
.qr { width: 200px; height: 200px; background: #fff; border-radius: 12px; padding: 8px; }
code.secret { display: block; word-break: break-all; background: var(--panel2); padding: 10px 12px; border-radius: 10px; font-size: 14px; }

/* ---------- calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.wk { font-size: 12px; color: var(--faint); text-align: center; font-weight: 600; padding-bottom: 4px; }
.day { height: 46px; border-radius: 10px; border: 0; background: transparent; color: var(--ink); font-weight: 500; font-size: 15px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer; padding: 0; }
.day.blank { visibility: hidden; }
.day.past .n { color: var(--faint); }
.day.sel { background: var(--rule); }
.day.today .n { background: var(--cream); color: #1B1408; border-radius: 50%; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.day .m { width: 6px; height: 6px; border-radius: 50%; }
.day .m.practice { background: var(--gold); }
.day .m.pastpractice { background: var(--faint); }
.day .m.poll { border: 2px solid var(--gold); }
.day .m.cx { width: 12px; height: 2px; border-radius: 0; background: var(--owed); }
.day.cxday .n { text-decoration: line-through; color: var(--faint); }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.date-tag { width: 56px; flex: none; font-size: 20px; color: var(--cream); }

/* ---------- admin tables ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--rule); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); }
.tile .v { font-size: 30px; }
.tablewrap { overflow-x: auto; background: var(--bg2); border: 1px solid var(--rule); border-radius: 14px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--panel2); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 700; border-top: 1px solid var(--rule); }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.dim td { color: var(--faint); }
.sel-sm { min-height: 36px; border-radius: 8px; border: 1px solid var(--rule2); background: var(--panel); color: var(--ink); padding: 0 8px; font-size: 14px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .in { min-height: 44px; flex: 1 1 220px; max-width: 360px; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 8px 0; border-top: 1px solid var(--panel2); }
.kv:first-child { border-top: 0; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- dialog and toast ---------- */
dialog { border: 1px solid var(--rule); border-radius: 18px; background: var(--panel); color: var(--ink); padding: 0; width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
#dlgForm { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
#dlgForm h2 { margin: 0; font: italic 800 22px 'Barlow Condensed', sans-serif; text-transform: uppercase; color: var(--cream); }
#dlgBody { margin: 0; }
#dlgBody:empty { display: none; }
#dlgFields { display: flex; flex-direction: column; gap: 12px; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
#toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); background: var(--cream); color: #1B1408; font-weight: 600; padding: 12px 18px; border-radius: 12px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: calc(100vw - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--owed); }

/* ---------- wider screens ---------- */
@media (min-width: 900px) {
  .bname { font-size: 22px; }
  .tnav { display: flex; }
  .bnav { display: none; }
  .page { padding: 28px 24px 56px; gap: 20px; }
  .cols { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 22px; align-items: start; }
  .cols.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cols.wide2 { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
  .big { font-size: 48px; }
  .people { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .chips.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .day { height: 72px; font-size: 17px; }
  .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .hero { background: var(--maroon); padding: 48px; }
  .hero img { width: 220px; height: 238px; }
  .hero .title { font-size: 48px; }
  .hero .muted { color: #F4E4E8; }
  .side { padding: 48px; }
  .page.narrow .card.form-card { padding: 28px; }
  #toast { bottom: 32px; }
}

/* keep list rows tidy on narrow phones */
.li > .pill, .li > .date-tag, .li > svg { flex: none; }
.date-tag { width: auto; min-width: 64px; white-space: nowrap; }
.seg button { white-space: nowrap; }
.toolbar { flex-wrap: wrap; }

/* password with show/hide button */
.pw { position: relative; display: block; }
.pw .in { padding-right: 52px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.pw-eye:hover, .pw-eye[aria-pressed="true"] { color: var(--gold); }
.pw-eye:focus-visible { outline: 2px solid var(--gold); outline-offset: 0; }

/* Home-screen app on iPhone: iOS blurs the strip under the clock/battery.
   Give the header extra room so the club name and logo sit below it. */
@media (display-mode: standalone) {
  .top { padding-top: calc(env(safe-area-inset-top, 0px) + 22px); }
}
