:root {
  font: 16px/1.5 var(--form-body, 'DM Sans', system-ui, -apple-system, sans-serif);
  color: var(--form-ink, #19251e);
  background: var(--form-canvas, #f6f7f4);
  --forest: var(--form-forest, #152c20);
  --ink: var(--form-ink, #19251e);
  --muted: #4d5e53;
  --orange: var(--form-orange, #ff8059);
  --edge: var(--form-line, #dde3dc);
  --soft: #f1f4ee;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button, a, label:has(input[type=radio]), label:has(input[type=checkbox]) { touch-action: manipulation; }
button, select { cursor: pointer; }
a { color: #8e3b23; text-underline-offset: .18em; }
button:disabled { opacity: .63; cursor: wait; }
[hidden] { display: none !important; }
:where(a, button, input, select, summary):focus-visible { outline: 3px solid #ad4328; outline-offset: 3px; }

.account-top { padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); background: white; border-bottom: 1px solid var(--edge); }
.account-top-inner { width: min(100%, 1030px); margin: auto; min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wordmark { display: inline-flex; align-items: center; min-height: 44px; gap: 7px; color: var(--ink); text-decoration: none; font-size: 1.6rem; font-weight: 800; letter-spacing: -.07em; line-height: 1; }
.brand-slashes { display: flex; align-items: center; gap: 3px; height: 23px; transform: skew(-18deg); }
.brand-slashes i { display: block; width: 5px; height: 100%; border-radius: 1px; background: #ed603d; }
.brand-slashes i:nth-child(2) { height: 72%; }
.brand-slashes i:nth-child(3) { height: 44%; }
.identity-buttons, .actions, .admin-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.identity-buttons { flex-wrap: nowrap; }
.install-link { min-height: 44px; padding: 8px 13px; display: inline-flex; justify-content: center; align-items: center; gap: 7px; background: white; border: 1px solid var(--edge); border-radius: 11px; color: #34463b; font-size: .875rem; font-weight: 650; line-height: 1.25; }
.install-link svg, .choice-icon svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.65; }
#refresh-feedback { width: min(100%, 1030px); margin: 0 auto; padding: 0 0 10px; color: var(--muted); font-size: .9rem; }
#refresh-feedback:empty, #feedback:empty, [data-signup-error]:empty { display: none; }

.account-frame { max-width: 620px; margin: 0 auto; padding: clamp(18px, 3vw, 40px) max(16px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.account-panel-wide { max-width: 970px; }
#account-content { scroll-margin-top: 1rem; min-width: 0; }
.account-hero, #account-content > h1 {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
  min-height: 176px;
  padding: clamp(21px, 4vw, 35px);
  border-radius: 22px;
  margin: 0 0 18px;
  color: white;
  background-color: var(--forest);
  background-image: linear-gradient(90deg, rgba(12,31,21,.97), rgba(12,31,21,.83) 40%, rgba(12,31,21,.26)), linear-gradient(0deg, rgba(12,31,21,.55), transparent 75%), var(--form-photo, url('/assets/workout-floor.jpg'));
  background-position: center, center, right 43%;
  background-size: cover;
  overflow-wrap: anywhere;
}
.account-hero h1, #account-content > h1 { margin-block: 0; font-family: var(--form-display, inherit); font-size: clamp(1.95rem, 5.8vw, 3.05rem); line-height: 1.07; letter-spacing: -.048em; font-weight: 750; }
#account-content > h1 { margin-bottom: 18px; }
.account-hero h1 { max-width: 17ch; }
.account-hero > p { margin: 10px 0 0; max-width: 42ch; line-height: 1.5; color: #eff5ec; }
.account-hero .inviting-trainer { margin: 0 0 12px; color: #ffd2bd; font-size: .9rem; font-weight: 700; }
#signup-title { outline: 0; }
#signup-progress { display: grid; grid-template-columns: auto minmax(40px, 170px); align-items: center; gap: 10px; margin: 15px 0 0; }
#signup-progress span { color: #eff5ec; font-size: .875rem; font-weight: 600; }
#signup-progress progress { appearance: none; width: 100%; height: 5px; border: 0; border-radius: 5px; overflow: hidden; background: #627367; }
#signup-progress progress::-webkit-progress-bar { background: #627367; }
#signup-progress progress::-webkit-progress-value { background: var(--orange); border-radius: 5px; }
#signup-progress progress::-moz-progress-bar { background: var(--orange); border-radius: 5px; }

.panel form:is(#sign-form, #recovery-form), .owner-accounts, .owner-history { background: white; padding: clamp(16px, 3vw, 28px); border: 1px solid var(--edge); border-radius: 21px; }
.panel form:is(#sign-form, #recovery-form) { display: grid; align-content: start; gap: 15px; }
form fieldset { min-width: 0; padding: 0; border: 0; margin: 0; }
#signup-hint { margin: 0; color: var(--muted); font-size: .95rem; font-weight: 550; }
.signup-role, .intake-choices { display: grid; gap: 8px; }
.intake-days { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.signup-role-option, .intake-choice {
  display: flex;
  position: relative;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 49px;
  padding: 10px 13px;
  color: var(--ink);
  cursor: pointer;
  border: 1px solid #d7dfd6;
  border-radius: 12px;
  background: white;
  font-weight: 600;
  line-height: 1.3;
}
.signup-role-option { min-height: 76px; }
.signup-role-option strong, .signup-role-option span[id] { display: block; }
.signup-role-option span[id] { margin-top: 3px; color: var(--muted); font-size: .875rem; line-height: 1.45; font-weight: 450; }
.choice-icon { width: 31px; height: 31px; border-radius: 9px; display: grid; place-items: center; flex: none; color: #37523e; background: #f0f3ec; }
.choice-icon svg { width: 19px; height: 19px; stroke-width: 1.7; }
.signup-role-option .choice-icon { width: 38px; height: 38px; }
.signup-role-option .choice-icon svg { width: 23px; height: 23px; }
.signup-role-option input, .intake-choice input {
  appearance: none;
  flex: none;
  display: grid;
  place-content: center;
  width: 20px;
  height: 20px;
  margin: 0 0 0 auto;
  border: 1.5px solid #87988a;
  border-radius: 50%;
  background: white;
  color: white;
}
.intake-choice input[type=checkbox] { border-radius: 6px; }
.signup-role-option input:checked, .intake-choice input:checked { color: var(--forest); background: var(--orange); border-color: var(--orange); }
.signup-role-option input:checked::after, .intake-choice input:checked::after {
  content: ''; width: 8px; height: 4px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-1px) rotate(-45deg);
}
:where(.intake-choice, .signup-role-option):has(input:checked) { background: #eaf1e9; border-color: #43684d; box-shadow: inset 0 0 0 1px #43684d; }
:where(.intake-choice, .signup-role-option):has(input:checked) .choice-icon { background: #d7e4d6; }
:where(.intake-choice, .signup-role-option):has(input:focus-visible) { outline: 3px solid #ad4328; outline-offset: 2px; }
:where(.intake-choice, .signup-role-option) input:focus-visible { outline: 0; }
.intake-days .intake-choice { gap: 6px; padding-inline: 12px; font-size: .94rem; }
.intake-days .intake-choice:last-child { grid-column: 1/-1; }
.field, .account-row label { display: grid; gap: 7px; color: var(--ink); font-size: .95rem; font-weight: 650; }
.field + .field, .custom-answer { margin-top: 13px; }
#sign-form > .field + .field { margin-top: 0; }
.field input, .field select, .panel select { min-width: 0; width: 100%; min-height: 48px; background: #fbfcfa; color: var(--ink); border: 1px solid #aab8ab; border-radius: 10px; padding: 9px 12px; font-size: 1rem; font-weight: 450; }
#password-length, .intake-privacy { display: block; margin: 8px 0 0; font-size: .875rem; color: var(--muted); }
.signup-actions { display: flex; gap: 8px; }
.signup-actions .primary { flex: 1; }
.training-recap { margin-bottom: 17px; padding: 9px 14px 14px; background: #f3f6f0; border: 1px solid var(--edge); border-radius: 13px; }
.recap-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.recap-heading h2 { margin: 0; font-size: 1.05rem; line-height: 1.3; letter-spacing: -.025em; }
.training-recap dl { display: grid; gap: 8px; margin: 2px 0 0; }
.training-recap dl > div, .training-recap dd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; }
.training-recap dt { color: var(--muted); font-size: .875rem; font-weight: 600; min-width: 82px; }
.training-recap dd { min-width: 0; flex: 1 1 140px; margin: 0; }
.training-recap dd span { padding: 3px 8px; background: #dfeadd; border-radius: 9px; color: #243e2c; font-size: .875rem; line-height: 1.35; overflow-wrap: anywhere; }
.primary, .secondary, .quiet, .admin-nav a { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 46px; padding: 10px 17px; font-weight: 700; border-radius: 11px; line-height: 1.35; text-align: center; }
.primary { background: var(--orange); color: #17241d; border: 1px solid transparent; }
.primary:hover { background: #ff9978; }
.secondary { background: white; color: #233a2b; border: 1px solid #c9d4c9; }
.secondary:hover, .install-link:hover { background: var(--soft); }
.quiet { background: transparent; color: #923f26; border: 0; text-decoration: underline; text-underline-offset: .18em; padding-inline: 4px; }
.switch { margin: 12px 0 0; color: var(--muted); font-size: .95rem; text-align: center; }
.switch a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 650; }
#feedback, [data-signup-error] { margin: 14px 0 0; color: #91381f; overflow-wrap: anywhere; }
[data-signup-error] { margin: 0; }

.owner-workspaces { display: flex; padding: 4px; gap: 2px; background: #ecf0e9; border: 1px solid var(--edge); border-radius: 14px; margin: 0 0 16px; }
.owner-workspaces a { flex: 1; min-height: 44px; display: grid; place-items: center; padding: 6px; text-decoration: none; color: #4d5d51; border-radius: 10px; font-size: .95rem; font-weight: 650; }
.owner-workspaces [aria-current=page] { background: white; color: var(--ink); box-shadow: 0 1px 4px #15241b15; }
.admin-nav { margin-top: 18px; }
.admin-nav a { border: 1px solid #b0c3b2; color: white; text-decoration: none; }
.admin-nav a:first-child { background: var(--orange); color: var(--ink); border-color: transparent; }
.owner-accounts h2, .owner-history h2 { font-size: 1.35rem; letter-spacing: -.035em; line-height: 1.25; margin: 0 0 14px; }
.owner-history { margin-top: 15px; }
.owner-history ol { margin: 0; padding-left: 20px; }
.owner-history li { padding: 8px 0; }
.owner-history button { margin-top: 12px; }
.account-row { padding: 18px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 9px; border-top: 1px solid var(--edge); }
.account-row > div, .account-row label { flex: 1 0 100%; min-width: 0; }
.account-row strong, .account-row small { display: block; overflow-wrap: anywhere; }
.account-row small { color: var(--muted); font-size: .875rem; }
.account-row .secondary { padding: 9px 12px; font-size: .875rem; }
.account-row [data-approve=true] { background: #edf3e9; border-color: #bed0bb; }
#install-help, .recovery-dialog { width: min(460px, calc(100% - 32px)); max-height: 85dvh; overflow: auto; border: 1px solid var(--edge); border-radius: 20px; padding: 24px; color: var(--ink); }
#install-help::backdrop, .recovery-dialog::backdrop { background: #10241999; }
#install-help h2, .recovery-dialog h2 { font-size: 1.45rem; line-height: 1.2; letter-spacing: -.035em; margin: 0 0 16px; }
#install-help form, .recovery-dialog .primary { margin-top: 15px; }
.recovery-dialog [role=status] { overflow-wrap: anywhere; }

@media(min-width: 820px) {
  .account-frame:has([data-signup]), .account-frame:has(#sign-form) { max-width: 1030px; }
  #account-content:has(#sign-form) { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; align-items: start; }
  #account-content:has(#sign-form) .account-hero { grid-column: 1; grid-row: 1 / span 3; margin: 0; min-height: 365px; padding: 34px; }
  #account-content:has(#sign-form) > :not(.account-hero) { grid-column: 2; }
  .owner-workspaces { max-width: 340px; }
}
@media(max-width: 560px) {
  .account-top-inner { min-height: 60px; }
  .install-link { min-width: 44px; padding: 8px 10px; }
  .install-link .refresh-label { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .account-hero, #account-content > h1 { min-height: 155px; margin-bottom: 13px; }
  .signup-hero:has(.inviting-trainer) { min-height: 168px; }
  [data-signup]:has([data-signup-step="account"][hidden]) .signup-actions {
    position: sticky;
    bottom: max(5px, env(safe-area-inset-bottom));
    z-index: 1;
    padding: 6px 0;
    background: white;
  }
}
@media(max-width: 355px) {
  .identity-buttons [data-action=install-form] svg { display: none; }
}
@media(forced-colors: active) {
  .signup-role-option input, .intake-choice input { appearance: auto; }
  .signup-role-option input:checked::after, .intake-choice input:checked::after { content: none; }
}

.trainer-invite-dialog input{width:100%;min-width:0;margin:.4rem 0 .8rem}
.trainer-invite-dialog .actions .primary{margin:0}
.trainer-invite-dialog [hidden]{display:none}
.trainer-invite-dialog [role=status]:empty{display:none}
