/* physio.css — physiotherapist workspace (physio.html). Uses the app's colour tokens from styles.css. */

.physio-page { max-width: 1320px; }
.px-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 18px; align-items: start; }
.px-muted { color: var(--muted); font-size: 14px; margin: 0; }
.px-input { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; }
.px-input:focus { outline: 2px solid rgba(var(--accent-rgb), .45); outline-offset: 1px; }
.px-small { width: 84px; }
.px-date { width: auto; }

/* patients */
.px-patients { position: sticky; top: 12px; padding: 16px; }
.px-side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.px-side-head h2 { margin: 0; font-size: 18px; }
.px-patient-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; max-height: 70vh; overflow-y: auto; }
.px-pt { width: 100%; text-align: left; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; }
.px-pt:hover { border-color: var(--accent); }
.px-pt.is-on { background: rgba(var(--accent-rgb), .1); border-color: var(--accent); }
.px-pt-avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(var(--accent-rgb), .14); color: var(--accent); font-weight: 800; font-size: 15px; }
.px-pt-main { display: grid; gap: 3px; min-width: 0; }
.px-pt-name { font-weight: 700; font-size: 16px; }
.px-pt-sub { font-size: 13px; color: var(--muted); }
.px-pt-bar { display: block; height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 4px; }
.px-pt-bar i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.px-pt-bar i[data-tone="warn"] { background: #e0a020; }
.px-pt-bar i[data-tone="bad"] { background: #d64545; }
.px-pt-week { font-size: 12px; color: var(--ink-soft); }
.px-pt-status { justify-self: start; margin-top: 2px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 20px; background: var(--surface-2); color: var(--muted); }
.px-pt-status[data-tone="good"] { background: rgba(var(--accent-rgb), .14); color: var(--accent); }
.px-pt-status[data-tone="warn"] { background: rgba(245, 180, 40, .2); color: #8a5a00; }
.px-pt-status[data-tone="bad"] { background: rgba(220, 60, 60, .14); color: #b42323; }
.px-pt-pct { font-size: 18px; font-weight: 800; color: var(--accent); }
.px-pt-pct[data-tone="warn"] { color: #b7791f; }
.px-pt-pct[data-tone="bad"] { color: #d64545; }
.px-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.px-overview[hidden] { display: none; }
.px-ov { display: grid; gap: 2px; padding: 10px; border-radius: 12px; background: var(--surface-2); text-align: center; }
.px-ov b { font-size: 22px; line-height: 1.1; }
.px-ov span { font-size: 11px; color: var(--muted); font-weight: 600; }
.px-ov[data-tone="good"] b { color: var(--accent); }
.px-ov[data-tone="bad"] b { color: #d64545; }

/* patient header + tabs */
.px-main { display: grid; gap: 16px; min-width: 0; }
.px-empty { text-align: center; padding: 48px 20px; }
.px-patient { display: grid; gap: 16px; }
.px-patient-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.px-patient-head h2 { margin: 0 0 4px; font-size: 24px; }
.px-tabs { display: flex; gap: 6px; background: var(--surface-2); padding: 4px; border-radius: 12px; }
.px-tab { border: 0; background: transparent; padding: 10px 18px; border-radius: 9px; font: inherit; font-weight: 700; color: var(--ink-soft); cursor: pointer; }
.px-tab[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.px-tabpanel { display: grid; gap: 16px; }
.px-tabpanel[hidden] { display: none; }

/* summary cards */
.px-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.px-card { display: grid; gap: 4px; padding: 16px 18px; border-left: 5px solid var(--border-strong); }
.px-card[data-tone="good"] { border-left-color: var(--good); }
.px-card[data-tone="warn"] { border-left-color: #e0a020; }
.px-card[data-tone="bad"] { border-left-color: #d64545; }
.px-card-label { font-size: 13px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; }
.px-card-big { font-size: 34px; font-weight: 800; line-height: 1.1; }
.px-card-big small { font-size: 16px; color: var(--muted); font-weight: 600; }
.px-card-mid { font-size: 26px; }
.px-card-sub { font-size: 14px; color: var(--muted); }

.px-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.px-sec-head h3 { margin: 0; font-size: 18px; }

/* 14-day strip */
.px-days { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 6px; }
.px-day { display: grid; justify-items: center; gap: 2px; padding: 8px 2px; border-radius: 10px; background: var(--surface-2); font-size: 12px; color: var(--ink-soft); }
.px-day b { font-size: 16px; color: var(--ink); }
.px-day em { font-style: normal; font-size: 11px; min-height: 13px; }
.px-day[data-tone="full"] { background: rgba(var(--accent-rgb), .22); }
.px-day[data-tone="partial"] { background: rgba(245, 180, 40, .28); }
.px-day[data-tone="missed"] { background: rgba(220, 60, 60, .22); }
.px-day.is-today { outline: 2px solid var(--accent); outline-offset: -2px; }
.px-legend { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.px-legend > span { white-space: nowrap; }
.px-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-left: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.px-legend i[data-tone="full"] { background: rgba(var(--accent-rgb), .45); }
.px-legend i[data-tone="partial"] { background: rgba(245, 180, 40, .6); }
.px-legend i[data-tone="missed"] { background: rgba(220, 60, 60, .5); }

/* exercise progress: one closed row per exercise, tap to open */
.px-ex { border-top: 1px solid var(--border); }
.px-ex:first-child { border-top: 0; }
.px-ex.is-ended { opacity: .6; }
.px-ex-sum { list-style: none; display: grid; grid-template-columns: 56px minmax(0, 1fr) auto 18px; align-items: center; gap: 12px; padding: 10px 0; cursor: pointer; }
.px-ex-sum::-webkit-details-marker { display: none; }
.px-ex-pic img { width: 56px; height: 42px; object-fit: cover; border-radius: 8px; display: block; }
.px-ex-head { display: grid; gap: 2px; min-width: 0; }
.px-ex-name { font-weight: 700; font-size: 15px; line-height: 1.25; }
.px-ex-dose { font-size: 13px; color: var(--muted); }
.px-ex-badge { display: grid; justify-items: end; font-size: 17px; font-weight: 800; line-height: 1.1; }
.px-ex-badge small { font-size: 11px; font-weight: 600; color: var(--muted); }
.px-ex-badge[data-tone="good"] { color: var(--good); }
.px-ex-badge[data-tone="warn"] { color: #b7791f; }
.px-ex-badge[data-tone="bad"] { color: #d64545; }
.px-ex-caret { width: 16px; height: 16px; color: var(--muted); justify-self: center; }
.px-ex[open] .px-ex-caret, .px-assess-card[open] .px-ex-caret { transform: rotate(180deg); }
.px-ex-body { display: grid; gap: 10px; padding: 0 0 14px 68px; }
.px-ex-full { font-size: 13px; }
.px-tag { font-size: 12px; font-weight: 700; background: var(--surface-2); padding: 2px 8px; border-radius: 20px; color: var(--muted); }
.px-ex-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.px-stat { display: grid; gap: 2px; align-content: start; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.px-stat-label { font-size: 11px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; }
.px-stat-big { font-size: 20px; font-weight: 800; }
.px-stat-val { font-size: 12px; color: var(--muted); }
.px-edit-btn { justify-self: start; }
.px-chart { max-width: 340px; }
.px-spark { width: 100%; height: auto; display: block; overflow: visible; }
.px-spark-val { font-size: 12px; font-weight: 700; fill: var(--ink); }
.px-spark-empty { font-size: 13px; color: var(--muted); padding: 6px 0; }

/* assessments */
.px-assess { display: grid; gap: 8px; }
.px-assess-card { border-radius: 12px; background: var(--surface-2); border-left: 5px solid var(--border-strong); }
.px-assess-sum { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr) auto 18px; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer; }
.px-assess-sum::-webkit-details-marker { display: none; }
.px-assess-score { font-size: 20px; font-weight: 800; }
.px-assess-score small { font-size: 12px; font-weight: 600; color: var(--muted); }
.px-assess-body { display: grid; gap: 6px; padding: 0 12px 12px; max-width: 420px; }
.px-assess-card[data-tone="good"] { border-left-color: var(--good); }
.px-assess-card[data-tone="bad"] { border-left-color: var(--alert); }

/* assign */
.px-rows { display: grid; gap: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); max-width: 560px; }
.px-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--border); min-height: 44px; }
.px-rows > .px-row:first-child { border-top: 0; }
.px-row[hidden] { display: none; }
.px-row-label { font-size: 15px; font-weight: 600; color: var(--ink); }
.px-row-select { width: 168px; flex: none; padding: 9px 10px; font-size: 15px; }
.px-row .px-stepper { width: 168px; justify-content: space-between; }
.px-row .px-stepper input { flex: 1; width: auto; min-width: 0; }
.px-rows .px-weekdays { padding: 0 12px 12px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.px-rows .px-weekdays[hidden] { display: none; }
.px-rows .px-weekdays button { width: 100%; min-width: 0; padding: 8px 0; text-align: center; font-size: 13px; }
.px-summary-box .px-big { text-align: center; justify-content: center; }
.px-msg:empty { display: none; }
.px-pick-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 12px; }
.px-pick { display: grid; gap: 6px; }
.px-pick select { font-size: 16px; padding: 12px; }
.px-pick-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.px-assign { gap: 0; padding: 8px 22px 22px; }
.px-step { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--border); }
.px-step-num { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; }
.px-step-body { display: grid; gap: 10px; min-width: 0; }
.px-step-title { font-weight: 800; font-size: 16px; }
.px-ex-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.px-ex-card { display: grid; gap: 6px; padding: 8px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: var(--ink); }
.px-ex-card:hover { border-color: rgba(var(--accent-rgb), .6); }
.px-ex-card[aria-pressed="true"] { border-color: var(--accent); background: rgba(var(--accent-rgb), .1); box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .25); }
.px-ex-card-pic img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 8px; display: block; }
.px-ex-card-name { font-weight: 700; font-size: 14px; }
.px-ex-card[aria-pressed="true"] .px-ex-card-name::before { content: "✓ "; color: var(--accent); }
.px-dose { display: flex; gap: 22px; flex-wrap: wrap; }
.px-num { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.px-stepper { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; width: max-content; }
.px-stepper button { border: 0; background: var(--surface-2); width: 44px; height: 44px; font-size: 22px; font-weight: 700; color: var(--ink); cursor: pointer; }
.px-stepper input { width: 64px; height: 44px; border: 0; text-align: center; font: inherit; font-size: 20px; font-weight: 800; background: var(--surface); color: var(--ink); }
.px-seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.px-seg button, .px-weekdays button { border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); padding: 9px 14px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; }
.px-seg button[aria-pressed="true"], .px-weekdays button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.px-weekdays { display: flex; gap: 6px; flex-wrap: wrap; }
.px-weekdays[hidden], .px-inline[hidden] { display: none; }
.px-inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.px-summary-box { margin-top: 18px; padding: 16px 18px; border-radius: 12px; background: rgba(var(--accent-rgb), .08); display: grid; gap: 12px; }
.px-summary-box p { margin: 0; font-size: 16px; line-height: 1.5; }
.px-big { font-size: 17px; padding: 12px 28px; justify-self: start; }
.px-msg { font-weight: 700; min-height: 1em; }
.px-msg[data-tone="good"] { color: var(--good); }
.px-msg[data-tone="bad"] { color: var(--alert); }

/* change dialog */
.px-edit-form { display: grid; gap: 16px; min-width: min(520px, 90vw); }
.px-edit-form h2 { margin: 0; font-size: 20px; }
.px-edit-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.px-grow { flex: 1; }
.px-danger { color: var(--alert); border-color: rgba(var(--alert-rgb), .5); }

@media (max-width: 900px) {
  .px-layout { grid-template-columns: 1fr; }
  .px-patients { position: static; }
  .px-patient-list { max-height: none; overflow: visible; }
  .px-cards { grid-template-columns: 1fr; }
  .px-ex-body { padding-left: 0; }
  .px-days { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}
/* phones: compact Assign screen */
@media (max-width: 600px) {
  .px-patient-head { padding: 12px 14px; gap: 10px; }
  .px-patient-head h2 { font-size: 20px; margin: 0; }
  .px-tabs { width: 100%; }
  .px-tab { flex: 1; padding: 9px 8px; font-size: 15px; }
  .px-assign { padding: 2px 12px 14px; counter-reset: pxstep; }
  .px-step { display: block; padding: 12px 0; }
  .px-step-num { display: none; }
  .px-step-body { gap: 8px; }
  .px-step-title { font-size: 15px; }
  .px-step-body > .px-step-title:first-child::before { counter-increment: pxstep; content: counter(pxstep); display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 8px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 800; vertical-align: 1px; }
  .px-pick-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 8px; }
  .px-pick { gap: 3px; }
  .px-pick-label { font-size: 11px; }
  .px-pick select { font-size: 15px; padding: 9px 6px; }
  .px-ex-cards { grid-template-columns: 1fr; gap: 6px; }
  .px-ex-card { grid-template-columns: 64px minmax(0, 1fr) 24px; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border-width: 1.5px; }
  .px-ex-card-pic img { aspect-ratio: 4 / 3; border-radius: 6px; }
  .px-ex-card-name { font-size: 14px; line-height: 1.25; }
  .px-ex-card::after { content: ""; width: 22px; height: 22px; box-sizing: border-box; border: 2px solid var(--border-strong); border-radius: 6px; display: grid; place-items: center; font-size: 14px; font-weight: 800; }
  .px-ex-card[aria-pressed="true"]::after { content: "\2713"; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
  .px-ex-card[aria-pressed="true"] .px-ex-card-name::before { content: none; }
  .px-dose { gap: 12px; flex-wrap: nowrap; }
  .px-num { gap: 3px; font-size: 12px; }
  .px-stepper button { width: 36px; height: 38px; font-size: 18px; }
  .px-stepper input { width: 42px; height: 38px; font-size: 17px; }
  .px-seg { gap: 4px; }
  .px-seg button { padding: 7px 10px; font-size: 14px; }
  .px-weekdays { gap: 4px; }
  .px-weekdays button { padding: 7px 0; width: calc((100% - 24px) / 7); font-size: 13px; text-align: center; }
  .px-inline { gap: 6px; }
  .px-inline .px-small { width: 64px; padding: 8px; }
  .px-date { padding: 8px; font-size: 14px; }
  .px-summary-box { margin-top: 8px; padding: 12px; gap: 10px; }
  .px-summary-box p { font-size: 14px; }
  .px-big { justify-self: stretch; padding: 12px; }
}

/* phones: works like an app. List first; a tapped patient opens full screen with a back button. */
.px-back { display: none; }
@media (max-width: 767px) {
  .px-empty, .px-side-head .pill-btn { display: none; }
  body.px-open .px-patients { display: none; }
  .px-back { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; border: 0; background: none; padding: 2px 0; font: inherit; font-size: 15px; font-weight: 700; color: var(--accent); cursor: pointer; }
  .px-back svg { width: 16px; height: 16px; }
  .px-patient-head { flex-direction: column; align-items: stretch; }
  .px-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .px-card { padding: 10px 8px 10px 10px; border-left-width: 4px; gap: 2px; }
  .px-card-label { font-size: 10px; letter-spacing: 0; }
  .px-card-big { font-size: 22px; }
  .px-card-mid { font-size: 16px; }
  .px-card-sub { font-size: 11px; line-height: 1.3; }
}

/* set photos (start / end of the best rep) inside an opened exercise */
.px-photos { display: grid; gap: 8px; }
.px-photo-set { display: grid; gap: 4px; }
.px-photo-when { font-size: 12px; color: var(--muted); font-weight: 600; }
.px-photo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-width: 520px; }
.px-photo { display: grid; gap: 4px; padding: 0; border: 0; background: none; cursor: zoom-in; font: inherit; color: var(--ink); text-align: left; }
.px-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: var(--surface-2); display: block; }
.px-photo span { font-size: 12px; color: var(--ink-soft); }
.px-photo.is-empty { display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 12px; cursor: default; }
.px-photo-view .dialog-body { display: grid; gap: 10px; max-width: min(960px, 94vw); }
.px-photo-view-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.px-photo-view img { width: 100%; height: auto; max-height: 78vh; object-fit: contain; border-radius: 10px; background: #000; }
