/* Performance touch layout (cm-): the phone layout of every Performance page (performance.js shell, .cm-phone) and the recording screens on any
   width (perf-record.js; on a desktop they sit in the workspace as .cm-embed). Big touch targets, one column, bottom tab bar on phones. */
.cm { --cm-ink: #0b0f17; --cm-blue: #2563eb; --cm-bg: #f3f4f6; --cm-line: #e5e7eb; --cm-mut: #6b7280; --cm-good: #059669; --cm-bad: #dc2626;
  color: var(--cm-ink); font-family: var(--body); }
.cm-phone { min-height: 100dvh; background: var(--cm-bg); display: flex; flex-direction: column; }
.cm-embed { max-width: 560px; padding: 4px 0 24px; }
body.cm-open { background: #e5e7eb; }
body.cm-open #feedback-btn, body.cm-open .fb-btn { display: none; }
.cm .ic { width: 20px; height: 20px; flex: none; }
.cm :where(button) { font: inherit; color: inherit; cursor: pointer; }
.cm :where(a) { color: inherit; text-decoration: none; }

/* header + tab bar */
.cm-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top) + 12px) 16px 12px; background: var(--cm-ink); color: #fff; }
.cm-top b { display: block; font-size: 16px; }
.cm-top small { color: #9ca3af; font-size: 12px; }
.cm-top .cm-ib { color: #fff; margin: -8px 0 -8px -10px; }
.cm-top > div { min-width: 0; }
.cm-top b, .cm-top small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm .cm-body { flex: 1; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); min-width: 0; }
.cm-tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; display: flex; background: #fff; border-top: 1px solid var(--cm-line); padding-bottom: env(safe-area-inset-bottom); }
.cm-tab { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 0 8px; font-size: 12px; color: var(--cm-mut); min-height: 56px; }
.cm-tab.on { color: var(--cm-blue); font-weight: 600; }
.cm-tab .ic { width: 22px; height: 22px; }
.cm-tab i { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--cm-bad); color: #fff; font: 600 11px/18px var(--body); font-style: normal; }

/* type */
.cm-h1 { font: 700 24px/1.2 var(--body); text-transform: none; letter-spacing: 0; margin: 4px 0 16px; }
.cm-h1 em, .cm-h2 em { font-style: normal; color: var(--cm-mut); font-weight: 500; font-size: 0.7em; margin-left: 6px; }
.cm-h2 { font: 600 15px/1.3 var(--body); text-transform: none; letter-spacing: 0; margin: 22px 0 10px; }
.cm-muted { color: var(--cm-mut); font-size: 14px; }
.cm-empty { color: var(--cm-mut); font-size: 14px; padding: 18px; text-align: center; background: #fff; border: 1px dashed var(--cm-line); border-radius: 12px; list-style: none; }

/* bars */
.cm-bar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; margin: -4px -6px 12px; }
.cm-bar h1 { margin: 0; text-align: center; font: 700 18px/1.2 var(--body); text-transform: none; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-ib { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; border-radius: 10px; }
.cm-ib:disabled { opacity: 0.3; }
.cm-ib .ic { width: 22px; height: 22px; }

/* big actions */
.cm-big, .cm-resume { display: flex; align-items: center; gap: 14px; padding: 18px; margin-bottom: 12px; background: #fff; border: 1px solid var(--cm-line); border-radius: 14px; min-height: 76px; }
.cm-big > span:first-child, .cm-resume > span:first-child { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: #eff6ff; color: var(--cm-blue); }
.cm-big b, .cm-resume b { display: block; font-size: 17px; }
.cm-big small, .cm-resume small { color: var(--cm-mut); font-size: 13px; }
.cm-big.primary { background: var(--cm-blue); border-color: var(--cm-blue); color: #fff; }
.cm-big.primary > span:first-child { background: rgba(255, 255, 255, 0.18); color: #fff; }
.cm-big.primary small { color: #dbeafe; }
.cm-big.slim { min-height: 56px; padding: 10px 14px; }
.cm-big.slim > span:first-child { width: 36px; height: 36px; }
.cm-resume { border-color: #bfdbfe; background: #eff6ff; }
.cm-resume > span:nth-child(2) { flex: 1; min-width: 0; }
.cm-warn { display: flex; align-items: center; gap: 8px; padding: 12px 14px; margin: 0 0 12px; border-radius: 12px; background: #fffbeb; color: #92400e; font-size: 14px; border: 1px solid #fde68a; }
.cm-ok { display: flex; align-items: center; gap: 8px; padding: 12px 14px; margin: 0 0 12px; border-radius: 12px; background: #ecfdf5; color: #065f46; font-size: 14px; }
.cm-ok b { color: var(--cm-good); margin-left: 4px; }

/* lists */
.cm-list { list-style: none; margin: 0; padding: 0; background: #fff; border: 1px solid var(--cm-line); border-radius: 14px; overflow: hidden; }
.cm-list > li { border-bottom: 1px solid var(--cm-line); }
.cm-list > li:last-child { border-bottom: 0; }
.cm-list > li > a, .cm-list > li > button, .cm-list > li > label, .cm-list:not(.pick):not(.cm-checks) > li:not(.cm-empty) { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; min-height: 56px; background: none; border: 0; text-align: left; }
.cm-list > li > a > span:nth-child(2), .cm-list > li > button > span:nth-child(2), .cm-list > li > span:nth-child(2) { flex: 1; min-width: 0; }
.cm-list b { display: block; font-weight: 600; font-size: 15px; }
.cm-list small { display: block; color: var(--cm-mut); font-size: 13px; }
.cm-list em { font-style: normal; font-weight: 700; }
.cm-list.cm-checks label b { flex: 1; }
.cm-list.cm-checks input { width: 22px; height: 22px; accent-color: var(--cm-blue); flex: none; }
.cm-list.cm-checks { max-height: 320px; overflow-y: auto; }
.cm-list.cm-checks.short { max-height: 260px; }
.cm-list .cm-empty { border: 0; border-radius: 0; }
.cm-list .ic.is-ok { color: var(--cm-good); }
.cm-av { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; background: #e0e7ff; color: #3730a3; font-weight: 700; font-size: 13px; }
.cm-av.lg { width: 52px; height: 52px; font-size: 17px; }
.cm-mi { width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center; background: #f1f5f9; color: var(--cm-ink); }

/* search, fields, chips */
.cm-search { display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 48px; margin: 0 0 10px; background: #fff; border: 1px solid var(--cm-line); border-radius: 12px; color: var(--cm-mut); }
.cm-search input { flex: 1; border: 0; outline: 0; font: 16px var(--body); background: none; color: var(--cm-ink); min-width: 0; }
.cm-lbl { display: block; font-size: 13px; color: var(--cm-mut); margin: 0 0 6px; }
.cm-lbl input { display: block; width: 100%; margin-top: 6px; height: 48px; padding: 0 12px; border: 1px solid var(--cm-line); border-radius: 12px; font: 16px var(--body); color: var(--cm-ink); background: #fff; box-sizing: border-box; }
.cm-field { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 10px 14px; margin-bottom: 10px; background: #fff; border: 1px solid var(--cm-line); border-radius: 14px; text-align: left; position: relative; }
.cm-field small { position: absolute; top: 6px; left: 14px; font-size: 11px; color: var(--cm-mut); text-transform: uppercase; letter-spacing: 0.04em; }
.cm-field b { flex: 1; font-size: 17px; padding-top: 12px; }
.cm-field .cm-av, .cm-field .cm-mi { margin-top: 12px; width: 30px; height: 30px; font-size: 12px; }
.cm-field b.cm-ph { color: var(--cm-blue); }
.cm-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.cm-chips.cm-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.cm-chips button { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; min-height: 40px; padding: 0 14px; border-radius: 999px; background: #fff; border: 1px solid var(--cm-line); font-size: 14px; }
.cm-chips button.on { background: var(--cm-ink); border-color: var(--cm-ink); color: #fff; }
.cm-chips button.is-done:not(.on) { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }
.cm-chips button small { opacity: 0.7; }
.cm-chips .ic { width: 16px; height: 16px; }
.cm-chips .ic.cm-x { transform: rotate(45deg); }
.cm-chips.sel button { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }

/* segmented */
.cm-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 12px; }
.cm-seg button { padding: 12px; text-align: left; background: #fff; border: 1px solid var(--cm-line); border-radius: 12px; }
.cm-seg button b { display: block; font-size: 15px; }
.cm-seg button small { color: var(--cm-mut); font-size: 12px; }
.cm-seg button.on { border-color: var(--cm-blue); box-shadow: inset 0 0 0 1px var(--cm-blue); background: #eff6ff; }

/* number entry */
.cm-entry { margin-top: 4px; }
.cm-val { display: flex; align-items: baseline; justify-content: center; gap: 8px; padding: 14px; background: #fff; border: 2px solid var(--cm-blue); border-radius: 14px; }
.cm-val span { font: 700 44px/1.1 var(--body); font-variant-numeric: tabular-nums; min-height: 48px; }
.cm-val span i { color: #d1d5db; font-style: normal; }
.cm-val em { font-style: normal; color: var(--cm-mut); font-size: 16px; }
.cm-ctx { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--cm-mut); margin: 8px 2px 10px; }
.cm-ctx b { color: var(--cm-ink); }
.cm-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 12px; }
.cm-pad button { height: 56px; border-radius: 12px; border: 1px solid var(--cm-line); background: #fff; font-size: 24px; font-weight: 600; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.cm-pad button:active { background: #e5e7eb; }
.cm-pad .ic { width: 24px; height: 24px; margin: auto; }
.cm .cm-save { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 56px; border: 0; border-radius: 14px; background: var(--cm-blue); color: #fff !important; font-size: 17px; font-weight: 700; }
.cm-save:disabled { background: #93c5fd; cursor: default; }
.cm-sticky { position: sticky; bottom: calc(66px + env(safe-area-inset-bottom)); padding: 12px 0 0; background: linear-gradient(transparent, var(--cm-bg) 30%); }
.cm .cm-link { display: block; width: 100%; margin-top: 10px; padding: 12px; border: 0; background: none; color: var(--cm-blue) !important; font-weight: 600; }

/* session recording */
.cm-bar.dark h1 { font-size: 16px; }
.cm-prog { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 13px; color: var(--cm-mut); }
.cm-prog .cm-pbar { flex: 1; height: 8px; border-radius: 4px; background: #e5e7eb; overflow: hidden; }
.cm-prog .cm-pbar i { display: block; height: 100%; background: var(--cm-blue); border-radius: 4px; transition: width 0.2s; }
.cm-card { background: #fff; border: 1px solid var(--cm-line); border-radius: 14px; padding: 12px; }
.cm-who { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; text-align: center; }
.cm-who > div { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.cm-who b { font-size: 18px; }
.cm-who small { color: var(--cm-mut); font-size: 13px; }
.cm-row { display: flex; justify-content: space-between; align-items: center; margin: 12px 2px 8px; font-size: 14px; font-weight: 600; }
.cm-st { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.cm-st.is-ok { background: #ecfdf5; color: #047857; }
.cm-st.is-unsaved { background: #fffbeb; color: #b45309; }
.cm-st.is-off { background: #eff6ff; color: #1d4ed8; }
.cm-st.is-none { background: #f3f4f6; color: var(--cm-mut); }
.cm-atts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cm-atts button { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 12px; border: 1px solid var(--cm-line); background: #f9fafb; }
.cm-atts button small { font-size: 11px; color: var(--cm-mut); }
.cm-atts button b { font: 700 24px/1.2 var(--body); font-variant-numeric: tabular-nums; }
.cm-atts button.on { border: 2px solid var(--cm-blue); background: #fff; padding: 7px 3px; }
.cm-best { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: #f9fafb; font-size: 13px; color: var(--cm-mut); }
.cm-best b { color: var(--cm-ink); }
.cm-best em { font-style: normal; font-weight: 700; color: #fff; background: var(--cm-good); padding: 1px 8px; border-radius: 999px; font-size: 11px; }
.cm-best.pb { background: #ecfdf5; }
.cm-modes { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; }
.cm-modes .ui-seg { flex: 1; margin: 0; }
.cm-modes-l { font-size: 12px; color: var(--cm-mut); white-space: nowrap; }
.cm-actions { position: sticky; bottom: 0; padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); background: var(--cm-bg); }
.cm-notabs .cm-body { padding-bottom: 0; }
@media (max-height: 760px) { .cm-who .cm-av { display: none; } .cm-card { padding: 10px; } .cm-row { margin: 8px 2px 6px; } .cm-pad button { height: 48px; } .cm-pad { gap: 6px; margin: 8px 0; } .cm-val { padding: 8px; } .cm-field { min-height: 56px; margin-bottom: 8px; } .cm-who .cm-av.lg { width: 40px; height: 40px; } }

/* finished */
.cm-done { text-align: center; padding: 40px 8px; }
.cm-done-ic { width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; background: #ecfdf5; color: var(--cm-good); }
.cm-done-ic .ic { width: 36px; height: 36px; }
.cm-done h1 { font: 700 24px var(--body); text-transform: none; letter-spacing: 0; margin: 0 0 10px; }
.cm-done p { margin: 0 0 8px; }
.cm-done .cm .cm-save { margin-top: 24px; }

/* athlete */
.cm-hero { display: flex; align-items: center; gap: 14px; margin: 0 0 14px; }
.cm-hero b { display: block; font-size: 20px; }
.cm-hero small { color: var(--cm-mut); font-size: 14px; }
.cm-mc { background: #fff; border: 1px solid var(--cm-line); border-radius: 14px; margin-bottom: 10px; }
.cm-mc summary { list-style: none; padding: 14px; cursor: pointer; }
.cm-mc summary::-webkit-details-marker { display: none; }
.cm-mc-h { display: flex; align-items: center; gap: 10px; }
.cm-mc-h b { flex: 1; font-size: 16px; }
.cm-spark { width: 90px; height: 32px; }
.cm-spark svg { width: 100%; height: 100%; }
.cm-spark polyline { stroke: var(--cm-blue); }
.cm-spark circle { fill: var(--cm-blue); }
.cm-mc-g { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.cm-mc-g small { display: block; color: var(--cm-mut); font-size: 11px; }
.cm-mc-g b { font-size: 15px; }
.cm .up { color: var(--cm-good); }
.cm .down { color: var(--cm-bad); }
.cm-hist { list-style: none; margin: 0; padding: 0 14px 10px; border-top: 1px solid var(--cm-line); }
.cm-hist li { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid #f3f4f6; font-size: 14px; }
.cm-hist li:last-child { border-bottom: 0; }
.cm-hist li span { flex: 1; color: var(--cm-mut); }
.cm-hist em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--cm-good); }

/* review */
.cm-rv { background: #fff; border: 1px solid var(--cm-line); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.cm-rv-h { display: flex; align-items: center; gap: 12px; }
.cm-rv-h > span:nth-child(2) { flex: 1; min-width: 0; }
.cm-rv-h b { display: block; }
.cm-rv-h small { color: var(--cm-mut); font-size: 13px; }
.cm-rv-h em { font-style: normal; font: 700 20px var(--body); }
.cm-rv-m { font-size: 13px; color: var(--cm-mut); margin: 10px 0; }
.cm-rv-m a { color: var(--cm-blue); text-decoration: underline; }
.cm-rv-a { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cm-rv-why { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--cm-line); }
.cm-btn { height: 48px; border-radius: 12px; border: 1px solid var(--cm-line); background: #fff; font-weight: 600; }
.cm-btn.is-good { background: var(--cm-good); border-color: var(--cm-good); color: #fff !important; }
.cm-btn.is-bad { color: var(--cm-bad) !important; border-color: #fecaca; }
.cm-btn:disabled { opacity: 0.5; }

/* searchable picker (perf-record.js openPicker): full screen on a phone, a centered dialog on a desktop */
.cm-sheet { position: fixed; inset: 0; z-index: 50; background: rgba(11, 15, 23, 0.4); display: flex; justify-content: center; align-items: flex-start; }
.cm-sheet-in { width: 100%; max-width: 520px; height: 100%; background: var(--cm-bg); display: flex; flex-direction: column; padding: calc(env(safe-area-inset-top) + 8px) 16px 16px; box-sizing: border-box; }
@media (min-width: 701px) { .cm-sheet { padding-top: 8vh; } .cm-sheet-in { height: 80vh; border-radius: 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25); } }
.cm-sheet header { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; text-align: center; margin-bottom: 8px; }
.cm-sheet header b { font-size: 17px; }
.cm-sheet .cm-list { overflow-y: auto; flex: 1; }


/* recording screens inside the desktop workspace: no bottom tab bar to clear */
.cm-embed .cm-sticky { bottom: 0; }
.cm-embed .cm-actions { background: #f3f4f6; }

/* ---- App frame (phone): the page itself never scrolls -------------------------------------------------------------------------
   The screen is exactly the viewport: top bar, content, bottom tabs. Lists scroll inside the content area like a native app.
   Recording screens (.cm-notabs: Quick entry, a running session) never scroll at all: the keypad stretches or shrinks to fill what's left. */
html:has(.cm-phone), body.cm-open { height: 100%; overflow: hidden; overscroll-behavior: none; }
/* Pinned to the screen's real edges, not 100dvh: some iPhones (home screen app, after the camera) measure 100dvh short, which left a grey band under the tab bar. */
.cm-phone { position: fixed; inset: 0; height: auto; min-height: 0; overflow: hidden; }
.cm-phone .cm-top { position: static; flex: none; }
.cm-phone .cm-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding-bottom: 16px; }
.cm-phone .cm-tabs { position: static; flex: none; }
.cm-phone.cm-notabs .cm-body { overflow: hidden; display: flex; flex-direction: column; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
.cm-notabs .cm-body > *, .cm-notabs .cm-entry > * { flex: none; }
.cm-notabs .cm-entry { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: 0; }
.cm-notabs .cm-pad { flex: 1 1 auto; min-height: 0; grid-auto-rows: minmax(36px, 1fr); margin: 8px 0; gap: 6px; }
.cm-notabs .cm-pad button { height: auto; min-height: 36px; }
.cm-notabs .cm-actions { position: static; padding: 0; background: none; }
.cm-notabs .cm-field { min-height: 52px; margin-bottom: 8px; }
.cm-notabs .cm-chips { margin-bottom: 8px; }
.cm-notabs .cm-prog { margin-bottom: 8px; }
.cm-notabs .cm-modes { margin-bottom: 8px; }
.cm-notabs .cm-val span { font-size: 40px; min-height: 0; }
@media (max-height: 640px) { .cm-notabs .cm-who small { display: none; } }

/* More screen (performance.js drawMore): account line, big tappable section rows, small delete link at the very bottom */
.cm-me { display: flex; align-items: center; gap: 12px; padding: 4px 2px 6px; }
.cm-me b { display: block; font-size: 17px; }
.cm-me small { color: var(--cm-mut); font-size: 13px; }
.cm-me .cm-av { width: 48px; height: 48px; font-size: 16px; }
.cm-menu { margin-bottom: 14px; }
.cm-mrow { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px; padding: 0 14px; background: none; border: 0; text-align: left; }
.cm-mrow b { flex: 1; font-size: 16px; font-weight: 600; }
.cm-mrow .cm-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: #eff6ff; color: var(--cm-blue); }
.cm-mrow .cm-go { color: var(--cm-mut); width: 18px; height: 18px; }
.cm-more { max-width: 480px; }
.cm .ad-link { display: block; width: max-content; margin: 18px auto 8px; padding: 12px; background: none; border: 0; color: var(--cm-mut); font-size: 13px; text-decoration: underline; }
