/* Phone and small-tablet layout, shared by admin, client and gym/partner portals. Loaded after each portal's CSS. */
.mtop, .mshade { display: none }
@media (max-width: 860px) {
  html { background: var(--bg) }
  body { display: block !important; grid-template-columns: none !important }
  .mtop:not([hidden]) { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 40; min-height: 64px; padding: 8px 12px calc(8px); padding-top: max(8px, env(safe-area-inset-top)); background: var(--dark); color: var(--side-ink, #fff); box-shadow: inset 0 -3px 0 var(--acc), 0 6px 18px rgba(0,0,0,.12) }
  .mtop-menu { flex: none; width: 44px; height: 44px; border: 0; border-radius: 14px; background: rgba(255,255,255,.1); color: inherit; display: grid; place-content: center; gap: 4px; cursor: pointer; padding: 0 }
  .mtop-menu span { display: block; width: 18px; height: 2px; border-radius: 2px; background: currentColor; transition: transform .2s, opacity .2s }
  .mtop-menu span:nth-child(2) { width: 12px }
  .nav-open .mtop-menu span:nth-child(1) { transform: translateY(6px) rotate(45deg) } .nav-open .mtop-menu span:nth-child(2) { opacity: 0 } .nav-open .mtop-menu span:nth-child(3) { transform: translateY(-6px) rotate(-45deg) }
  .mtop-menu:focus-visible, .mtop-me:focus-visible { outline: 3px solid #2b6cff; outline-offset: 2px }
  /* Layout D: menu left, logo centred and as large as it fits, initials right. The page heading says where you are. */
  .mtop:not([hidden]) { min-height: 70px }
  .mtop-brand { position: absolute; left: 50%; top: 50%; transform: translate(-50%, calc(-50% - 1px)); max-width: calc(100vw - 136px); display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; font-weight: 800; letter-spacing: .04em; font-size: 17px; color: inherit; line-height: 1.1; pointer-events: none }
  .mtop-brand img { max-height: 24px; width: auto; max-width: 100%; display: block }
  .mtop-brand.has-logo .chip { display: inline-flex; align-items: center; background: #fff; border-radius: 11px; padding: 7px 14px; box-shadow: 0 2px 8px rgba(0,0,0,.15); max-width: 100% }
  .mtop-brand.has-logo img { max-height: 36px; object-fit: contain }
  .mtop-brand:not(.has-logo) img.sslogo { height: 16px; max-height: none; flex: 0 1 auto; min-width: 0; object-fit: contain; object-position: center }
  .mtop-brand i { font-style: normal; background: var(--acc); color: var(--acc-ink, var(--dark)); border-radius: 5px; padding: 1px 6px; font-size: 10px; margin-left: 6px; letter-spacing: .08em; flex: none }
  .mtop-page { display: none }
  .mtop-menu + .mtop-brand + .mtop-page + .mtop-me, .mtop-me { margin-left: auto }
  .mtop-me { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); background: var(--acc); color: var(--acc-ink, var(--dark)); font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; display: grid; place-items: center; padding: 0 }
  .side { position: fixed !important; inset: 0 auto 0 0; z-index: 60; width: min(300px, 86vw); height: 100dvh !important; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0,0,0,.3); overflow-y: auto }
  .nav-open .side { transform: none }
  .side nav { flex-direction: column !important; flex-wrap: nowrap !important }
  .side .navgroup { display: block !important }
  .side nav button, .side nav a { padding: 12px 12px; min-height: 44px }
  .mshade { display: block; position: fixed; inset: 0; z-index: 50; background: rgba(13,15,16,.45); opacity: 0; pointer-events: none; transition: opacity .2s }
  .nav-open .mshade { opacity: 1; pointer-events: auto }
  .nav-open { overflow: hidden }
  main { padding: 18px 14px 72px !important; max-width: none !important }
  h1 { font-size: 22px !important; line-height: 1.2 }
  .two { grid-template-columns: 1fr !important }
  .grid, .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important }
  .bar { gap: 8px }
  .bar > input:not([type=checkbox]):not([type=radio]), .bar > label > input, .bar > label > select, .bar > select { flex: 1 1 100%; min-width: 0; width: 100% }
  .bar > label { flex: 1 1 100% }
  .btn { min-height: 44px } .btn.sm { min-height: 36px }
  input, select, textarea { font-size: 16px !important }   /* stops iPhone zooming in on focus */
  .toast { left: 12px !important; right: 12px !important; bottom: 12px !important; max-width: none !important }
  .form, .eform, #cps .two { grid-template-columns: 1fr !important }
  .form > *, .two > *, .eform > *, .grid > * { min-width: 0 }
  input, select, textarea { max-width: 100%; min-width: 0 }
  label > input:not([type=checkbox]):not([type=radio]), label > select, label > textarea { width: 100% }
  /* Pop-ups slide up from the bottom and use the full width */
  dialog#editor, dialog.modal { width: 100% !important; max-width: 100% !important; margin: auto 0 0 !important; border-radius: 18px 18px 0 0 !important; max-height: 92dvh !important; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)) !important }
  .acct-menu { bottom: calc(100% + 6px) !important; top: auto !important }
  /* Things that were sized for desktop and would push the page sideways */
  .bar > .pills { flex: 1 1 100%; max-width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; -webkit-overflow-scrolling: touch } .bar > .pills::-webkit-scrollbar { display: none }
  .pills button { flex: none }
  .keybox input, .decide, .rtable select[data-r], th.wide, td.wide { min-width: 0 !important }
  .rtable select { width: 100% !important }
  pre, pre.code, .code { white-space: pre-wrap; word-break: break-all; max-width: 100% }
  .toast { white-space: normal }
  main p, main li, main dd, main code { overflow-wrap: anywhere }
  main img, main svg, main video { max-width: 100% }
  .kpi b { font-size: 20px !important; line-height: 1.2 }
  .bars { grid-template-columns: repeat(12, minmax(0, 1fr)) !important; gap: 3px !important }
  .bars .wk { font-size: 10px !important; overflow: hidden }
}
@media (max-width: 860px) {
  /* Intros: two lines, tap for the rest */
  p.m-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer }
  p.m-clamp.m-open { display: block; -webkit-line-clamp: unset }
  /* Filters fold behind one button */
  .bar[data-mf] .mf-item { display: none !important }
  .bar[data-mf].mf-open .mf-item { display: flex !important }
  .bar[data-mf] .mf-toggle { flex: 0 0 auto }
}
.mf-toggle { display: none }
@media (max-width: 860px) { .mf-toggle { display: inline-flex; align-items: center } }

@media (max-width: 860px) {
  .card { overflow-x: visible !important }
  .tw { overflow: visible !important }
  .card:has(> .tw > table.stackable), .card:has(> table.stackable) { padding-left: 0; padding-right: 0; padding-bottom: 4px }
  .card:has(> .tw > table.stackable) > :not(.tw), .card:has(> table.stackable) > :not(table) { margin-left: 16px; margin-right: 16px }
  table.stackable { min-width: 0 !important; table-layout: auto !important; font-size: 14px; border-collapse: separate }
  table.stackable col { width: auto !important }
  table.stackable thead { display: none }
  table.stackable, table.stackable > tbody { display: block; width: 100% }
  table.stackable tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 6px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line) }
  table.stackable tr:first-child { border-top: 0 }
  table.stackable tr.has-more { cursor: pointer }
  table.stackable tr.open { background: #fafbf8 }
  table.stackable td { display: block; border: 0 !important; padding: 0 !important; text-align: left !important; white-space: normal !important; min-width: 0; grid-column: 1 / -1; order: 4 }
  table.stackable td[data-m="empty"] { display: none }
  /* Title: left, with a chevron when there's more to see */
  table.stackable td[data-m="title"] { grid-column: 1; order: 1; font-weight: 600; font-size: 15px; line-height: 1.3; outline: none }
  table.stackable td[data-m="title"] .muted, table.stackable td[data-m="title"] .sub { font-weight: 400 }
  table.stackable tr.has-more { position: relative; padding-right: 38px }
  table.stackable tr.has-more::after { content: ""; position: absolute; right: 16px; top: 19px; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s }
  table.stackable tr.open::after { transform: rotate(-135deg); top: 23px }
  table.stackable td[data-m="title"]:focus-visible { outline: 3px solid #2b6cff; outline-offset: 2px; border-radius: 6px }
  /* Second line: muted, two lines at most */
  table.stackable td[data-m="sub"] { grid-column: 1 / -1; order: 3; font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: -2px }
  table.stackable td[data-m="sub"] * { color: inherit; font-size: inherit }
  table.stackable td[data-m="sub"] ul { display: inline; } table.stackable td[data-m="sub"] li { display: inline } table.stackable td[data-m="sub"] li + li::before { content: " · " }
  table.stackable tr.open td[data-m="sub"] { -webkit-line-clamp: unset; display: block }
  table.stackable tr.nav-row { cursor: pointer; padding-right: 32px; position: relative }
  table.stackable tr.nav-row::after { content: ""; position: absolute; right: 16px; top: 50%; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-top: 2px solid var(--muted); transform: translateY(-50%) rotate(45deg) }
  /* Aside: status or key number, right */
  table.stackable td[data-m="aside"] { grid-column: 2; order: 2; text-align: right !important; white-space: nowrap !important; font-weight: 600; align-self: start }
  table.stackable td[data-m="aside"]:not(:has(.st, .tag)):not([data-label=""])::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600; color: var(--muted); font-family: "Neue Haas Grotesk", Inter, system-ui, sans-serif }
  /* Details: hidden until the row is opened, as label and value */
  table.stackable td[data-m="more"] { display: none; order: 4 }
  table.stackable tr.open td[data-m="more"] { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; text-align: right !important; font-size: 14px }
  table.stackable tr.open td[data-m="more"]::before { content: attr(data-label); flex: none; max-width: 45%; text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; font-family: "Neue Haas Grotesk", Inter, system-ui, sans-serif; letter-spacing: 0 }
  table.stackable tr.open td[data-m="more"][data-label=""] { display: block; text-align: left !important }
  table.stackable tr.open td[data-m="more"][data-label=""]::before { display: none }
  table.stackable tr.open td[data-m="more"]:empty { display: none }
  /* Buttons: one row under the title */
  table.stackable td[data-m="act"] { order: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center }
  table.stackable td[data-m="act"]:empty { display: none }
  table.stackable td[data-m="act"]:not([data-label=""]):has(select, input:not([type=checkbox]):not([type=radio]))::before { content: attr(data-label); flex: 1 1 100%; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: -4px }
  table.stackable td[data-m="act"] select { flex: 1 1 100% }
  table.stackable td[data-m="act"] .btn { margin: 0 !important }
  table.stackable td[data-m="act"] .btn + .btn { margin-left: 0 !important }
  /* Product tables: the link icon sits beside the title; Add or Added is a full-width button */
  table.ptable td[data-m="act"]:not(.lk) { grid-column: 1; order: 5 }
  table.ptable td.lk { grid-column: 2; order: 5; display: flex !important; justify-content: center; align-items: center; width: 44px; height: 40px; border: 1px solid var(--line) !important; border-radius: 999px; background: #fff }
  table.ptable td[data-m="act"] .btn { flex: 1 1 100%; min-height: 40px }
  table.ptable .pcell .ids { display: none }
  table.ptable tr.open .pcell .ids { display: block; white-space: normal; word-break: break-all; margin-top: 6px }
  table.ptable tr:not(.open) .pcell b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden }
}
