:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #1e293b;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e6ecf2;
  --brand: #1580d8;
  --brand-dark: #1069b8;
  --brand-soft: #eaf3fc;
  --green: #12925b;
  --green-soft: #e7f6ee;
  --red: #d64545;
  --red-soft: #fdecec;
  --amber: #b7791f;
  --amber-soft: #fff4e0;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.05);
  --radius: 14px;
  font-size: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- top nav ---------- */
.topnav {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 0 18px; height: 56px; position: sticky; top: 0; z-index: 30;
}
.nav-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.logo { display: inline-flex; align-items: center; height: 34px; margin-right: 8px; flex: none; }
.logo img { display: block; }
.nav-items { display: flex; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0; overflow-x: auto; }
.nav-items li { white-space: nowrap; }
.nav-items a {
  display: block; padding: 8px 12px; border-radius: 9px; color: #475569;
  font-size: 14.5px; font-weight: 500;
}
.nav-items a:hover { background: #f1f5f9; text-decoration: none; }
.nav-items a.active { background: #eef4fb; color: var(--brand-dark); font-weight: 650; }
.nav-items a.disabled { color: var(--faint); cursor: default; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-ico, .nav-user { color: #475569; font-size: 14px; white-space: nowrap; }
.nav-user .ava { display: inline-grid; place-items: center; width: 26px; height: 26px;
  border-radius: 50%; background: var(--brand); color: #fff; font-size: 13px; font-weight: 700; margin-right: 4px; vertical-align: middle; }
.pill { font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 999px; }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
@media (max-width: 900px) { .nav-right .nav-ico, .nav-user span:last-child { display: none; } .pill.amber { display: none; } }

/* ---------- breadcrumbs + layout ---------- */
.crumbs { max-width: 1240px; margin: 0 auto; padding: 16px 20px 0; color: var(--muted); font-size: 14px; }
.crumbs b { color: var(--ink); }
main { max-width: 1240px; margin: 0 auto; padding: 14px 20px 40px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 28px; letter-spacing: -.3px; }
.page-head .count { color: var(--muted); font-size: 14px; margin-top: 2px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }

/* ---------- buttons / inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); padding: 9px 14px; border-radius: 10px;
  font: inherit; font-size: 14px; font-weight: 550; cursor: pointer; }
.btn:hover { background: #f8fafc; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; font-weight: 600; }
.btn.danger:hover { background: #fecaca; color: #991b1b; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--brand); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.input { padding: 9px 12px 9px 34px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 14px; background: var(--panel); }
.input:focus, select:focus { outline: none; border-color: var(--brand); }
select.sel { padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 14px; background: var(--panel); cursor: pointer; }
.searchwrap { position: relative; }
.searchwrap::before { content: "🔍"; position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 13px; opacity: .5; }

.badge { font-size: 12px; font-weight: 650; padding: 3px 10px; border-radius: 999px; display: inline-block; }
.badge.paid { background: var(--green-soft); color: var(--green); }
.badge.unpaid { background: var(--red-soft); color: var(--red); }
.badge.closed, .badge.inactive { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }
.badge.type { background: var(--brand-soft); color: var(--brand-dark); }
.badge.passes { background: var(--amber-soft); color: var(--amber); }

/* ---------- accounts table ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
.tablewrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.data th { text-align: left; padding: 12px 16px; color: var(--muted); font-weight: 600; font-size: 12.5px;
  text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none; }
table.data th .arr { opacity: .4; font-size: 11px; }
table.data th.sorted .arr { opacity: 1; color: var(--brand); }
table.data td { padding: 13px 16px; border-bottom: 1px solid #f1f5f9; white-space: nowrap; }
table.data tbody tr:hover { background: #f8fbff; }
table.data td.acct a { font-weight: 650; }
.pager { display: flex; align-items: center; gap: 6px; justify-content: flex-end; padding: 12px 4px; flex-wrap: wrap; }
.pager .pinfo { color: var(--muted); font-size: 13.5px; margin-right: auto; }
.pgbtn { min-width: 34px; height: 34px; padding: 0 10px; border: 1px solid var(--line); background: var(--panel);
  border-radius: 8px; cursor: pointer; font: inherit; font-size: 14px; }
.pgbtn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pgbtn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- dashboard ---------- */
.kpis { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { padding: 18px 20px; }
.kpi .label { color: var(--muted); font-size: 14px; display: flex; justify-content: space-between; }
.kpi .val { font-size: 32px; font-weight: 750; letter-spacing: -.5px; margin: 6px 0 2px; }
.kpi .sub { color: var(--faint); font-size: 12.5px; }
.kpi .trend { color: var(--green); font-size: 12.5px; font-weight: 650; }

.dash { grid-template-columns: 1.4fr 1fr; align-items: start; }
@media (max-width: 900px) { .dash { grid-template-columns: 1fr; } }
.section { padding: 18px 20px; }
.section h3 { margin: 0 0 14px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.section h3 .muted { color: var(--muted); font-weight: 500; }

/* donut */
.donutrow { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; padding: 4px 0 2px; }
.donut-wrap { position: relative; width: 184px; height: 184px; flex: none; }
.donut { width: 184px; height: 184px; border-radius: 50%; position: absolute; inset: 0;
  filter: drop-shadow(0 6px 14px rgba(10,44,58,.12));
  -webkit-mask: radial-gradient(circle 58px at center, transparent 98%, #000 100%);
          mask: radial-gradient(circle 58px at center, transparent 98%, #000 100%); }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
.donut-center .amt { font-size: 22px; font-weight: 800; line-height: 1.05; color: var(--ink); letter-spacing: -.02em; }
.donut-center .cap { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin-top: 3px; }
.legend { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; flex: 1; min-width: 240px; }
.legend .lrow { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; }
.legend .lrow:hover { background: #f1f6fa; }
.legend .dot { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.legend .lname { flex: 1; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend .lval { font-variant-numeric: tabular-nums; font-weight: 700; width: 84px; text-align: right; }
.legend .lpct { color: var(--muted); width: 42px; text-align: right; font-variant-numeric: tabular-nums; }

/* member stat bars */
.statbig { font-size: 30px; font-weight: 750; }
.statbar { height: 12px; border-radius: 6px; background: #eef2f7; overflow: hidden; display: flex; margin: 12px 0; }
.statbar span { display: block; height: 100%; }
.typerow { display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 6px 0; }
.typerow .tname { width: 150px; color: var(--muted); }
.typerow .tbar { flex: 1; height: 8px; background: #eef2f7; border-radius: 5px; overflow: hidden; }
.typerow .tbar i { display: block; height: 100%; background: var(--brand); }
.typerow .tnum { width: 44px; text-align: right; font-weight: 650; }

/* accounts overview cards */
.typegrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 640px) { .typegrid { grid-template-columns: repeat(2, 1fr); } }
.typecard { border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; }
.typecard .tt { color: var(--muted); font-size: 12.5px; }
.typecard .tv { font-size: 24px; font-weight: 750; margin: 2px 0 4px; }
.typecard .tsub { font-size: 11.5px; }
.typecard .tsub .g { color: var(--green); } .typecard .tsub .r { color: var(--red); }

/* weekday chart */
.weekchart { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 8px; }
.weekchart .wd { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.weekchart .wbar { width: 100%; background: var(--brand); border-radius: 6px 6px 0 0; min-height: 3px; }
.weekchart .wlab { font-size: 12px; color: var(--muted); }
.weekchart .wval { font-size: 12px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- check-in ---------- */
.checkin-grid { grid-template-columns: minmax(320px, 440px) 1fr; align-items: start; }
@media (max-width: 820px) { .checkin-grid { grid-template-columns: 1fr; } }
.results { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.acctcard { padding: 13px 15px; cursor: pointer; }
.acctcard:hover { border-color: var(--brand); }
.acctcard .row1 { display: flex; justify-content: space-between; gap: 8px; }
.acctcard .name { font-weight: 650; }
.acctcard .acctno { color: var(--muted); font-size: 13px; }
.acctcard .meta { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.searchhint, .noresults { color: var(--muted); padding: 8px 4px; font-size: 14px; }

.acctview .head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; }
.acctview .head h2 { margin: 0 0 3px; font-size: 20px; }
.acctview .head .addr { color: var(--muted); font-size: 14px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.members { padding: 14px; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); }
.mcard { display: flex; align-items: center; gap: 10px; text-align: left; padding: 11px; border: 2px solid var(--line);
  border-radius: 12px; background: var(--panel); cursor: pointer; font: inherit; color: inherit; }
.mcard:hover { border-color: var(--brand); }
.mcard.sel { border-color: var(--green); background: var(--green-soft); }
.mcard.here { opacity: .55; }
.avatar { width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 14px; }
.avatar.adult { background: var(--brand); } .avatar.child { background: var(--green); } .avatar.other { background: #94a3b8; }
.mcard .mname { font-weight: 600; font-size: 14.5px; line-height: 1.15; }
.mcard .mmeta { font-size: 12px; color: var(--muted); }
.mcard.here .mmeta { color: var(--green); font-weight: 650; }
.mcard .check { margin-left: auto; color: var(--green); opacity: 0; } .mcard.sel .check { opacity: 1; }

.guestrow { padding: 4px 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.guestrow input[type=text] { flex: 1 1 150px; padding: 9px 12px; border: 2px solid var(--line); border-radius: 10px; font: inherit; }
.stepper { display: inline-flex; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { border: 0; background: #eef3f6; width: 36px; height: 38px; font-size: 19px; cursor: pointer; }
.stepper span { min-width: 32px; display: grid; place-items: center; font-weight: 700; }
.actionbar { display: flex; gap: 12px; align-items: center; padding: 14px 16px 18px; }
.checkinbtn { flex: 1; border: 0; border-radius: 11px; padding: 15px; font-size: 17px; font-weight: 700; color: #fff; background: var(--green); cursor: pointer; }
.checkinbtn:disabled { background: #c3cdd3; cursor: not-allowed; }
.selcount { color: var(--muted); font-size: 14px; }
.todaystrip { padding: 6px 16px 16px; }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.feed li { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 8px 10px; background: var(--bg); border-radius: 9px; }
.feed li .who { font-weight: 550; }
.feed li .tag { color: var(--muted); font-size: 13px; }
.feed li.guest .who::after { content: " · guest"; color: var(--amber); font-weight: 650; }
.subhead { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; margin: 8px 0; }

.detail-cols { gap: 16px; }
@media (max-width: 820px) { .detail-cols { grid-template-columns: 1fr !important; } }

/* check-in guest-fee notice */
.ci-fee-notice { display: flex; align-items: center; gap: 12px; background: var(--amber-soft); border: 1px solid #f0dcb8;
  color: var(--amber); border-radius: 12px; padding: 12px 16px; margin-bottom: 14px; font-weight: 600; font-size: 14.5px; }
.ci-fee-link { color: var(--brand-dark); font-weight: 700; white-space: nowrap; }
.ci-fee-link:hover { text-decoration: underline; }
.ci-fee-x { border: 0; background: none; color: var(--amber); cursor: pointer; font-size: 15px; padding: 0 2px; }

/* check-in (flat member list) */
.ci-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.ci-toolbar .searchwrap input { padding: 12px 12px 12px 36px; font-size: 16px; }
.ci-complete { font-size: 15px; padding: 11px 18px; }
.ci-results { display: flex; flex-direction: column; gap: 8px; }
.ci-row { display: flex; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 16px; cursor: pointer; box-shadow: var(--shadow); transition: border-color .1s, background .1s; }
.ci-row:hover { border-color: var(--brand); }
.ci-row.sel { border-color: var(--green); background: var(--green-soft); }
.ci-check { width: 26px; height: 26px; border: 2px solid var(--line); border-radius: 7px; flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; }
.ci-row.sel .ci-check { background: var(--green); border-color: var(--green); }
.ci-mid { flex: 1; min-width: 0; }
.ci-nameRow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ci-name { font-weight: 650; font-size: 16px; }
.ci-acct { text-align: right; font-size: 13px; color: var(--ink); line-height: 1.25; white-space: nowrap; }
.ci-acct .muted { color: var(--muted); }

.ci-tray-box { background: #eef4fb; border: 1px solid #d8e6f5; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.ci-tray-label { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--brand-dark); font-weight: 700; margin-bottom: 8px; }
.ci-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ci-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 10px; font-size: 14px; font-weight: 550; }
.ci-chip.guest { background: var(--amber-soft); border-color: #f0dcb8; }
.ci-chip input { border: 0; background: transparent; font: inherit; outline: none; }
.ci-step { border: 0; background: #e2e8f0; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; font-size: 15px; line-height: 1; }
.ci-pass { min-width: 14px; text-align: center; font-weight: 700; }
.ci-pass-lbl { font-size: 11px; color: var(--muted); }
.ci-x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 0 2px; }
.ci-x:hover { color: var(--red); }

.placeholder { padding: 60px 20px; text-align: center; color: var(--muted); }
.placeholder .big { font-size: 40px; margin-bottom: 10px; }
.note { background: var(--amber-soft); color: var(--amber); border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-top: 14px; }

.billrow { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 14.5px; cursor: pointer; }
.billrow:hover { background: #f8fbff; }

/* tabs */
.tabbar { display: flex; gap: 4px; }
.tab { padding: 7px 14px; border-radius: 9px 9px 0 0; color: var(--muted); font-size: 14px; font-weight: 550; border-bottom: 2px solid transparent; }
.tab:hover { background: #f1f5f9; text-decoration: none; }
.tab.active { color: var(--brand-dark); border-bottom-color: var(--brand); background: var(--brand-soft); }

/* invoice document */
.invoice { padding: 32px 34px; max-width: 820px; }
.inv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; border-bottom: 2px solid var(--line); padding-bottom: 18px; }
.inv-club { font-size: 22px; font-weight: 750; }
.inv-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.inv-meta { text-align: right; font-size: 13.5px; }
.inv-metarow { display: flex; justify-content: flex-end; gap: 10px; }
.inv-metarow .k { color: var(--muted); }
.inv-metarow .v { font-weight: 600; min-width: 88px; text-align: right; }
.inv-billto { margin: 20px 0; }
.inv-label { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 650; margin-bottom: 6px; }
.inv-name { font-weight: 650; font-size: 15px; }
.inv-line { color: var(--muted); font-size: 13.5px; }
.inv-lines { margin-top: 6px; }
.inv-totals { margin-top: 16px; margin-left: auto; width: 280px; display: flex; flex-direction: column; gap: 6px; }
.inv-totrow { display: flex; justify-content: space-between; font-size: 15px; padding: 3px 0; }
.inv-totrow:last-child { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; font-size: 17px; }
.inv-foot { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; text-align: center; }

@media print {
  .topnav, .crumbs, .page-head, .toast, .modal-overlay { display: none !important; }
  body { background: #fff; }
  main { padding: 0; max-width: none; }
  .invoice { border: 0; box-shadow: none; max-width: none; padding: 0; }
  a { color: inherit; text-decoration: none; }
}

/* modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--panel); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(15,23,42,.25);
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal .mhead { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal .mhead h3 { margin: 0; font-size: 17px; }
.modal .mbody { padding: 18px 20px; display: grid; gap: 14px; }
.modal .mgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 480px) { .modal .mgrid { grid-template-columns: 1fr; } }
.modal .mfoot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.modal .x { border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 13px 22px; border-radius: 12px; font-size: 15px; font-weight: 600; box-shadow: var(--shadow); z-index: 50; }
.toast.err { background: var(--red); }
