/* Facility owner Memberships page (memberships.js), from Daniel's Memberships mockup 2026-10-21.
   Layout, KPIs, table, panel and dialogs come from coaches.css (.cp-*); these are the Memberships-only pieces. */
.msp.open { grid-template-columns: minmax(0, 1fr) 420px; }
.msp .cp-head .fx-eyebrow { margin: 0 0 2px; }
.ms-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ms-up { display: inline-flex; align-items: center; gap: 3px; font-style: normal; color: #15803d; }
.ms-up .ic { width: 12px; height: 12px; }

/* Members / Plans & Packages / Renewals + Assign Membership */
.ms-tabrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ms-seg { display: flex; gap: 8px; }
.ms-seg button { min-height: 38px; padding: 0 16px; border: 1px solid #e8eaee; border-radius: 10px; background: #fff; font: inherit; font-size: 14px; font-weight: 600; color: #1f2937; cursor: pointer; }
.ms-seg button.on { background: #0b0f17; border-color: #0b0f17; color: #fff; }
.ms-assign { color: #2563eb; }
.ms-assign .ic { color: #2563eb; }
.msp .cp-body { padding-top: 0; }

/* Filters */
.ms-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ms-tools .cp-search { flex: 1 1 260px; background: #fff; }
.ms-sel select { min-height: 40px; padding: 0 30px 0 12px; border: 1px solid #d9dde3; border-radius: 10px; background: #fff; font: inherit; font-size: 14px; color: #1f2937; cursor: pointer; }

/* Members table */
.ms-tr { grid-template-columns: 36px minmax(150px, 1.3fr) minmax(130px, 1.1fr) minmax(120px, 1fr) minmax(110px, .9fr) 92px 28px; padding: 9px 14px; }
.ms-stack, .ms-lines { display: grid; gap: 5px; justify-items: start; min-width: 0; }
.ms-lines span { color: #374151; font-size: 13px; line-height: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ms-tag { display: inline-block; max-width: 100%; padding: 2px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-tag.t-blue { background: #eff6ff; color: #1d4ed8; }
.ms-tag.t-pink { background: #fdf2f8; color: #be185d; }
.ms-tag.t-green { background: #ecfdf5; color: #15803d; }
.ms-tag.t-violet { background: #f5f3ff; color: #6d28d9; }
.ms-st { display: inline-flex; padding: 4px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.ms-st.active { background: #ecfdf5; color: #15803d; }
.ms-st.past_due { background: #fef2f2; color: #dc2626; }
.ms-st.paused { background: #fef9c3; color: #a16207; }
.ms-st.expired { background: #f3f4f6; color: #6b7280; }
.cp-p-head .ms-st { font-size: 12px; padding: 3px 10px; }
.ms-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid #eef0f3; color: #6b7280; font-size: 13px; }
.ms-pg { display: flex; align-items: center; gap: 6px; }
.ms-pg .cp-sq { width: 32px; height: 32px; font: inherit; font-size: 13px; }
.ms-pg .cp-sq.on { border-color: #2563eb; background: #eff6ff; color: #2563eb; font-weight: 600; }
.ms-pg .cp-sq:disabled { opacity: .4; cursor: default; }
.ms-gap { color: #9ca3af; padding: 0 2px; }

/* Plans & Packages */
.ms-plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; overflow-y: auto; min-height: 0; align-content: start; }
.ms-plan { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 14px; background: #fff; border: 1px solid #e8eaee; border-radius: 12px; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.ms-plan:hover { border-color: #bfdbfe; }
.ms-plan-b { display: grid; gap: 2px; min-width: 0; }
.ms-plan-b b { font-size: 14px; }
.ms-plan-b small { color: #374151; font-size: 13px; }
.ms-plan-b em { font-style: normal; color: #6b7280; font-size: 12.5px; }
.ms-plan-n { display: grid; justify-items: end; }
.ms-plan-n b { font-size: 18px; }
.ms-plan-n small { color: #6b7280; font-size: 12px; }
.ms-plan-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; }
.ms-plan-ic .ic { width: 22px; height: 22px; }
.ms-plan-ic.t-blue { background: #eff6ff; color: #2563eb; }
.ms-plan-ic.t-pink { background: #fdf2f8; color: #db2777; }
.ms-plan-ic.t-green { background: #ecfdf5; color: #16a34a; }
.ms-plan-ic.t-violet { background: #f5f3ff; color: #7c3aed; }

/* Renewals */
.ms-rn { grid-template-columns: minmax(150px, 1.3fr) minmax(130px, 1fr) minmax(150px, 1.2fr) 110px 92px; }

/* Member panel */
.ms-info { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.ms-info .cp-contact { font-size: 13px; gap: 9px; }
.ms-info .cp-contact li { gap: 9px; min-width: 0; }
.ms-info .cp-contact a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.ms-info .cp-contact .ic { width: 16px; height: 16px; flex-shrink: 0; }
.ms-info .ms-top { align-items: flex-start; }
.ms-bill { display: grid; gap: 7px; padding: 12px; border: 1px solid #e8eaee; border-radius: 10px; font-size: 13px; min-width: 0; }
.ms-bill > b { font-size: 13.5px; }
.ms-bl { display: flex; align-items: center; gap: 8px; min-width: 0; color: #374151; }
.ms-bl a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.ms-bl .ic { width: 15px; height: 15px; flex-shrink: 0; }
.ms-bill .cp-link { font-size: 13px; justify-self: start; }
.ms-cards { display: grid; gap: 10px; }
.ms-card { display: grid; grid-template-columns: 44px minmax(0, 1fr) 16px; gap: 12px; align-items: center; padding: 12px; background: #fff; border: 1px solid #e8eaee; border-radius: 12px; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.ms-card:hover { border-color: #bfdbfe; }
.ms-card-b { display: grid; gap: 3px; min-width: 0; }
.ms-card-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ms-card-h b { font-size: 14px; }
.ms-card-h .ms-st { font-size: 11.5px; padding: 2px 8px; }
.ms-card-b small { color: #6b7280; font-size: 12.5px; }
.ms-card-b em { font-style: normal; color: #6b7280; font-size: 12px; }
.ms-prog { display: flex; align-items: center; gap: 10px; }
.ms-bar { flex: 1; height: 6px; border-radius: 6px; background: #e5e7eb; overflow: hidden; }
.ms-bar i { display: block; height: 100%; border-radius: 6px; background: #2563eb; }
.ms-prog small { white-space: nowrap; color: #374151; }
.ms-act { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.ms-act li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: start; font-size: 13px; }
.ms-act-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #f3f4f6; color: #374151; }
.ms-act-ic .ic { width: 17px; height: 17px; }
.ms-act li > span:nth-child(2), .ms-act-r { display: grid; gap: 1px; min-width: 0; }
.ms-act small { color: #6b7280; font-size: 12px; }
.ms-act-r { justify-items: end; text-align: right; }
.ms-act-r small.ok { color: #16a34a; }
.ms-act-r small.bad { color: #dc2626; }
.ms-qh { font-family: var(--body); font-size: 14px; font-weight: 700; text-transform: none; letter-spacing: 0; margin: 0 0 10px; color: #0b0f17; }
.ms-qa { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ms-qa .cp-btn { font-size: 13px; padding: 0 10px; }
.ms-qa .ms-danger { color: #dc2626; border-color: #fecaca; }
.ms-qa .ms-danger:hover { background: #fef2f2; }
.ms-pad { padding: 14px 0; }

/* Dialogs */
.ms-form { display: grid; gap: 12px; }
.ms-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: #374151; }
.ms-form input, .ms-form select { min-height: 40px; padding: 0 12px; border: 1px solid #d9dde3; border-radius: 10px; font: inherit; font-size: 14px; font-weight: 400; color: #0b0f17; background: #fff; }
.ms-r2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Desktop: one screen. The member rows, plan grid and panel scroll inside their own boxes. */
@media (min-width: 1201px) and (min-height: 640px) {
  .msp .cp-body { flex: 1 1 0; }
  .msp .cp-table { flex: 1 1 auto; }
}
@media (max-width: 1400px) { .msp.open { grid-template-columns: minmax(0, 1fr) 380px; } }
@media (max-width: 1200px) { .msp.open { grid-template-columns: minmax(0, 1fr); } .ms-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .ms-kpis { grid-template-columns: minmax(0, 1fr); }
  .ms-tabrow { flex-direction: column; align-items: stretch; }
  .ms-seg { overflow-x: auto; }
  .ms-tr { grid-template-columns: 40px minmax(0, 1fr) auto 32px; }
  .ms-tr > .ms-stack, .ms-tr > .ms-lines { display: none; }
  .ms-rn { grid-template-columns: minmax(0, 1fr) auto; }
  .ms-rn > span:nth-child(2), .ms-rn > span:nth-child(3), .ms-rn > span:nth-child(4) { display: none; }
  .ms-info { grid-template-columns: minmax(0, 1fr); }
}
/* The left column fills the row (KPIs, tabs, then the table takes the rest). */
.msp > .cp-left { align-self: stretch; }
@media (min-width: 1201px) and (min-height: 640px) {
  .msp > .cp-left { height: 100%; }
  .msp .cp-table { flex: 1 1 0; min-height: 0; }
  .msp .cp-rows { flex: 1 1 0; }
}
/* Four KPIs next to the panel: labels may wrap rather than cut off. */
.msp .cp-kpi { padding: 12px 14px; gap: 10px; }
.msp .cp-kpi-ic { width: 40px; height: 40px; }
.msp .cp-kpi-b span, .msp .cp-kpi-b small { white-space: normal; }
.msp .cp-ptabs button { font-size: 13px; padding: 10px 4px; white-space: nowrap; }
/* Tighter fit next to the panel: filters on one row, tags readable. */
.msp.open { grid-template-columns: minmax(0, 1fr) 390px; }
.ms-tools { flex-wrap: nowrap; }
.ms-tools .cp-search { flex: 1 1 180px; min-width: 140px; }
.ms-sel select { max-width: 132px; padding-right: 24px; }
.ms-tr { grid-template-columns: 34px minmax(130px, 1.2fr) minmax(128px, 1.15fr) minmax(110px, 1fr) minmax(96px, .85fr) 84px 26px; gap: 8px; }
@media (max-width: 1200px) { .ms-tools { flex-wrap: wrap; } }

/* Counts live on the tabs and status chips (2026-10-21: the KPI boxes repeated the Status filter). */
.ms-seg button em { margin-left: 8px; padding: 1px 7px; border-radius: 999px; background: #f3f4f6; color: #4b5563; font-style: normal; font-size: 12px; font-weight: 600; }
.ms-seg button.on em { background: rgba(255,255,255,.18); color: #fff; }
.ms-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.ms-chips button { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 12px; border: 1px solid #e8eaee; border-radius: 999px; background: #fff; font: inherit; font-size: 13px; font-weight: 600; color: #374151; cursor: pointer; }
.ms-chips button em { font-style: normal; font-weight: 600; color: #6b7280; }
.ms-chips button:hover { border-color: #bfdbfe; }
.ms-chips button.on { background: #0b0f17; border-color: #0b0f17; color: #fff; }
.ms-chips button.on em { color: #d1d5db; }
.ms-chips button.past_due:not(.on) em { color: #dc2626; }
.msp .ms-tabrow { margin-top: 0; }

/* Member panel > Results tab (memberships.js; ms-res = results) */
.ms-res-h { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 10px; font-size: 13px; color: #6b7280; }
.ms-res-l { list-style: none; margin: 0; padding: 0; display: grid; border: 1px solid #e8eaee; border-radius: 12px; overflow: hidden; }
.ms-res-l li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 11px 14px; border-top: 1px solid #eef0f3; }
.ms-res-l li:first-child { border-top: 0; }
.ms-res-l small { display: block; color: #6b7280; font-size: 12px; }
.ms-res-v { font-weight: 700; white-space: nowrap; }
.ms-res-b { padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; background: #eef2ff; color: #3b4fb8; }
.ms-res-b.c { background: #e6f7ec; color: #1f7a3f; }
.ms-res-b.g { background: #fff4d6; color: #8a6200; }

/* Edit a member, and the family view (memberships.js) */
.ms-managed { font-size: 12px; color: #6b7280; }
.ms-prof { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.ms-prof small { display: block; font-size: 12px; color: #6b7280; }
.ms-prof b { display: block; font-size: 14px; overflow-wrap: anywhere; }
.ms-prof b .cp-muted { font-weight: 400; }
@media (max-width: 760px) { .ms-prof { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ms-sec { margin: 14px 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6b7280; }
.ms-fam { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ms-fam-b { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 1px solid #e8eaee; border-radius: 12px; background: #fff; font: inherit; text-align: left; cursor: pointer; }
.ms-fam-b:hover { border-color: #2563eb; }
.ms-fam-b b { display: block; font-size: 14px; }
.ms-fam-b small { display: block; color: #6b7280; font-size: 12px; }
.ms-fam-b em { font-style: normal; color: #6b7280; font-size: 12px; text-align: right; }
/* Phones: restate the one-line member row after the desktop column rule above, and hide the column header like Coaches. */
@media (max-width: 760px) {
  .ms-tr { grid-template-columns: 40px minmax(0, 1fr) auto 32px; }
  .cw-main .msp .cp-th { display: none; }
  .ms-tools .cp-search { flex-basis: 100%; }
  .ms-sel { flex: 1 1 0; min-width: 0; }
  .ms-sel select { max-width: none; width: 100%; }
}
