/* Shared styles for the members area (/account, /profile) */
:root {
  --ink: #14213d;
  --ink-soft: #3a4763;
  --muted: #6b7489;
  --sand: #f6efe3;
  --sand-deep: #ecdfc8;
  --paper: #fffdf8;
  --orange: #ff6b35;
  --orange-dark: #e2541f;
  --sky: #2b6cb0;
  --mint: #d6efe3;
  --mint-line: #b8dfcb;
  --red: #b42318;
  --line: #e3d7c1;
  --radius: 18px;
  --display: "Bricolage Grotesque", "Arial Black", system-ui, sans-serif;
  --body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--sand); color: var(--ink);
  font-family: var(--body); font-size: 17px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; min-height: 100vh;
}
svg { display: block; }
a { color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--display); line-height: 1.08; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 24px; width: 100%; }

/* Header */
.mhead { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.mhead .bar { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 1.25rem; letter-spacing: -0.02em; }
.logo svg { width: 30px; height: 30px; flex: none; }
.tabs { display: flex; gap: 4px; background: var(--sand); border-radius: 999px; padding: 4px; }
.tabs a { text-decoration: none; font-weight: 700; font-size: .95rem; padding: 8px 18px; border-radius: 999px; color: var(--ink-soft); }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.logout { background: none; border: 0; font: 600 .95rem var(--body); color: var(--ink-soft); cursor: pointer; padding: 8px 0; }
.logout:hover { color: var(--ink); text-decoration: underline; }

main { flex: 1; padding: 40px 0 72px; }
.loading { text-align: center; color: var(--muted); padding: 80px 0; }

/* Cards */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.card + .card, .stack > * + * { margin-top: 20px; }
.card h2 { font-size: 1.5rem; font-weight: 800; }
.card .lede { color: var(--ink-soft); margin-top: 6px; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--orange-dark); }
.eyebrow::before { content: ""; width: 22px; height: 2px; background: currentColor; border-radius: 2px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 24px; border-radius: 999px; border: 2px solid transparent;
  font: 700 1rem var(--body); text-decoration: none; cursor: pointer;
  background: var(--orange); color: #fff; box-shadow: 0 5px 0 var(--orange-dark);
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--orange-dark); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--orange-dark); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: 0 5px 0 var(--orange-dark); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); box-shadow: none; }
.btn-ghost:hover { background: var(--ink); color: var(--paper); box-shadow: none; transform: none; }
.btn svg { width: 18px; height: 18px; }
.btn:focus-visible, a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }

/* Messages */
.msg { display: none; border-radius: 12px; padding: 12px 14px; font-size: .95rem; font-weight: 500; }
.msg.show { display: block; }
.msg.error { background: #fdecea; color: var(--red); border: 1px solid #f5c2bd; }
.msg.ok { background: var(--mint); color: var(--ink); border: 1px solid var(--mint-line); }
.notice { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: #fff4e5; border: 1px solid #f5d3a8; border-radius: 14px; padding: 14px 18px; font-weight: 600; }
.notice a { color: var(--orange-dark); }

/* Forms */
form.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; margin-top: 22px; }
form.grid .full { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; align-content: start; }
label { font-weight: 700; font-size: .9rem; }
.hint { font-size: .82rem; color: var(--muted); }
input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: #fff; font: 400 1rem var(--body); color: var(--ink);
}
input:focus { border-color: var(--sky); outline: none; box-shadow: 0 0 0 3px rgba(43,108,176,.18); }
input[aria-invalid="true"] { border-color: var(--red); }

/* FAQ */
.faq { display: grid; gap: 10px; margin-top: 18px; }
details { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 0 20px; }
summary { list-style: none; cursor: pointer; padding: 16px 0; font-weight: 700; display: flex; justify-content: space-between; gap: 16px; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-family: var(--display); font-size: 1.5rem; line-height: 1; color: var(--orange); transition: transform .2s; }
details[open] summary::after { transform: rotate(45deg); }
details p { padding-bottom: 18px; color: var(--ink-soft); }
details p + p { margin-top: -8px; }
details a { color: var(--orange-dark); font-weight: 700; }

footer { padding: 28px 0; color: var(--muted); font-size: .9rem; border-top: 1px solid var(--line); }
footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .mhead .bar { height: auto; padding: 12px 0; flex-wrap: wrap; }
  .tabs { order: 3; width: 100%; }
  .tabs a { flex: 1; text-align: center; }
  form.grid { grid-template-columns: 1fr; }
  .card { padding: 22px 18px; }
  main { padding: 24px 0 56px; }
}
@media (prefers-reduced-motion: reduce) { .btn, summary::after { transition: none; } html { scroll-behavior: auto; } }

/* ---------- Home view ---------- */
  .hero { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: end; margin-bottom: 24px; }
  .hero h1 { font-size: clamp(2.2rem, 6vw, 3.2rem); font-weight: 800; margin-top: 10px; }
  .hero h1 .accent { color: var(--orange); }
  .badge {
    display: flex; align-items: center; gap: 14px; background: var(--ink); color: var(--paper);
    border-radius: 18px; padding: 14px 20px 14px 14px; box-shadow: 0 18px 40px -24px rgba(20,33,61,.6);
  }
  .badge .ic { width: 46px; height: 46px; border-radius: 12px; background: var(--orange); display: grid; place-items: center; flex: none; }
  .badge .ic svg { width: 26px; height: 26px; color: #fff; }
  .badge small { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,253,248,.65); }
  .badge b { font-family: var(--display); font-size: 1.35rem; line-height: 1.15; display: block; }
  .badge span { font-size: .85rem; color: rgba(255,253,248,.75); }
  .gym { display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: center; background: var(--ink); color: var(--paper); border: 0; position: relative; overflow: hidden; }
  .gym::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 10px;
    background:
      linear-gradient(var(--paper), var(--paper)) top / 100% 2px no-repeat,
      repeating-linear-gradient(90deg, transparent 0 9px, rgba(255,253,248,.35) 9px 10px),
      repeating-linear-gradient(0deg, transparent 0 4px, rgba(255,253,248,.35) 4px 5px);
  }
  .gym .pin { width: 56px; height: 56px; border-radius: 16px; background: rgba(255,107,53,.18); display: grid; place-items: center; }
  .gym .pin svg { width: 30px; height: 30px; color: var(--orange); }
  .gym h2 { color: var(--paper); }
  .gym .lede { color: rgba(255,253,248,.78); }
  .gym .zip { display: inline-block; margin-top: 8px; font-size: .85rem; font-weight: 700; color: var(--orange); }
  .quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .quick a { display: block; text-decoration: none; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 18px; transition: border-color .15s; }
  .quick a:hover { border-color: var(--ink); }
  .quick b { display: block; font-family: var(--display); font-size: 1.1rem; }
  .quick span { font-size: .9rem; color: var(--ink-soft); }
  @media (max-width: 720px) {
    .hero { grid-template-columns: 1fr; }
    .gym { grid-template-columns: 1fr; }
    .gym .btn { width: 100%; }
    .quick { grid-template-columns: 1fr; }
  }

/* ---------- Account view ---------- */
  .ptop h1 { font-size: clamp(2rem, 5vw, 2.8rem); font-weight: 800; margin-top: 10px; }
  .ptop p { color: var(--ink-soft); margin-top: 8px; }
  .ptop { margin-bottom: 24px; }
  .summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-top: 18px; }
  .summary div { padding: 14px 16px; background: #fff; }
  .summary div + div { border-left: 1px solid var(--line); }
  .summary small { display: block; font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
  .summary b { word-break: break-word; }
  .actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
  .billing { position: relative; }
  .soon { display: inline-block; margin-left: 10px; vertical-align: middle; font-family: var(--body); font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; background: var(--sand-deep); color: var(--ink-soft); padding: 4px 10px; border-radius: 999px; }
  .paycard {
    margin-top: 18px; display: flex; align-items: center; gap: 16px; padding: 18px;
    border: 1.5px dashed var(--line); border-radius: 14px; background: #fff; color: var(--muted);
  }
  .paycard svg { width: 40px; height: 40px; flex: none; color: var(--line); }
  .paycard b { color: var(--ink-soft); display: block; }
  .bill-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
  .bill-head .btn { padding: 10px 18px; font-size: .95rem; }
  #bill-msg { margin-top: 14px; }
  .paycard span { display: block; }
  .hist-title { font-family: var(--display); font-size: 1.1rem; margin-top: 24px; }
  .hist { margin-top: 10px; border-top: 1px solid var(--line); }
  .hist-empty { padding: 14px 0; color: var(--muted); border-bottom: 1px solid var(--line); }
  .row { display: grid; grid-template-columns: 1.1fr 1.6fr .9fr .9fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .row .d { font-weight: 700; }
  .row .desc { color: var(--ink-soft); font-size: .95rem; }
  .row .amt { font-weight: 700; text-align: right; }
  .pill { justify-self: start; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; background: var(--sand); color: var(--ink-soft); }
  .pill.paid { background: var(--mint); color: #1d6b48; }
  .pill.open { background: #fff4e5; color: #9a5b00; }
  .pill.uncollectible { background: #fdecea; color: var(--red); }
  .dl { background: none; border: 1.5px solid var(--line); border-radius: 999px; padding: 7px 14px; font: 700 .85rem var(--body); color: var(--ink); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
  .dl:hover { border-color: var(--ink); }
  .dl svg { width: 15px; height: 15px; }
  .dl[disabled] { opacity: .5; cursor: wait; }
  @media (max-width: 720px) {
    .row { grid-template-columns: 1fr auto; }
    .row .desc { grid-column: 1 / -1; order: 3; }
    .row .amt { text-align: left; }
  }
  @media (max-width: 720px) {
    .summary { grid-template-columns: 1fr; }
    .summary div + div { border-left: 0; border-top: 1px solid var(--line); }
    .actions .btn { width: 100%; }
  }

/* ---------- Users (admin) view ---------- */
  .atop { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
  .atop h1 { font-size: clamp(2rem, 5vw, 2.8rem); font-weight: 800; margin-top: 10px; }
  .you { font-size: .9rem; color: var(--ink-soft); }

  .stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
  .stat { background: var(--paper); border: 1.5px solid var(--line); border-radius: 16px; padding: 14px 16px; text-align: left; cursor: pointer; font: inherit; color: inherit; }
  .stat:hover { border-color: var(--ink); }
  .stat[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
  .stat small { display: flex; align-items: center; gap: 8px; font-size: .74rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
  .stat b { font-family: var(--display); font-size: 1.9rem; line-height: 1.1; display: block; margin-top: 4px; }
  .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
  .dot.paid { background: #2f9e6b; } .dot.not_paid { background: #c4a46a; } .dot.past_due { background: #e8902b; } .dot.delinquent { background: var(--red); } .dot.all { background: var(--ink); }
  .nobill { margin-top: 12px; }

  .add { display: grid; grid-template-columns: 1fr 1.2fr auto; gap: 12px; align-items: end; margin-top: 16px; }
  .add .btn { padding: 12px 20px; }

  .tools { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
  .tools input { max-width: 320px; }
  .count { color: var(--muted); font-size: .9rem; }

  .table { border-top: 1px solid var(--line); }
  .urow { display: grid; grid-template-columns: 2fr 1.1fr .7fr 1fr 1.3fr auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
  .urow.head { font-size: .74rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 10px 0; }
  .who b { display: block; }
  .who span { font-size: .88rem; color: var(--ink-soft); word-break: break-all; }
  .muted { color: var(--muted); font-size: .9rem; }
  .urow > :nth-child(2) { white-space: nowrap; }
  .tag { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; background: var(--sand); color: var(--ink-soft); white-space: nowrap; }
  .tag.owner { background: var(--ink); color: var(--paper); }
  .tag.admin { background: #e7eefb; color: #1f4f8f; }
  .tag.paid { background: var(--mint); color: #1d6b48; }
  .tag.not_paid { background: #f6eedc; color: #7a5d1f; }
  .tag.past_due { background: #fff1de; color: #9a5b00; }
  .tag.delinquent { background: #fdecea; color: var(--red); }
  .tag.canceled { background: #eceef2; color: var(--muted); }
  .pay small { display: block; font-size: .8rem; color: var(--ink-soft); margin-top: 3px; }
  .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  .act { background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 12px; font: 700 .82rem var(--body); color: var(--ink); cursor: pointer; white-space: nowrap; }
  .act:hover { border-color: var(--ink); }
  .act.danger { color: var(--red); }
  .act.danger.confirm { background: var(--red); color: #fff; border-color: var(--red); }
  .act[disabled] { opacity: .5; cursor: wait; }
  .empty { padding: 28px 0; text-align: center; color: var(--muted); }

  @media (max-width: 960px) {
    .stats { grid-template-columns: repeat(3, 1fr); }
    .urow.head { display: none; }
    .urow { grid-template-columns: 1fr auto; gap: 8px 12px; }
    .urow > :nth-child(2), .urow > :nth-child(3), .urow > :nth-child(4) { font-size: .9rem; }
    .acts { grid-column: 1 / -1; justify-content: flex-start; }
  }
  @media (max-width: 720px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .add { grid-template-columns: 1fr; }
    .add .btn { width: 100%; }
    .tools input { max-width: none; }
  }

/* ---------- App shell ---------- */
.view { animation: fade .18s ease; }
@keyframes fade { from { opacity: .4; } to { opacity: 1; } }
.skel { display: grid; gap: 20px; padding-top: 8px; }
.skel i { display: block; background: linear-gradient(90deg, #efe6d6 0%, #f7f0e4 50%, #efe6d6 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: 16px; }
.skel i:nth-child(1) { height: 70px; max-width: 420px; }
.skel i:nth-child(2) { height: 150px; }
.skel i:nth-child(3) { height: 260px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .view, .skel i { animation: none; } }

/* ---------- Start membership (checkout) ---------- */
.join { margin-top: 18px; padding: 18px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; }
.join b { display: block; font-family: var(--display); font-size: 1.1rem; }
.join > span { display: block; color: var(--ink-soft); margin-top: 4px; }
.join-opts { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.join .hint { display: block; margin-top: 10px; font-size: .88rem; color: var(--muted); }
@media (max-width: 720px) { .join-opts .btn { width: 100%; } }

/* ---------- Cancel membership ---------- */
.cancel-box { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.linkbtn { background: none; border: 0; padding: 0; font: 700 .92rem var(--body); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; color: var(--ink-soft); }
.linkbtn.danger { color: var(--red); }
.linkbtn:hover { color: var(--ink); }
#cancel-form { display: grid; gap: 12px; }
#cancel-form[hidden] { display: none; }
#cancel-form p { color: var(--ink-soft); }
.cancel-title { font-family: var(--display); font-size: 1.15rem; }
.hint-inline { font-weight: 400; color: var(--muted); }
textarea { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font: 400 1rem var(--body); color: var(--ink); resize: vertical; min-height: 80px; }
textarea:focus { border-color: var(--sky); outline: none; box-shadow: 0 0 0 3px rgba(43,108,176,.18); }
.cancel-acts { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-danger { background: var(--red); box-shadow: 0 5px 0 #7f1a12; }
.btn-danger:hover { box-shadow: 0 7px 0 #7f1a12; }
.btn-danger:active { box-shadow: 0 2px 0 #7f1a12; }
#cancel-scheduled .btn { padding: 9px 16px; font-size: .92rem; }
.pay .ends { display: block; font-size: .8rem; color: var(--red); margin-top: 3px; font-weight: 600; }
@media (max-width: 720px) { .cancel-acts .btn { width: 100%; } }
.act.remind { background: var(--orange); border-color: var(--orange); color: #fff; }
.act.remind:hover { background: var(--orange-dark); border-color: var(--orange-dark); }
.pay .reminded { display: block; font-size: .78rem; color: var(--muted); margin-top: 3px; }

/* ---------- Deactivated members ---------- */
.tool-right { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 600; color: var(--ink-soft); cursor: pointer; white-space: nowrap; }
.toggle input { width: 18px; height: 18px; accent-color: var(--ink); }
.urow.deactivated > :not(.acts) { opacity: .55; }
.tag.deactivated { background: #eceef2; color: var(--muted); }
@media (max-width: 720px) { .tool-right { width: 100%; } .tool-right input[type=search] { flex: 1; } }
