/* Performance Lab – Formularsanierung / Phase 1.
   This file owns form GEOMETRY. The legacy stylesheet remains responsible for
   palette, typography and other site elements. No JavaScript width rewriting.
   Add managed form class only to editorial/performance forms, not deletion forms.
*/

/* A hidden panel must never reserve a second column for an invisible editor. */
.performance-split.pl-diagnostic-flow {
  display: block;
  inline-size: 100%;
  min-inline-size: 0;
}
.performance-split.pl-diagnostic-flow > .performance-panel {
  box-sizing: border-box;
  inline-size: 100%;
  max-inline-size: 100%;
  min-inline-size: 0;
  margin-block-end: 16px;
}

/* No column is allowed to propagate a native control's min-content width to
   the surrounding page. Keep tables scrolling inside their own panels. */
.performance-panel,
.performance-panel > form,
.performance-panel .performance-form,
.performance-panel .performance-area-filter,
.performance-panel .form-grid-2,
.performance-panel .form-grid-3,
.performance-panel .form-grid-4,
.performance-panel .form-grid-5,
.performance-panel .performance-table-wrap,
.performance-split,
.pl-managed-form {
  box-sizing: border-box;
  min-inline-size: 0;
  max-inline-size: 100%;
}
.performance-panel .performance-table-wrap {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

/* Forms opt in with a dedicated class; form/label nesting and user-visible
   help texts are kept together. No rules on site-wide forms. */
form.pl-managed-form :where(label) {
  box-sizing: border-box;
  min-inline-size: 0;
  max-inline-size: 100%;
}
form.pl-managed-form label:not(.check-card):not(.checkbox-line):not(:has(> input[type="checkbox"], > input[type="radio"])) {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  align-self: flex-start;
  gap: 6px;
  text-align: start;
  margin: 0;
}
form.pl-managed-form label :where(small, .help, .field-help, .field-description) {
  display: block;
  line-height: 1.45;
  text-align: start;
  margin: 2px 0 0;
  max-inline-size: 100%;
  overflow-wrap: anywhere;
}

/* All editable native controls fit inside their own field box, not the grid's
   implied full-page width. Checkboxes and radios keep their intrinsic sizes. */
form.pl-managed-form :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  box-sizing: border-box;
  min-inline-size: 0;
  max-inline-size: 100%;
}
form.pl-managed-form input[type="date"] {
  box-sizing: border-box;
  inline-size: 176px;
  min-inline-size: 0;
  max-inline-size: 100%;
  font-variant-numeric: tabular-nums;
}
form.pl-managed-form input[type="date"]::-webkit-date-and-time-value { min-width:0; text-align:start; }
form.pl-managed-form input[type="date"]::-webkit-datetime-edit { min-width:0; }

/* The following two layout families cover search/filter forms and compact
   entry grids. Flexible WRAPPING is preferred over filling arbitrary columns.
   A 10-character date does not grow to 500px when another field is missing. */
form.pl-managed-form:is(.performance-area-filter,.performance-filter,.bm-select-form,.bm-set-form,.bm-point-form,.group-target-form,.planner-global-filter,.battery-filter),
form.pl-managed-form :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5,.benchmark-times,.benchmark-times-wide) {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  column-gap: 14px;
  row-gap: 16px;
  grid-template-columns: none;
}

form.pl-managed-form:is(.performance-area-filter,.performance-filter,.bm-select-form,.bm-set-form,.bm-point-form,.group-target-form,.planner-global-filter,.battery-filter) > label:not(.check-card):not(.checkbox-line):not(.pl-benchmark-date):not(.pl-benchmark-time):not(.pl-benchmark-description):not(.pl-target-date):not(.pl-target-value),
form.pl-managed-form :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5,.benchmark-times,.benchmark-times-wide) > label:not(.check-card):not(.checkbox-line):not(.pl-phase2-editorial) {
  flex: 0 1 280px;
  inline-size: 280px;
  max-inline-size: 100%;
}

/* Short fields: fixed content-appropriate boxes that can shrink at tiny
   viewport widths. Select/search/text labels remain wider as needed. */
form.pl-managed-form:is(.performance-area-filter,.performance-filter,.bm-select-form,.bm-set-form,.bm-point-form,.group-target-form,.planner-global-filter,.battery-filter) > label:not(.pl-benchmark-date):not(.pl-target-date):has(> input[type="date"]),
form.pl-managed-form :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5,.benchmark-times,.benchmark-times-wide) > label:has(> input[type="date"]) {
  flex: 0 1 176px;
  inline-size: 176px;
}
form.pl-managed-form:is(.performance-area-filter,.performance-filter,.bm-select-form,.bm-set-form,.bm-point-form,.group-target-form,.planner-global-filter,.battery-filter) > label:has(> input[type="number"]),
form.pl-managed-form :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5,.benchmark-times,.benchmark-times-wide) > label:has(> input[type="number"]) {
  flex: 0 1 154px;
  inline-size: 154px;
}
form.pl-managed-form:is(.performance-area-filter,.performance-filter,.bm-select-form,.bm-set-form,.bm-point-form,.group-target-form,.planner-global-filter,.battery-filter) > label:not(.pl-benchmark-time):has(> input[name*="time"], > input[name*="top1"], > input[name*="top3"], > input[name*="top8"], > input[name*="top16"]),
form.pl-managed-form :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5,.benchmark-times,.benchmark-times-wide) > label:has(> input[name*="time"], > input[name*="top1"], > input[name*="top3"], > input[name*="top8"], > input[name*="top16"]) {
  flex: 0 1 160px;
  inline-size: 160px;
}
form.pl-managed-form:is(.bm-point-form,.bm-legacy-form) > label:not(.pl-benchmark-date):not(.pl-benchmark-time):has(> input[name^="bm_"]) {
  flex: 0 1 160px;
  inline-size: 160px;
}
form.pl-managed-form :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5) > label:not(.pl-phase2-editorial):has(>textarea) {
  flex: 1 1 min(100%,420px);
  inline-size: min(100%,420px);
}

/* Search actions live in their own slot; never stretch another label. */
form.pl-managed-form:is(.performance-area-filter,.performance-filter,.bm-select-form,.bm-set-form,.bm-point-form,.group-target-form,.planner-global-filter,.battery-filter)
  > :is(.performance-area-filter-actions,.bm-form-actions,.group-target-form-actions,.performance-form-actions) {
  flex: 0 1 auto;
  inline-size: auto;
  min-inline-size: 0;
  max-inline-size: 100%;
  align-self: flex-end;
  grid-column: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
form.pl-managed-form :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5) > .performance-form-actions {
  min-inline-size: 0;
  flex: 0 1 auto;
  align-self: flex-end;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
form.pl-managed-form .checkbox-line {
  display: inline-flex;
  align-items: center;
  align-self: center;
  flex: 0 1 auto;
  max-inline-size: 100%;
}
/* Stand-alone fieldsets, notices and substantial textareas get their own row. */
form.pl-managed-form:is(.bm-point-form,.bm-select-form,.bm-set-form,.group-target-form) > :is(fieldset,.bm-message,.group-target-empty) {
  flex: 0 0 100%;
  min-inline-size: 0;
}

/* In full-width history cards, do not permit a latent two-column grid to
   squash a single visible pane into one-third of the page. */
.performance-panel[data-workspace-pane="history"] { width:100%; max-width:100%; min-width:0; }

@media(max-width:540px){
  form.pl-managed-form:is(.performance-area-filter,.performance-filter,.bm-select-form,.bm-set-form,.bm-point-form,.group-target-form,.planner-global-filter,.battery-filter),
  form.pl-managed-form :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5){
    column-gap: 10px;
    row-gap: 14px;
  }
  form.pl-managed-form :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5) > label:not(.check-card):not(.checkbox-line),
  form.pl-managed-form:is(.performance-area-filter,.performance-filter,.bm-select-form,.bm-set-form,.bm-point-form,.group-target-form) > label:not(.check-card):not(.checkbox-line){
    max-inline-size:100%;
  }
}

/* Native date elements are always compact, including legacy edit forms which
   pre-date the managed-form class. This is scoped to Performance Lab panels. */
.performance-panel input[type="date"],
.performance-form input[type="date"],
.report-config-form input[type="date"],
.performance-area-filter input[type="date"] {
  inline-size: 176px;
  min-inline-size: 0;
  max-inline-size: 100%;
  box-sizing: border-box;
}

/* Multi-stage diagnostics: the measurement table is an explicit scrolling
   island. It must not impose its many column widths on its whole panel. */
.diagnostic-form,
.diagnostic-stage-editor,
.diagnostic-stage-editor .performance-table-wrap,
.pyne-recovery-editor,
.performance-panel .performance-table-wrap {
  box-sizing:border-box;
  min-inline-size:0;
  max-inline-size:100%;
}
.diagnostic-stage-editor {overflow:hidden;}
.diagnostic-stage-editor .performance-table-wrap,
.performance-panel .performance-table-wrap:has(.diagnostic-input-table) {
  display:block;
  overflow-x:auto;
  overflow-y:hidden;
  -webkit-overflow-scrolling: touch;
}
.diagnostic-stage-editor :is(.diagnostic-input-table,.pyne-input-table) {
  inline-size:max-content;
  min-inline-size:100%;
  table-layout:auto;
}
.diagnostic-stage-editor .diagnostic-input-table input:not([type="checkbox"]):not([type="radio"]) {
  inline-size:92px;
  min-inline-size:78px;
  max-inline-size:none;
}
/* Guardian and report forms have independently sized nested controls. */
.athlete-guardian-invite-form,
.athlete-guardian-invite-form > *,
.report-panel,
.report-config-form,
.report-period-config {
  min-inline-size:0;
  max-inline-size:100%;
  box-sizing:border-box;
}
.athlete-guardian-invite-form :is(input:not([type="checkbox"]),select,textarea) {
  max-inline-size:100%;
  min-inline-size:0;
  box-sizing:border-box;
}
.report-config-form input[type="date"] {inline-size:176px;}

/* Standalone fields used in legacy entry forms must never retain an older
   280/310px min-content width when the actual content column is narrower. */
form.pl-managed-form > label:not(.checkbox-line):not(.check-card):not(.pl-diagnostic-interpretation):not(.pl-target-date):not(.pl-target-value):not(.pl-benchmark-date):not(.pl-benchmark-time):not(.pl-benchmark-description):not(.pl-phase2-editorial):not(.pl-stage3-editorial) {
  box-sizing:border-box;
  inline-size:min(100%, 320px);
  max-inline-size:100%;
  min-inline-size:0;
}
form.pl-managed-form > label:has(> input[type="date"]) {
  inline-size:min(100%,176px);
}
form.pl-managed-form :is(fieldset,.performance-fieldset,.custom-reference-fields) {
  box-sizing:border-box;
  min-inline-size:0;
  max-inline-size:100%;
}
form.pl-managed-form input[type="checkbox"],
form.pl-managed-form input[type="radio"] {
  box-sizing:border-box;
  inline-size:18px;
  max-inline-size:18px;
  min-inline-size:18px;
  flex:0 0 18px;
}

/* Critical: implicit CSS Grid columns default to auto min-content sizing.
   This was the remaining reason that a 280px nested form would stretch a
   212px mobile panel despite max-width rules on individual inputs. */
form.pl-managed-form.performance-form {
  grid-template-columns: minmax(0,1fr);
}
form.pl-managed-form.performance-form > * {
  box-sizing:border-box;
  min-inline-size:0;
  max-inline-size:100%;
}
form.pl-managed-form.performance-form > :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5,.benchmark-times,.benchmark-times-wide) {
  inline-size:100%;
}


/* V0.15.10.40: competition date controls are siblings of the other fields,
   never a nested flex group which can be undersized by native iPad controls.
   The label box owns its own width PLUS Safari date-control safety space. */
form.pl-managed-form.performance-area-filter-performance {
  display:flex;flex-direction:column;align-items:stretch;gap:14px;
}
form.pl-managed-form.performance-area-filter-performance > .pl-performance-filter-row {
  display:flex;flex-wrap:wrap;align-items:flex-end;gap:16px 22px;
  width:100%;min-width:0;box-sizing:border-box;
}
form.pl-managed-form.performance-area-filter-performance > .pl-performance-filter-row > label {
  display:flex;flex-direction:column;align-items:stretch;align-self:flex-end;gap:6px;
  margin:0;min-width:0;max-width:100%;flex:0 1 260px;width:260px;
}
form.pl-managed-form.performance-area-filter-performance > .pl-performance-filter-primary > .pl-competition-dates {
  display:grid;grid-template-columns:176px 176px;gap:24px;flex:0 0 376px;
  width:376px;max-width:100%;min-width:0;box-sizing:border-box;
  align-items:end;
}
form.pl-managed-form.performance-area-filter-performance .pl-competition-dates > label.pl-competition-date {
  display:flex;flex-direction:column;gap:6px;width:176px;max-width:100%;
  min-width:0;margin:0;box-sizing:border-box;
}
form.pl-managed-form.performance-area-filter-performance .pl-competition-dates > label.pl-competition-date > input[type="date"] {
  display:block;flex:none;inline-size:176px;width:176px;max-inline-size:100%;
  min-inline-size:0;box-sizing:border-box;
}
form.pl-managed-form.performance-area-filter-performance > .pl-performance-filter-secondary > label:has(select[name="perf_size"]) {
  flex:0 0 146px;width:146px;
}
form.pl-managed-form.performance-area-filter-performance > .pl-performance-filter-row > .performance-area-filter-actions {
  align-self:flex-end;min-height:0;display:flex;align-items:center;gap:10px;
  flex:0 1 auto;flex-wrap:wrap;margin:0;
}
form.pl-managed-form.performance-area-filter-performance > .pl-performance-filter-row :is(input:not([type="hidden"]),select) {
  box-sizing:border-box;min-width:0;max-width:100%;
}
@media(max-width:480px){
 form.pl-managed-form.performance-area-filter-performance > .pl-performance-filter-row > label:not(.pl-competition-date) {flex:1 1 225px;}
}

/* Personal goal corridor – short independent date and time boxes. */
form.pl-managed-form.personal-plan-form > label.pl-target-date {
  flex: 0 0 176px;
  width: 176px;
  max-width: 100%;
}
form.pl-managed-form.personal-plan-form > label.pl-target-value {
  flex: 0 0 150px;
  width: 150px;
  max-width: 100%;
}
form.pl-managed-form.personal-plan-form > label.pl-target-value > input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* Diagnostic report: long-form prose needs a full-width writing area.
   Applies only to the two notes blocks in free-stage and Pyne forms. */
form.pl-managed-form > label.pl-diagnostic-interpretation,
form.diagnostic-form > label.pl-diagnostic-interpretation {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  inline-size: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
form.pl-managed-form > label.pl-diagnostic-interpretation > textarea,
form.diagnostic-form > label.pl-diagnostic-interpretation > textarea {
  display: block;
  width: 100%;
  inline-size: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 205px;
  resize: vertical;
  box-sizing: border-box;
}
@media (max-width: 490px) {
  /* Keep both dates in the first filter section without forcing page overflow. */
  form.pl-managed-form.performance-area-filter-performance .pl-performance-filter-dates {
    flex: 0 1 100%;
    flex-wrap: wrap;
    gap: 12px;
  }
  form.pl-managed-form.performance-area-filter-performance > .pl-performance-filter-row > label:not(:has(input[type="date"])) {
    flex: 1 1 230px;
    width: auto;
  }
}

/* V0.15.10.40: same long-form editorial area in athlete profiles and race results.
   Keep a full-width field group even inside the legacy implicit grid. */
form.pl-managed-form.performance-form > label.pl-diagnostic-interpretation {
  display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;
  grid-column:1/-1;flex:0 0 100%;width:100%;inline-size:100%;
  min-inline-size:0;max-inline-size:100%;gap:8px;margin-block:8px 0;
}
form.pl-managed-form.performance-form > label.pl-diagnostic-interpretation > textarea {
  display:block;box-sizing:border-box;width:100%;inline-size:100%;
  min-inline-size:0;max-inline-size:100%;height:auto;min-height:225px;
  resize:vertical;line-height:1.55;
}

@media(max-width:460px){
 form.pl-managed-form.performance-area-filter-performance > .pl-performance-filter-primary > .pl-competition-dates {
  display:grid;grid-template-columns:minmax(0,176px);gap:14px;
  flex:0 1 100%;width:100%;max-width:100%;
 }
}


/* SANIERUNG – PHASE 2 (V0.15.10.41)
   Applies only to newly audited editorial forms. All V40 form classes remain
   untouched; avoids accidental regressions in benchmarks and competition UI.
   Long-form text fields span their actual container, not a 280px flex cell.
   A label, control and its associated small/help stay a vertical unit.
*/
form.pl-phase2-form,
form.pl-phase2-form > :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5),
form.pl-phase2-form > :is(.test-session-item-picker,.battery-test-picker,.performance-form-actions,.custom-reference-fields),
form.pl-phase2-form .pl-phase2-custom-fields {
  box-sizing:border-box;
  min-inline-size:0;
  max-inline-size:100%;
}
form.pl-phase2-form label:not(.check-card):not(.checkbox-line):not(.battery-picker-item):has(> :is(input,textarea,select)) {
  align-self:flex-start;
  text-align:start;
}
form.pl-phase2-form label:not(.check-card):not(.checkbox-line):not(.battery-picker-item) > :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea) {
  box-sizing:border-box;
  min-inline-size:0;
  max-inline-size:100%;
}
form.pl-phase2-form label:not(.check-card):not(.checkbox-line):not(.battery-picker-item) > :is(small,.field-help) {
  margin-block-start:4px;
  line-height:1.45;
  text-align:start;
  overflow-wrap:anywhere;
}
/* Qualitative prose has different spatial requirements from a lap time. */
form.pl-phase2-form > label.pl-phase2-editorial,
form.pl-phase2-form :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5) > label.pl-phase2-editorial {
  display:flex;
  flex:0 0 100%;
  grid-column:1/-1;
  align-self:stretch;
  flex-direction:column;
  align-items:stretch;
  gap:8px;
  inline-size:100%;
  min-inline-size:0;
  max-inline-size:100%;
  box-sizing:border-box;
}
form.pl-phase2-form label.pl-phase2-editorial > textarea {
  display:block;
  inline-size:100%;
  width:100%;
  max-inline-size:100%;
  min-inline-size:0;
  min-height:190px;
  resize:vertical;
  box-sizing:border-box;
  line-height:1.55;
  white-space:pre-wrap;
}
form.pl-phase2-battery label.pl-phase2-editorial > textarea {min-height:160px;}
form.pl-phase2-planner label.pl-phase2-editorial > textarea {min-height:142px;}
/* A custom athletic test has a long name but a short measurement unit. */
form.pl-phase2-athletics > .pl-phase2-custom-fields {
  display:flex;
  flex-wrap:wrap;
  align-items:flex-start;
  gap:14px;
  inline-size:100%;
}
form.pl-phase2-athletics > .pl-phase2-custom-fields > label {
  display:flex;
  flex:0 1 320px;
  flex-direction:column;
  align-self:flex-start;
  gap:6px;
  inline-size:320px;
  min-inline-size:0;
  max-inline-size:100%;
}
form.pl-phase2-athletics > .pl-phase2-custom-fields > label:has(input[name="unit"]) {
  flex:0 1 148px;
  inline-size:148px;
}
/* Separate large grouped elements from compact control rows. */
form.pl-phase2-battery > :is(.battery-test-picker,.swim-mobility-protocol,.performance-form-actions),
form.pl-phase2-planner > :is(.test-session-item-picker,.performance-form-actions) {
  inline-size:100%;
  min-inline-size:0;
  max-inline-size:100%;
  box-sizing:border-box;
}
/* A submit button must not become a full-width bar merely because the grid
   item occupies a complete track. It wraps only when the button text needs it. */
form.pl-phase2-planner > button.button {
  width:max-content; max-inline-size:100%; min-inline-size:0;
  justify-self:start; align-self:start;
  white-space:normal; text-align:center;
}
/* Report period: short inputs may sit side by side without stretching. */
form.pl-phase2-report .report-period-config {
  display:flex;
  flex-wrap:wrap;
  align-items:flex-start;
  gap:14px 16px;
  grid-template-columns:none;
  inline-size:100%;
  min-inline-size:0;
  max-inline-size:100%;
}
form.pl-phase2-report .report-period-config > label {
  display:flex;
  flex:0 1 178px;
  inline-size:178px;
  min-inline-size:0;
  max-inline-size:100%;
  flex-direction:column;
  gap:6px;
  align-items:stretch;
}
form.pl-phase2-report .report-period-config > label:first-child {flex-basis:240px;inline-size:240px;}
form.pl-phase2-report .report-period-config :is(input[type="date"],select) {
  box-sizing:border-box;
  min-inline-size:0;
  max-inline-size:100%;
}
form.pl-phase2-report #report-comment {
  display:block;
  box-sizing:border-box;
  inline-size:100%;
  max-inline-size:100%;
  min-inline-size:0;
  min-height:220px;
  line-height:1.55;
  resize:vertical;
}
@media(max-width:500px) {
  form.pl-phase2-athletics > .pl-phase2-custom-fields > label {flex:1 1 240px;inline-size:auto;}
  form.pl-phase2-report .report-period-config > label {flex:1 1 176px;max-inline-size:100%;}
}


/* PERFORMANCE LAB / FORMULARSANIERUNG STUFE 3 – v0.15.10.42.
   Strict opt-in. The accepted v40 benchmark, personal corridor and history
   forms are NOT assigned this class. Layout never mutates form controls in JS.
   The same HTML field unit is used for create and edit states.
*/
form.pl-stage3-form {
  display:flex;
  flex-wrap:wrap;
  align-items:flex-start;
  align-content:flex-start;
  column-gap:16px;
  row-gap:18px;
  min-inline-size:0;
  max-inline-size:100%;
  box-sizing:border-box;
}
form.pl-stage3-form > :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5,
  .performance-fieldset,.diagnostic-stage-editor,.diagnostic-threshold-editor,
  .pyne-recovery-editor,.test-workbench-section-head,.test-workbench-rows,
  .performance-form-actions,.diagnostic-form-actions,.group-assignment-list,
  .group-target-form-actions) {
  flex:0 0 100%;
  box-sizing:border-box;
  min-inline-size:0;
  max-inline-size:100%;
}
form.pl-stage3-form :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5) {
  display:flex;
  flex-wrap:wrap;
  align-items:flex-start;
  align-content:flex-start;
  gap:16px;
  grid-template-columns:none;
}
form.pl-stage3-form > label:not(.check-card):not(.checkbox-line):not(.pl-stage3-editorial):not(.pl-diagnostic-interpretation),
form.pl-stage3-form :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5) > label:not(.check-card):not(.checkbox-line):not(.pl-stage3-editorial) {
  display:flex;
  flex:0 1 290px;
  inline-size:290px;
  max-inline-size:100%;
  min-inline-size:0;
  flex-direction:column;
  align-items:stretch;
  align-self:flex-start;
  gap:6px;
  box-sizing:border-box;
  text-align:start;
}
/* Measurements and dates are content-sized, never a full column. */
form.pl-stage3-form label:not(.pl-stage3-editorial):has(>input[type="date"]) {
  flex:0 1 176px;
  inline-size:176px;
}
form.pl-stage3-form label:not(.pl-stage3-editorial):has(>input[type="number"]) {
  flex:0 1 158px;
  inline-size:158px;
}
form.pl-stage3-form label:not(.pl-stage3-editorial):has(>input[name="target_time"],>input[name="pb_200_time"]) {
  flex:0 1 155px;
  inline-size:155px;
}
form.pl-stage3-form label:not(.pl-stage3-editorial) > :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea) {
  display:block;
  box-sizing:border-box;
  min-inline-size:0;
  max-inline-size:100%;
  inline-size:100%;
}
form.pl-stage3-form label:not(.pl-stage3-editorial) > input[type="date"] {
  inline-size:min(100%,176px);
  max-inline-size:min(100%,176px);
  font-variant-numeric:tabular-nums;
}
/* Long human-written content belongs on its own line, with help text
   directly below the input. Every full-width editor is vertically resizable. */
form.pl-stage3-form label.pl-stage3-editorial,
form.pl-stage3-form :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5) > label.pl-stage3-editorial {
  display:flex;
  flex:0 0 100%;
  grid-column:1/-1;
  inline-size:100%;
  min-inline-size:0;
  max-inline-size:100%;
  flex-direction:column;
  align-items:stretch;
  align-self:stretch;
  gap:7px;
  box-sizing:border-box;
  text-align:start;
}
form.pl-stage3-form label.pl-stage3-editorial > textarea {
  display:block;
  box-sizing:border-box;
  inline-size:100%;
  width:100%;
  min-inline-size:0;
  max-inline-size:100%;
  min-block-size:152px;
  resize:vertical;
  line-height:1.55;
  white-space:pre-wrap;
}
form.pl-stage3-person label.pl-diagnostic-interpretation,
form.pl-stage3-result label.pl-diagnostic-interpretation,
form.pl-stage3-diagnostic label.pl-diagnostic-interpretation {
  display:flex;
  flex:0 0 100%;
  inline-size:100%;
  max-inline-size:100%;
  flex-direction:column;
  align-items:stretch;
  gap:7px;
}
form.pl-stage3-person label.pl-diagnostic-interpretation > textarea,
form.pl-stage3-result label.pl-diagnostic-interpretation > textarea,
form.pl-stage3-diagnostic label.pl-diagnostic-interpretation > textarea {
  box-sizing:border-box;
  inline-size:100%;
  max-inline-size:100%;
  min-block-size:230px;
  resize:vertical;
}
form.pl-stage3-form > :is(fieldset,.performance-fieldset) {
  min-inline-size:0;
  max-inline-size:100%;
  box-sizing:border-box;
}
form.pl-stage3-form :is(.check-grid,.participant-check-grid,.group-assignment-list,
  .test-workbench-rows,.test-workbench-inputs) {
  min-inline-size:0;
  max-inline-size:100%;
  box-sizing:border-box;
}
/* Dynamic workbench measurements can wrap without overrunning the page. */
form.pl-stage3-workbench .test-workbench-inputs {
  display:flex;
  flex-wrap:wrap;
  align-items:flex-start;
  gap:12px;
  grid-template-columns:none;
}
form.pl-stage3-workbench .test-workbench-inputs > label {
  display:flex;
  flex:0 1 160px;
  min-inline-size:0;
  max-inline-size:100%;
  flex-direction:column;
  gap:6px;
  text-align:start;
}
form.pl-stage3-workbench .test-workbench-inputs > label > input[type="number"] {
  box-sizing:border-box;
  inline-size:100%;
  min-inline-size:0;
  max-inline-size:100%;
}
/* Dense swim-stage/Pyne tables scroll inside the table, NOT the page. */
form.pl-stage3-diagnostic .diagnostic-stage-editor {
  min-inline-size:0;
  max-inline-size:100%;
  overflow:hidden;
}
form.pl-stage3-diagnostic .diagnostic-stage-editor .performance-table-wrap {
  display:block;
  box-sizing:border-box;
  min-inline-size:0;
  max-inline-size:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-inline:contain;
}
form.pl-stage3-diagnostic .diagnostic-stage-editor :is(.diagnostic-input-table,.pyne-input-table) {
  inline-size:max-content;
  min-inline-size:100%;
}
form.pl-stage3-diagnostic :is(.diagnostic-threshold-editor,.pyne-recovery-editor) {
  box-sizing:border-box;
  min-inline-size:0;
  max-inline-size:100%;
}
/* Long optional group-note does not fill a row with an oversized short input. */
form.pl-stage3-group-target > label.pl-stage3-editorial > textarea {min-block-size:115px;}
form.pl-stage3-form :is(.performance-form-actions,.diagnostic-form-actions,.group-target-form-actions) {
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
@media(max-width:540px){
  form.pl-stage3-form{column-gap:10px;row-gap:14px;}
  form.pl-stage3-form :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5){gap:12px;}
  form.pl-stage3-form > label:not(.pl-stage3-editorial):not(.checkbox-line),
  form.pl-stage3-form :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5) > label:not(.pl-stage3-editorial):not(.checkbox-line){max-inline-size:100%;}
}

/* v42 specificity tie-breakers: 2026-era generic form-grid rules must not
   widen compact controls or collapse editorial fields. */
form.pl-stage3-form.pl-managed-form label:not(.pl-stage3-editorial) > input[type="date"] {
  inline-size:176px; width:176px; max-inline-size:100%; max-width:100%;
}
form.pl-stage3-form.pl-managed-form :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5) > label:not(.check-card):not(.checkbox-line):has(>input[type="date"]),
form.pl-stage3-form.pl-managed-form > label:not(.check-card):not(.checkbox-line):has(>input[type="date"]){
  flex:0 1 176px; inline-size:176px; max-inline-size:100%;
}
form.pl-stage3-form.pl-managed-form :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5) > label:not(.check-card):not(.checkbox-line):has(>input[type="number"]),
form.pl-stage3-form.pl-managed-form > label:not(.check-card):not(.checkbox-line):has(>input[type="number"]){
  flex:0 1 158px; inline-size:158px; max-inline-size:100%;
}
form.pl-stage3-form.pl-managed-form :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5) > label:not(.check-card):not(.checkbox-line):has(>input[name="target_time"],>input[name="pb_200_time"]){
  flex:0 1 155px; inline-size:155px; max-inline-size:100%;
}
form.pl-stage3-form .pl-stage3-prose-stack {
  display:flex; flex:0 0 100%; inline-size:100%; max-inline-size:100%;
  min-inline-size:0; flex-direction:column; align-items:stretch; gap:16px;
}
form.pl-stage3-form .pl-stage3-prose-stack > label.pl-stage3-editorial,
form.pl-stage3-form.pl-managed-form > label.pl-stage3-editorial,
form.pl-stage3-form.pl-managed-form :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5) > label.pl-stage3-editorial{
  display:flex; flex:0 0 100%; inline-size:100%; width:100%; min-inline-size:0;
  max-inline-size:100%; flex-direction:column; align-items:stretch; gap:7px;
}
form.pl-stage3-form.pl-managed-form label.pl-stage3-editorial > textarea,
form.pl-stage3-form .pl-stage3-prose-stack > label.pl-stage3-editorial > textarea {
  display:block; box-sizing:border-box; inline-size:100%; width:100%; max-inline-size:100%;
  min-block-size:165px; resize:vertical; line-height:1.55;
}
/* Long-note regression guard (v42): legacy .performance-form textarea rules
   otherwise keep some editors at the old 290px label/control width. */
form.pl-stage3-form.pl-managed-form > label.pl-diagnostic-interpretation,
form.pl-stage3-form.pl-managed-form > label.pl-stage3-editorial,
form.pl-stage3-form.pl-managed-form :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5,.pl-stage3-prose-stack) > label.pl-stage3-editorial {
  display:flex;
  flex:0 0 100%;
  width:100%;inline-size:100%;min-inline-size:0;
  max-width:100%;max-inline-size:100%;
  align-self:stretch;
  flex-direction:column;
  align-items:stretch;
}
form.pl-stage3-form.pl-managed-form label:is(.pl-stage3-editorial,.pl-diagnostic-interpretation) > textarea {
  display:block;
  box-sizing:border-box;
  width:100%;inline-size:100%;
  min-inline-size:0;max-width:100%;max-inline-size:100%;
  min-height:165px;resize:vertical;
}


/* V0.15.10.43 — gezielte Sanierungsstufe: native iPad date control alignment.
   All Performance Lab dates, including new/edit views and filters, share the
   same control geometry. No DOM rewriting or non-native date emulation. */
main :is(.performance-panel,.performance-form,.performance-area-filter,.report-config-form,.planner-global-filter,.benchmark-monitor-admin,.group-target-admin) input[type="date"],
main form.pl-managed-form input[type="date"] {
  box-sizing: border-box;
  display: block;
  flex: 0 0 auto;
  width: 168px;
  inline-size: 168px;
  min-width: 0;
  min-inline-size: 0;
  max-width: 100%;
  max-inline-size: 100%;
  height: 52px !important;
  min-height: 52px !important;
  padding: 0 12px !important;
  line-height: normal !important;
  font-size: 16px;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
/* Safari/iPadOS renders the date as an anonymous WebKit value box. Give that
   inner box the complete height and centre its editable fragments vertically.
   Padding on the native input itself is not sufficient in WebKit. */
main :is(.performance-panel,.performance-form,.performance-area-filter,.report-config-form,.planner-global-filter,.benchmark-monitor-admin,.group-target-admin) input[type="date"]::-webkit-date-and-time-value,
main form.pl-managed-form input[type="date"]::-webkit-date-and-time-value {
  display: flex;
  align-items: center;
  height: 100%;
  min-height: 0;
  line-height: normal;
  text-align: left;
}
main :is(.performance-panel,.performance-form,.performance-area-filter,.report-config-form,.planner-global-filter,.benchmark-monitor-admin,.group-target-admin) input[type="date"]::-webkit-datetime-edit,
main form.pl-managed-form input[type="date"]::-webkit-datetime-edit {
  display: inline-flex;
  align-items: center;
  height: 100%;
  min-height: 0;
  line-height: normal;
  padding: 0;
}
main :is(.performance-panel,.performance-form,.performance-area-filter,.report-config-form,.planner-global-filter,.benchmark-monitor-admin,.group-target-admin) input[type="date"]::-webkit-datetime-edit-fields-wrapper,
main form.pl-managed-form input[type="date"]::-webkit-datetime-edit-fields-wrapper {
  display: inline-flex;
  align-items: center;
  height: 100%;
}

/* Date field labels get precisely the native input width, not a legacy 280px
   grid-cell width. Other selects and wide editorial fields are unaffected. */
main form.pl-managed-form :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5,.benchmark-times,.benchmark-times-wide) > label:has(>input[type="date"]),
main form.pl-managed-form > label:has(>input[type="date"]),
main form.pl-managed-form.bm-point-form > label.pl-benchmark-date,
main form.pl-managed-form :is(.pl-competition-dates,.report-period-config) > label:has(>input[type="date"]) {
  box-sizing: border-box;
  flex: 0 1 168px;
  width: 168px;
  inline-size: 168px;
  min-width: 0;
  min-inline-size: 0;
  max-width: 100%;
  max-inline-size: 100%;
  padding-right: 0;
}
/* Keep the deliberate gap between the two date columns. On very small
   screens the existing wrapping rules still apply. */
main form.pl-managed-form.performance-area-filter-performance .pl-competition-dates {
  grid-template-columns: repeat(2,minmax(0,168px));
  gap: 20px;
  width: min(100%,356px);
  flex-basis: 356px;
}
main form.pl-managed-form.performance-area-filter-performance .pl-competition-dates > label.pl-competition-date {
  width: 168px;
  inline-size: 168px;
  max-width: 100%;
}
main form.pl-managed-form.performance-area-filter-performance .pl-competition-dates > label.pl-competition-date > input[type="date"] {
  width: 168px;
  inline-size: 168px;
  max-width: 100%;
}
@media(max-width:400px) {
  main form.pl-managed-form.performance-area-filter-performance .pl-competition-dates {
    grid-template-columns: minmax(0,168px);
    width: 100%;
    flex-basis: 100%;
  }
}

/* V43: stage-3-specific date rule previously overrode 168px with 176px. */
main form.pl-stage3-form.pl-managed-form label:not(.pl-stage3-editorial) > input[type="date"],
main form.pl-stage3-form.pl-managed-form :is(.form-grid-2,.form-grid-3,.form-grid-4,.form-grid-5) > label > input[type="date"] {
  box-sizing:border-box;width:168px;inline-size:168px;max-width:100%;max-inline-size:100%;
}


/* V45 – Benchmark-Editor: browser-resistant, genuinely short controls.
   Safari on iPad can paint a native date control past its declared CSS box.
   The external painted shell is the visible 164px border and clips the
   native child without changing its type or disabling its date picker.
   All other form components remain on the V44 baseline. */
main form.pl-managed-form.bm-point-form {
  box-sizing:border-box;
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:16px;
  width:100%;max-width:100%;min-width:0;
}
main form.pl-managed-form.bm-point-form > .pl-bm-point-times,
main form.pl-managed-form.bm-point-form > .pl-bm-point-meta {
  box-sizing:border-box;
  display:flex;
  flex-wrap:wrap;
  column-gap:26px;
  row-gap:17px;
  align-items:flex-end;
  justify-content:flex-start;
  width:100%;max-width:100%;min-width:0;
}
main form.pl-managed-form.bm-point-form :is(.pl-bm-point-times,.pl-bm-point-meta) > label {
  box-sizing:border-box;
  display:flex;
  flex-direction:column;
  gap:7px;
  align-items:stretch;
  justify-content:flex-end;
  align-self:flex-end;
  margin:0;padding:0;
  min-width:0;max-width:100%;
}
main form.pl-managed-form.bm-point-form > .pl-bm-point-times > label.pl-benchmark-date {
  flex:0 0 164px;width:164px;max-width:164px;
}
main form.pl-managed-form.bm-point-form > .pl-bm-point-times > label.pl-benchmark-time {
  flex:0 0 124px;width:124px;max-width:124px;
}
main form.pl-managed-form.bm-point-form > .pl-bm-point-meta > label.pl-benchmark-description {
  flex:0 1 240px;width:240px;max-width:min(240px,100%);
}
/* Visible shell: the *native* date's anonymous contents cannot paint
   into the adjacent Top 1 column, even if WebKit imposes intrinsic width. */
main form.pl-managed-form.bm-point-form .pl-benchmark-date > .pl-bm-date-shell {
  display:block;
  box-sizing:border-box;
  position:relative;
  flex:none;
  width:164px;inline-size:164px;
  max-width:100%;min-width:0;
  height:52px;
  overflow:hidden;
  border-radius:11px;
  border:1px solid rgba(155,213,232,.25);
  background:#092f49;
}
main form.pl-managed-form.bm-point-form .pl-benchmark-date > .pl-bm-date-shell:focus-within {
  outline:2px solid #53c6f5;
  outline-offset:2px;
}
main form.pl-managed-form.bm-point-form .pl-benchmark-date .pl-bm-date-shell > input[type="date"] {
  box-sizing:border-box!important;
  display:block!important;
  width:162px!important;inline-size:162px!important;
  min-width:0!important;min-inline-size:0!important;
  max-width:162px!important;max-inline-size:162px!important;
  height:50px!important;min-height:50px!important;
  margin:0!important;
  padding:0 9px!important;
  border:0!important;border-radius:0!important;
  background:transparent!important;color:#fff!important;
  font-size:16px!important;line-height:normal!important;
  overflow:hidden;
}
main form.pl-managed-form.bm-point-form > .pl-bm-point-times > label.pl-benchmark-time > input,
main form.pl-managed-form.bm-point-form > .pl-bm-point-meta > label.pl-benchmark-description > input {
  box-sizing:border-box!important;
  display:block!important;
  flex:none;
  width:100%!important;inline-size:100%!important;
  min-width:0!important;min-inline-size:0!important;
  max-width:100%!important;max-inline-size:100%!important;
  height:52px!important;min-height:52px!important;
  margin:0!important;padding-inline:10px;
}
main form.pl-managed-form.bm-point-form > .pl-bm-point-meta > .bm-form-actions {
  box-sizing:border-box;
  display:flex;flex-wrap:wrap;
  align-items:flex-end;justify-content:flex-start;
  align-self:flex-end;gap:8px;
  width:auto;max-width:100%;min-width:0;
  grid-column:auto;margin:0;padding:0;
}
main form.pl-managed-form.bm-point-form > .pl-bm-point-meta > .bm-form-actions > :is(button,a) {
  box-sizing:border-box;
  display:inline-flex;align-items:center;justify-content:center;
  height:52px!important;min-height:52px!important;margin:0;
}
@media(max-width:390px){
  main form.pl-managed-form.bm-point-form > .pl-bm-point-times > label.pl-benchmark-date,
  main form.pl-managed-form.bm-point-form > .pl-bm-point-times > label.pl-benchmark-time {max-width:100%;}
}
/* Selection action: original 2 selects + a button, aligned by the
   actual 52px control, not font metrics or the parent flex baseline. */
main form.pl-managed-form.bm-select-form {display:flex;flex-wrap:wrap;gap:12px;align-items:end;}
main form.pl-managed-form.bm-select-form > label {
  box-sizing:border-box;flex:0 1 260px;width:260px;max-width:100%;min-width:0;
  margin:0;align-self:end;justify-content:end;
}
main form.pl-managed-form.bm-select-form > label > select {
  box-sizing:border-box;width:100%;min-width:0;max-width:100%;
  height:52px!important;min-height:52px!important;
  margin:0;
}
main form.pl-managed-form.bm-select-form > .pl-bm-select-action {
  display:flex;align-items:end;align-self:end;flex:0 0 auto;
  max-width:100%;min-width:0;padding:0;margin:0;
  grid-column:auto;
}
main form.pl-managed-form.bm-select-form > .pl-bm-select-action > button {
  display:inline-flex;align-items:center;justify-content:center;
  height:52px!important;min-height:52px!important;margin:0;
}

/* V0.15.10.50.40: fix giant vertical gaps in the legacy benchmark form.
   That form also carries bm-point-form but has no .pl-bm-point-times wrapper.
   Explicitly lay its four short fields out as a compact responsive grid. */
main .benchmark-monitor-details form.pl-managed-form.bm-legacy-form.bm-point-form {
  display:grid!important;grid-template-columns:repeat(4,minmax(0,160px))!important;
  grid-auto-rows:min-content!important;align-items:start!important;align-content:start!important;
  justify-content:start!important;gap:13px!important;
  width:100%!important;min-height:0!important;height:auto!important;
  max-width:100%!important;margin:14px 0!important;
}
main .benchmark-monitor-details form.pl-managed-form.bm-legacy-form.bm-point-form > label {
  display:flex!important;flex-direction:column!important;gap:7px!important;
  align-self:start!important;justify-content:start!important;
  width:160px!important;max-width:100%!important;min-width:0!important;
  min-height:0!important;height:auto!important;margin:0!important;padding:0!important;
}
main .benchmark-monitor-details form.pl-managed-form.bm-legacy-form.bm-point-form > label > input {
  box-sizing:border-box!important;height:52px!important;min-height:52px!important;
  width:100%!important;max-width:100%!important;margin:0!important;
}
main .benchmark-monitor-details form.pl-managed-form.bm-legacy-form.bm-point-form > .bm-form-actions {
  grid-column:1 / -1!important;align-self:start!important;justify-content:start!important;
  display:flex!important;gap:10px!important;margin:2px 0 0!important;
}
@media(max-width:760px){main .benchmark-monitor-details form.pl-managed-form.bm-legacy-form.bm-point-form{grid-template-columns:repeat(2,minmax(0,160px))!important}}
@media(max-width:440px){main .benchmark-monitor-details form.pl-managed-form.bm-legacy-form.bm-point-form{grid-template-columns:minmax(0,1fr)!important}}
