/* Shared design system for the gym app, scanner, member card and Kinetix Gym Cloud. */
:root {
  color-scheme: light dark;
  --bg: #f2f5f4; --surface: #ffffff; --surface-2: #f6f9f8; --text: #1e2b2f; --muted: #64737a; --line: #e0e6e4;
  /* --accent is the gym's chosen colour (set by theme.js); every brand shade is derived from it. */
  --accent: #04449a; --on-brand-l: #ffffff; --on-brand-d: #06201d;
  --brand: var(--accent); --brand-dark: color-mix(in srgb, var(--accent) 80%, #000);
  --brand-soft: color-mix(in srgb, var(--accent) 13%, var(--surface)); --on-brand: var(--on-brand-l);
  --brand-glow: color-mix(in srgb, var(--accent) 28%, transparent);
  --side: color-mix(in srgb, var(--accent) 20%, #0d1719); --side-text: #a9bdbf;
  --side-active: color-mix(in srgb, var(--accent) 36%, #131f22); --side-accent: color-mix(in srgb, var(--accent) 45%, #fff);
  --deep: color-mix(in srgb, var(--accent) 14%, #0a1315); --deep-glow: color-mix(in srgb, var(--accent) 40%, #0f1c1f);
  --ok: #17794a; --ok-bg: #dff3e7; --warn: #96620a; --warn-bg: #fbefcf; --bad: #b3362f; --bad-bg: #fbe3e0;
  --shadow: 0 1px 2px rgba(16, 40, 44, .05), 0 4px 16px rgba(16, 40, 44, .05);
  --shadow-lg: 0 24px 60px rgba(8, 24, 27, .28);
  --radius: 14px; --ease: cubic-bezier(.2, .8, .2, 1);
}
/* Dark theme: used when the device is dark (unless the gym forces light), or when the gym forces dark.
   The two blocks below must stay identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1618; --surface: #162023; --surface-2: #1b272a; --text: #e2e9e8; --muted: #90a1a4; --line: #27363a;
    --brand: color-mix(in srgb, var(--accent) 70%, #fff); --brand-dark: color-mix(in srgb, var(--accent) 55%, #fff);
    --brand-soft: color-mix(in srgb, var(--accent) 24%, var(--surface)); --on-brand: var(--on-brand-d);
    --side: color-mix(in srgb, var(--accent) 7%, #0a1113); --side-text: #8fa2a5; --side-active: color-mix(in srgb, var(--accent) 24%, #111b1d);
    --ok: #5fd093; --ok-bg: #143524; --warn: #e5b454; --warn-bg: #3a2d10; --bad: #f08a80; --bad-bg: #3d1b18;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1618; --surface: #162023; --surface-2: #1b272a; --text: #e2e9e8; --muted: #90a1a4; --line: #27363a;
  --brand: color-mix(in srgb, var(--accent) 70%, #fff); --brand-dark: color-mix(in srgb, var(--accent) 55%, #fff);
  --brand-soft: color-mix(in srgb, var(--accent) 24%, var(--surface)); --on-brand: var(--on-brand-d);
  --side: color-mix(in srgb, var(--accent) 7%, #0a1113); --side-text: #8fa2a5; --side-active: color-mix(in srgb, var(--accent) 24%, #111b1d);
  --ok: #5fd093; --ok-bg: #143524; --warn: #e5b454; --warn-bg: #3a2d10; --bad: #f08a80; --bad-bg: #3d1b18;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 24px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
a { color: var(--brand); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(8px); } }
@keyframes sheet { from { transform: translateY(100%); } }
@keyframes grow { from { transform: scaleY(0); } }
@keyframes growx { from { transform: scaleX(0); } }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
@keyframes pulse { 0% { transform: scale(.96); } 55% { transform: scale(1.025); } 100% { transform: scale(1); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes breathe { 50% { opacity: .45; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 16px); } }
.enter > * { animation: rise .45s var(--ease) both; }
.enter > *:nth-child(2) { animation-delay: .06s; } .enter > *:nth-child(3) { animation-delay: .12s; } .enter > *:nth-child(4) { animation-delay: .18s; }
.enter > .stats, .enter > .grid2 { animation: none; } /* their children animate one by one instead */
.enter .stat { animation: rise .5s var(--ease) both; }
.enter .stat:nth-child(2) { animation-delay: .05s; } .enter .stat:nth-child(3) { animation-delay: .1s; }
.enter .stat:nth-child(4) { animation-delay: .15s; } .enter .stat:nth-child(5) { animation-delay: .2s; } .enter .stat:nth-child(6) { animation-delay: .25s; }
.enter .grid2 > .card { animation: rise .5s var(--ease) both; }
.enter .grid2 > .card:nth-child(2) { animation-delay: .08s; } .enter .grid2 > .card:nth-child(3) { animation-delay: .16s; } .enter .grid2 > .card:nth-child(4) { animation-delay: .24s; }

/* ---------- app shell: sidebar on desktop, bottom tab bar on phones ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: var(--side-text); padding: 22px 14px; display: flex; flex-direction: column; gap: 26px; position: sticky; top: 0; height: 100vh; }
.side .brand { display: flex; gap: 12px; align-items: center; color: #fff; font-weight: 700; font-size: 16px; padding: 0 8px; min-width: 0; }
/* the gym name: a long one wraps onto more lines and is shown in full (names are at most 80 characters) */
.side .brand span:last-child { min-width: 0; line-height: 1.25; overflow-wrap: anywhere; }
.logo { width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(140deg, var(--brand), var(--brand-dark)); display: grid; place-items: center; color: var(--on-brand); overflow: hidden; flex: none; box-shadow: 0 4px 12px var(--brand-glow); }
#nav { display: flex; flex-direction: column; gap: 4px; }
#nav button { display: flex; gap: 12px; align-items: center; justify-content: flex-start; width: 100%; background: none; border: 0; box-shadow: none; color: inherit; padding: 11px 12px; border-radius: 10px; text-align: left; font-weight: 500; transition: background .2s, color .2s; }
#nav button:hover { background: var(--side-active); color: #fff; transform: none; }
#nav button.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--side-accent); }
#nav button.active .ic { color: var(--side-accent); }
#nav button * { pointer-events: none; }
.content { min-width: 0; }
.pagehead { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 24px 30px 0; flex-wrap: wrap; max-width: 1200px; }
.pagehead h1 { margin: 0; }
.eyebrow { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; margin-right: 6px; white-space: nowrap; }
.clock-time { font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.clock-date { font-size: 12px; color: var(--muted); }
main { padding: 20px 30px 60px; max-width: 1200px; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; transition: transform .25s var(--ease), box-shadow .25s; }
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--brand); opacity: .75; }
.stat:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(16, 40, 44, .1); }
.stat .n { font-size: 27px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 2px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 { margin-bottom: 16px; }

/* ---------- controls ---------- */
button, .btn { font: inherit; font-weight: 600; font-size: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 9px 15px; border-radius: 10px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .15s var(--ease), background .2s, border-color .2s, box-shadow .2s; -webkit-tap-highlight-color: transparent; }
button:hover, .btn:hover { border-color: var(--brand); transform: translateY(-1px); }
button:active, .btn:active { transform: scale(.96); }
button.primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: 0 2px 8px var(--brand-glow); }
button.primary:hover, .btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); box-shadow: 0 6px 16px var(--brand-glow); }
button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
button.danger:hover { background: var(--bad-bg); border-color: var(--bad); }
button.small, .btn.small { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); outline-offset: 1px; }
input, select, textarea { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; width: 100%; background: var(--surface-2); color: var(--text); transition: border-color .2s, box-shadow .2s, background .2s; }
/* Dropdowns draw their own arrow, sitting just inside the right edge, the same on every browser. */
select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23778' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px; }
select::-ms-expand { display: none; }
/* a filter dropdown is only as wide as the option chosen, so the arrow stays next to the words */
select.fit { width: auto; field-sizing: content; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px var(--brand-soft); outline: none; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 12px; }
label input, label select, label textarea { margin-top: 5px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 0 12px; }
.error { color: var(--bad); font-size: 14px; min-height: 20px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.muted { white-space: normal; min-width: 150px; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
tr.click { cursor: pointer; transition: background .15s; }
tr.click:hover { background: var(--surface-2); }
.person { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.active { background: var(--ok-bg); color: var(--ok); }
.badge.expiring { background: var(--warn-bg); color: var(--warn); }
.badge.expired, .badge.none { background: var(--bad-bg); color: var(--bad); }

/* ---------- dialog ---------- */
dialog { border: 1px solid var(--line); border-radius: 18px; padding: 0; width: min(780px, 94vw); max-height: 92vh; box-shadow: var(--shadow-lg); background: var(--surface); color: var(--text); }
dialog[open] { animation: pop .3s var(--ease); }
dialog::backdrop { background: rgba(8, 20, 22, .55); backdrop-filter: blur(3px); animation: fade .25s; }
dialog .dhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
dialog .dhead h2 { margin: 0; }
dialog .dbody { padding: 20px; overflow-y: auto; max-height: calc(92vh - 66px); }
#dlgClose { width: 34px; height: 34px; padding: 0; border-radius: 50%; }

/* ---------- sign-in ---------- */
.auth { max-width: 400px; margin: 9vh auto; padding: 28px; animation: pop .5s var(--ease); }
.auth .logo { width: 48px; height: 48px; border-radius: 14px; margin-bottom: 16px; }
.auth .logo .ic { width: 26px; height: 26px; }
.auth button.primary { width: 100%; padding: 11px; }
.barcode-box { text-align: center; background: #fff; border: 1px dashed var(--line); border-radius: 12px; padding: 12px; }
.barcode-box svg { max-width: 100%; height: auto; }

/* ---------- toast ---------- */
#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--side); color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); z-index: 100; display: flex; gap: 10px; align-items: center; animation: toast-in .35s var(--ease); max-width: calc(100vw - 32px); }
#toast .ic { color: var(--side-accent); }

/* ---------- charts (gym app and Kinetix Gym Cloud) ---------- */
.chart { display: flex; align-items: flex-end; gap: 2px; height: 180px; border-bottom: 1px solid var(--line); margin-top: 28px; }
.chart .col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; position: relative; min-width: 0; }
.chart .bar { width: 100%; max-width: 44px; background: var(--brand); border-radius: 4px 4px 0 0; transform-origin: bottom; transition: background .2s; }
.enter .chart .bar { animation: grow .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 18ms + .15s); }
.chart .col:hover .bar { background: var(--brand-dark); }
.chart .col.zero .bar { height: 2px !important; background: var(--line); border-radius: 0; }
.chart .peak { position: absolute; left: 50%; transform: translateX(-50%); font-size: 12px; font-weight: 600; white-space: nowrap; }
.axis { display: flex; gap: 2px; margin-top: 6px; }
.axis span { flex: 1; min-width: 0; text-align: center; font-size: 11px; color: var(--muted); white-space: nowrap; }
#tip.hidden { display: none; }
#tip { position: fixed; pointer-events: none; background: var(--side); color: #fff; padding: 6px 10px; border-radius: 8px; font-size: 13px; z-index: 50; white-space: nowrap; box-shadow: var(--shadow-lg); }
details { margin-top: 10px; } summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.sync { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.sync::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: breathe 2.4s infinite; }
.sync.stale { color: var(--warn); } .sync.stale::before { background: var(--warn); animation: none; }
.planrow { display: grid; grid-template-columns: minmax(80px, 130px) 1fr 40px; gap: 10px; align-items: center; margin-bottom: 10px; font-size: 14px; }
.planrow .track { background: var(--surface-2); border-radius: 6px; height: 12px; overflow: hidden; }
.planrow .fill { background: var(--brand); border-radius: 6px; height: 12px; transform-origin: left; }
.enter .planrow .fill { animation: growx .8s var(--ease) both .2s; }

/* ---------- phones and small tablets ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: auto 0 0 0; height: auto; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 20; border-top: 1px solid rgba(255, 255, 255, .08); box-shadow: 0 -6px 24px rgba(0, 0, 0, .18); }
  .side .brand { display: none; }
  #nav { flex-direction: row; gap: 2px; }
  #nav button { flex: 1; min-width: 0; flex-direction: column; justify-content: center; gap: 3px; font-size: 10.5px; padding: 8px 2px; text-align: center; white-space: nowrap; }
  #nav button.active { box-shadow: none; color: var(--side-accent); }
  .pagehead { padding: 16px 16px 0; }
  h1 { font-size: 21px; }
  main { padding: 14px 16px 104px; }
  #toast { bottom: 88px; }
  .hide-sm { display: none !important; }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stats > :last-child:nth-child(odd) { grid-column: span 2; }
  #mq { max-width: none !important; flex: 1 1 100%; }
  .stat { padding: 14px; } .stat .n { font-size: 22px; }
  .card { padding: 15px; }
  /* tables with headings become a list of cards (labels come from ui.js) */
  table.stack tr:has(th) { display: none; }
  table.stack, table.stack tbody { display: block; }
  table.stack tr { display: block; border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px; margin-bottom: 10px; background: var(--surface-2); }
  table.stack td { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 8px 0; white-space: normal; text-align: right; border-bottom: 1px dashed var(--line); }
  table.stack td:last-child { border-bottom: 0; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; text-align: left; flex: none; }
  table.stack td[data-label=""]::before { display: none; }
  table.stack td:empty { display: none; }
  dialog { width: 100vw; max-width: 100vw; max-height: 94vh; margin: auto 0 0; border-radius: 20px 20px 0 0; border-width: 1px 0 0; }
  dialog[open] { animation: sheet .35s var(--ease); }
  dialog .dbody { max-height: calc(94vh - 66px); padding: 16px; }
  .auth { margin: 5vh 16px; }
  input, select, textarea { font-size: 16px; } /* stops iOS zooming into fields */
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}

/* ---------- gym logo ---------- */
.logo.has-img { background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
.logo img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* ---------- settings: branding ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 16px; align-items: start; }
.settings-grid > .card { margin-bottom: 0; }
.field-title { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 8px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.swatch { width: 38px; height: 38px; padding: 0; border-radius: 50%; border: 3px solid var(--surface); background: var(--c); box-shadow: 0 0 0 1px var(--line); position: relative; }
.swatch:hover { transform: scale(1.1); border-color: var(--surface); }
.swatch.on { box-shadow: 0 0 0 3px var(--c); }
.swatch.on::after { content: ""; position: absolute; inset: 0; margin: auto; width: 10px; height: 10px; border-radius: 50%; background: #fff; }
.swatch.custom { background: conic-gradient(#e5484d, #f5a524, #30a46c, #0091ff, #8e4ec6, #e5484d); overflow: hidden; }
.swatch.custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; padding: 0; margin: 0; }
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 16px; }
.segmented button { border: 0; background: none; box-shadow: none; padding: 7px 16px; border-radius: 9px; color: var(--muted); }
.segmented button:hover { transform: none; color: var(--text); }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.logo-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.logo-preview { width: 76px; height: 76px; border-radius: 16px; border: 1px dashed var(--line); background: #fff; display: grid; place-items: center; overflow: hidden; color: #64737a; font-size: 12px; text-align: center; flex: none; }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- membership card preview ---------- */
.card-preview { display: block; width: min(250px, 100%); height: auto; margin: 0 auto; border-radius: 16px; box-shadow: 0 12px 30px rgba(8, 24, 27, .22); animation: pop .5s var(--ease); }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 14px 0 18px; }
button[disabled] { opacity: .55; cursor: not-allowed; transform: none !important; }

/* ---------- member photo ---------- */
img.avatar { object-fit: cover; display: block; }
.photo-row { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.photo { width: 88px; height: 88px; border-radius: 50%; flex: none; object-fit: cover; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 28px; font-weight: 700; border: 3px solid var(--surface); box-shadow: 0 0 0 2px var(--brand-soft), var(--shadow); }
.cam-capture { text-align: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 16px; animation: rise .35s var(--ease); }
/* Square, mirrored like a selfie preview; the saved photo is the same square crop (not mirrored). */
.cam-capture video { width: min(260px, 100%); aspect-ratio: 1; object-fit: cover; border-radius: 50%; background: #000; transform: scaleX(-1); display: block; margin: 0 auto; box-shadow: 0 0 0 4px var(--brand-soft); }
@media (max-width: 640px) { .photo { width: 72px; height: 72px; font-size: 24px; } }

/* ---------- customer types, membership and plan boxes ---------- */
.badge.member { background: var(--brand-soft); color: var(--brand); }
.badge.daily { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.badge.lapsed { background: var(--bad-bg); color: var(--bad); }
.type-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 10px; margin-bottom: 16px; }
.type-card { display: block; position: relative; margin: 0; padding: 14px 14px 14px 42px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface-2); cursor: pointer; transition: border-color .2s, background .2s, transform .15s var(--ease); }
.type-card:hover { transform: translateY(-1px); }
.type-card input { position: absolute; left: 14px; top: 16px; width: 18px; height: 18px; margin: 0; padding: 0; accent-color: var(--brand); }
.type-card strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 3px; }
.type-card span { font-size: 13px; font-weight: 400; line-height: 1.4; }
.type-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.pay-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; background: var(--surface-2); }
.pay-box h3 { margin-bottom: 6px; }
.pay-box p { margin: 0 0 12px; font-size: 14px; }
.pay-box input, .pay-box select { background: var(--surface); }
.planrow.wide { grid-template-columns: minmax(80px, 130px) 1fr minmax(40px, auto); }

/* ---------- start-up splash ---------- */
.splash { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: var(--deep); transition: opacity .45s, visibility .45s; }
.splash.done { opacity: 0; visibility: hidden; }
.splash-in { display: grid; justify-items: center; gap: 18px; }
.splash .kx-tile.big { animation: splash-pulse 1.300s ease-in-out infinite; }
.splash-by { margin: 0; color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .01em; text-align: center; }
.splash-by span { display: block; font-weight: 500; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; opacity: .65; margin-top: 3px; }
@keyframes splash-pulse { 50% { transform: scale(1.06); box-shadow: 0 0 0 18px rgba(4, 68, 154, .28); } }

/* ---------- app updates ---------- */
.update-box { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface-2); }
.update-notes { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.update-notes li { margin: 3px 0; }
.upd-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 16px; font-size: 14px; background: var(--brand-soft); color: var(--text); border-bottom: 1px solid var(--line); }
.update-cover { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; text-align: center; padding: 24px; background: var(--deep); color: #fff; }
.update-cover h2 { margin: 18px 0 6px; }
.update-cover p { margin: 0; opacity: .75; max-width: 40ch; }
.update-cover .kx-tile.big { animation: splash-pulse 1.300s ease-in-out infinite; }

/* ---------- Kinetix Labs, the maker of the app ---------- */
.kx-tile { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: #04449a; flex: none; }
.kx-tile img { width: 64%; height: auto; display: block; }
.kx-tile.big { width: 80px; height: 80px; border-radius: 22px; box-shadow: 0 18px 44px rgba(0, 0, 0, .35); }
.made-by { display: flex; align-items: center; justify-content: center; gap: 9px; margin: 28px 0 0; font-size: 13px; color: var(--muted); }
.made-by strong { color: var(--text); font-weight: 700; }
.side-by { margin: auto 0 0; padding: 14px 8px 0; border-top: 1px solid rgba(255, 255, 255, .1); display: flex; align-items: center; gap: 10px; font-size: 11.500px; line-height: 1.35; color: var(--side-text); opacity: .7; }
.side-by img { width: 22px; height: auto; flex: none; }
@media (max-width: 860px) { .side-by { display: none; } } /* the menu becomes a bottom bar on phones */

/* ---------- login and first-time setup ---------- */
.auth-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); background: var(--bg); }
/* left: the gym's name on its own colour, with slow drifting light and a faint grid */
.auth-brand { position: relative; overflow: hidden; color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: center;
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 60%, #071012), var(--deep) 80%); }
.auth-brand::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 46px 46px; -webkit-mask-image: radial-gradient(circle at 30% 40%, #000, transparent 72%); mask-image: radial-gradient(circle at 30% 40%, #000, transparent 72%); }
.orbs i { position: absolute; border-radius: 50%; filter: blur(64px); opacity: .5; animation: drift 16s ease-in-out infinite alternate; }
.orbs i:nth-child(1) { width: 420px; height: 420px; top: -130px; right: -110px; background: color-mix(in srgb, var(--accent) 75%, #fff); }
.orbs i:nth-child(2) { width: 340px; height: 340px; bottom: -120px; left: -90px; background: var(--accent); animation-duration: 20s; animation-delay: -5s; }
.orbs i:nth-child(3) { width: 210px; height: 210px; top: 56%; left: 58%; opacity: .22; background: color-mix(in srgb, var(--accent) 45%, #fff); animation-duration: 24s; animation-delay: -9s; }
@keyframes drift { to { transform: translate(46px, 34px) scale(1.14); } }
.auth-brand-in { position: relative; z-index: 1; animation: rise .8s var(--ease) both; }
.auth-brand .logo { width: 78px; height: 78px; border-radius: 22px; margin-bottom: 30px; box-shadow: 0 18px 44px rgba(0, 0, 0, .35); }
.auth-brand .logo .ic { width: 40px; height: 40px; }
.auth-brand h1 { font-size: clamp(34px, 4.600vw, 60px); line-height: 1.04; letter-spacing: -.03em; font-weight: 800; margin: 0 0 18px; overflow-wrap: anywhere; }
.auth-tagline { font-size: clamp(16px, 1.600vw, 21px); line-height: 1.4; opacity: .85; margin: 0; max-width: 32ch; }
.auth-tagline::before { content: ""; display: block; width: 52px; height: 4px; border-radius: 4px; background: var(--side-accent); margin-bottom: 18px; transform-origin: left; animation: growx .8s .35s var(--ease) both; }
.auth-contact { position: absolute; left: 56px; right: 56px; bottom: 32px; z-index: 1; margin: 0; font-size: 13px; opacity: .6; }
/* right: the form */
.auth-panel { display: grid; place-items: center; padding: 36px 24px; }
.auth-form { width: min(380px, 100%); animation: rise .7s .12s var(--ease) both; }
.auth-form h2 { font-size: 30px; letter-spacing: -.02em; margin: 6px 0 6px; }
.auth-form > .muted { margin: 0 0 26px; }
.auth-form input { padding: 13px 14px; border-radius: 12px; }
.auth-form button.primary { width: 100%; padding: 13px; font-size: 15px; border-radius: 12px; margin-top: 6px; }
.pw { position: relative; display: block; margin-top: 5px; }
.pw input { margin-top: 0; padding-right: 70px; }
.pw-toggle, .pw-toggle:hover, .pw-toggle:active { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; box-shadow: none; padding: 6px 10px; font-size: 13px; color: var(--muted); }
.pw-toggle:hover { color: var(--brand); }
@media (max-width: 860px) {
  .auth-screen { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .auth-brand { padding: 40px 24px 46px; min-height: 36vh; border-radius: 0 0 28px 28px; }
  .auth-brand .logo { width: 60px; height: 60px; border-radius: 18px; margin-bottom: 20px; }
  .auth-brand .logo .ic { width: 30px; height: 30px; }
  .auth-contact { display: none; }
  .auth-panel { place-items: start center; padding: 30px 20px 40px; }
}

/* ---------- staff accounts ---------- */
.staff-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.staff-row:last-of-type { border-bottom: 0; }
/* the username always gets room and shows in full; the buttons go to the next line when it is narrow */
.staff-row .who { flex: 1 1 160px; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.role-chip { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 3px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }

/* ---------- forgot password and recovery code ---------- */
.auth-alt { text-align: center; margin: 16px 0 0; }
.linkish, .linkish:hover, .linkish:active { border: 0; background: none; box-shadow: none; padding: 4px 6px; color: var(--brand); font-weight: 600; transform: none; }
.linkish:hover { text-decoration: underline; }
.small-note { font-size: 13px; line-height: 1.5; margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
.code-input { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .06em; text-transform: uppercase; }
.code-box { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: clamp(17px, 2.200vw, 22px); font-weight: 700; letter-spacing: .08em; text-align: center; padding: 18px 12px; margin: 14px 0; border-radius: 14px; background: var(--brand-soft); color: var(--text); border: 2px dashed var(--brand); user-select: all; overflow-wrap: anywhere; animation: pop .5s var(--ease); }
.code-panel .check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text); margin: 16px 0; cursor: pointer; }
.code-panel .check input { width: 18px; height: 18px; margin: 2px 0 0; padding: 0; flex: none; accent-color: var(--brand); }
.code-panel ul { margin: 0 0 4px; padding-left: 20px; font-size: 14px; color: var(--muted); }
.code-panel li { margin-bottom: 4px; }
.log-list { margin: 0; padding: 0; list-style: none; font-size: 13px; }
.log-list li { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.log-list li:last-child { border-bottom: 0; }
.log-list time { color: var(--muted); white-space: nowrap; flex: none; font-variant-numeric: tabular-nums; }

/* ---------- licence ---------- */
/* stays at the top while the page scrolls; it keeps its own row, so nothing sits underneath it */
#licCard { scroll-margin-top: 76px; }
.lic-banner { position: sticky; top: 0; z-index: 15; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 10px 16px; font-size: 14px; font-weight: 500; background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); animation: fade .4s; }
.lic-banner.locked { background: var(--bad-bg); color: var(--bad); border-bottom-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.lic-banner button { background: transparent; color: inherit; border-color: currentColor; }
.setup-licence { font-size: 13px; line-height: 1.9; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.setup-licence .machine-code { font-size: 13px; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.machine-code {font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 16px; font-weight: 700; letter-spacing: .06em; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); user-select: all; }
@media (max-width: 600px) { .pagehead .clock { display: none; } } /* phones already show the time */

/* ---------- Download report dialog ---------- */
#expDlg { width: min(520px, 94vw); overflow: hidden; }
.exp fieldset { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.exp legend { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; padding: 0; }
.exp-formats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.exp-format, .exp-part { display: flex; gap: 10px; align-items: flex-start; margin: 0; cursor: pointer; color: var(--text); }
.exp-format { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); transition: border-color .2s, background .2s; }
.exp-format:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.exp-part { padding: 7px 0; }
.exp-format input, .exp-part input { width: 18px; height: 18px; margin: 2px 0 0; padding: 0; flex: none; accent-color: var(--brand); }
.exp-format span, .exp-part span { display: grid; gap: 2px; font-size: 14px; }
.exp-format small, .exp-part small { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.exp-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.exp-dates label { margin: 0; }
.exp-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
@media (max-width: 420px) { .exp-formats, .exp-dates { grid-template-columns: 1fr; } }

.chart-note { font-size: 13px; color: var(--muted); margin: -6px 0 0; }
.card h3.sub { font-size: 14px; margin: 18px 0 10px; color: var(--muted); font-weight: 600; }
.card h3.sub:first-of-type { margin-top: 4px; }
.pay-charts { margin: 4px 0 18px; }
.card.inner { box-shadow: none; background: var(--surface-2); }
/* online sign-ups */
.join-qr { display: flex; justify-content: center; margin: 8px 0 14px; }
.join-qr canvas, .join-qr .qr { width: min(240px, 70%); height: auto; border-radius: 14px; border: 1px solid var(--line); background: #fff; }
.signup { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; background: var(--surface-2); }
.signup h3 { margin: 0 0 2px; font-size: 16px; }
.signup dl { display: grid; grid-template-columns: minmax(90px, auto) 1fr; gap: 3px 12px; margin: 8px 0 12px; font-size: 14px; }
.signup dt { color: var(--muted); } .signup dd { margin: 0; overflow-wrap: anywhere; }
.signup .dup { background: var(--warn-bg, #fbefcf); color: var(--warn, #96620a); border-radius: 10px; padding: 8px 10px; font-size: 13px; margin-bottom: 10px; }
.count-pill { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: var(--on-brand); font-size: 12px; font-weight: 700; }
#nav .nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--side-accent); color: var(--side); font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; }
@media (max-width: 860px) { #nav button { position: relative; } #nav .nav-count { position: absolute; top: 3px; right: calc(50% - 22px); margin: 0; height: 17px; min-width: 17px; font-size: 10.5px; } }
.signup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.signup-grid .signup.card { margin: 0; background: var(--surface); }
tr.voided td { opacity: .6; } tr.voided td:nth-child(-n+5) { text-decoration: line-through; } tr.voided td small { text-decoration: none; display: inline-block; }
.check-row { display: flex; gap: 10px; align-items: center; color: var(--text); font-size: 14px; cursor: pointer; }
.check-row input { width: 18px; height: 18px; margin: 0; padding: 0; flex: none; accent-color: var(--brand); }
/* check-ins grouped by person */
tr[aria-expanded="true"] { background: var(--surface-2); }
tr[aria-expanded] td:first-child::before { content: "▸"; display: inline-block; width: 14px; color: var(--muted); transition: transform .15s; }
tr[aria-expanded="true"] td:first-child::before { transform: rotate(90deg); }
.times { display: inline-block; background: var(--brand-soft); color: var(--brand); border-radius: 999px; padding: 1px 9px; font-size: 12.5px; font-weight: 600; }
tr.visits td { background: var(--surface-2); padding-top: 4px; }
.visit-list { list-style: none; margin: 0 0 10px; padding: 0 0 0 14px; display: grid; gap: 6px; }
.visit-list li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.visit-list time { font-variant-numeric: tabular-nums; min-width: 64px; }
/* Staff (Staff & Pay add-on) */
.addon-card { max-width: 640px; }
.addon-card ul { margin: 0 0 14px; padding-left: 20px; line-height: 1.7; }
.warn-note { background: var(--warn-bg); color: var(--warn); border-color: transparent; box-shadow: none; font-size: 14px; }
.late { color: var(--warn); font-weight: 600; }
.nowrap { white-space: nowrap; }
.rest-days { gap: 6px 16px; margin-bottom: 4px; }
.rest-days .check-row { font-size: 14px; }
.day-table { font-size: 13.5px; }
.day-table th, .day-table td { padding-top: 6px; padding-bottom: 6px; }
.emp-pay { margin-top: 18px; align-items: start; }
#slip td.num, #slip th.num { text-align: right; white-space: nowrap; }
#slip tr.total td { font-weight: 600; border-top: 2px solid var(--line); }
