/* prehab.css: the Prehab view inside Squad Assessment (pf-).
   Overrides only. The table itself is the Squad Assessment .player-table
   (group row, label row, banded rows, name stack); this file adds the dot
   cells, the L / R sub-line, the sticky name column and the controls row. */

.pf-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 24px;
    margin: 10px 24px 8px;
}

.pf-controls-left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 24px;
}

.pf-legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
    color: var(--text-secondary);
    font-size: var(--type-label);
}

.pf-key {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.pf-key-gap {
    margin-left: 8px;
}

.pf-key .pf-dir {
    color: var(--text-secondary);
}

/* ── direction glyph ── */
.pf-dir {
    display: inline-block;
    width: 6px;
    height: 12px;
    flex: 0 0 auto;
    vertical-align: middle;
    color: var(--text-tertiary);
}

.pf-dir.pf-dir-neg {
    width: 11px;
    height: 11px;
}

/* ── table ── */
.pf-wrap {
    margin-bottom: 0;
    /* Frozen header: the box scrolls, leaving room for the controls below. */
    max-height: calc(100vh - var(--app-header-height) - var(--module-toolbar-height) - 84px);
    overflow: auto;
}

/* "+N" in a group heading: a quiet text handle like the signal lights,
   so the group row keeps Overview's height. */
.pf-more {
    margin-left: 6px;
    padding: 0 4px;
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    letter-spacing: inherit;
    line-height: inherit;
    cursor: pointer;
}

.pf-more:hover,
.pf-more[aria-pressed="true"] {
    color: var(--accent);
}

.pf-more:focus-visible {
    outline: 1px solid var(--focus-ring);
    outline-offset: 1px;
}

.pf-table {
    table-layout: fixed;
}

.pf-sub {
    white-space: nowrap;
}

.pf-name .pf-dir {
    margin-right: 0;
}

.pf-sub > span {
    vertical-align: middle;
}

.pf-table .pf-group-start {
    border-left: 1px solid var(--ink-line);
}

/* Sticky name column: an opaque field under the row's own banding and hover. */
.pf-table th.col-name,
.pf-table td.col-name {
    position: sticky;
    left: 0;
}

/* Status is held beside the name (1A, 11/11). */
.pf-table th.col-status,
.pf-table td.col-status {
    position: sticky;
    left: var(--pf-name-w, 150px);
}

.pf-table thead tr.squad-assessment-group-row th.col-name,
.pf-table thead tr.squad-assessment-group-row th.col-status { z-index: 14; text-align: center; }
.pf-table thead tr.squad-assessment-label-row th.col-name,
.pf-table thead tr.squad-assessment-label-row th.col-status { z-index: 13; }

.pf-table tbody td.col-name,
.pf-table tfoot td.col-name,
.pf-table tbody td.col-status,
.pf-table tfoot td.col-status {
    z-index: 5;
    background-color: var(--surface-page);
}

/* The Testing table scrolls in its own box: its column names stick to the box's top, not under the
   controls row (Testing has none, 31/10). */
.pf-wrap .player-table thead tr.squad-assessment-group-row th {
    top: 0;
}

.pf-wrap .player-table thead tr.squad-assessment-label-row th {
    top: var(--th-group-height);
}

.pf-table tbody tr:nth-child(odd) td.col-name,
.pf-table tbody tr:nth-child(odd) td.col-status {
    background-image: linear-gradient(var(--ink-zebra), var(--ink-zebra));
}

.pf-table tbody tr:hover td.col-name,
.pf-table tbody tr:hover td.col-status {
    background-color: var(--surface-page);
    background-image: linear-gradient(var(--ink-wash), var(--ink-wash));
}

.pf-table td.pf-cell {
    padding: 6px 2px;
}

.pf-mark {
    display: inline-block;
    padding: 4px;
    line-height: 0;
    vertical-align: middle;
}

/* ── cell dots ── */
.pf-dot {
    --pf-c: var(--text-primary);
    display: inline-block;
    width: 11px;
    height: 11px;
    box-sizing: border-box;
    border: 1px solid var(--ink-line-strong);
    border-radius: var(--radius-circle);
    vertical-align: middle;
}

.pf-dot.is-severe {
    --pf-c: var(--status-injured);
}

.pf-dot.is-low {
    background: var(--pf-c);
    border-color: var(--pf-c);
}

.pf-dot.is-side {
    background: linear-gradient(90deg, var(--pf-c) 50%, transparent 50%);
    border-color: var(--pf-c);
}

.pf-dot.is-both {
    background: var(--pf-c);
    border-color: var(--pf-c);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--pf-c) 25%, transparent);
}

.pf-never {
    display: inline-block;
    width: 11px;
    color: var(--text-tertiary);
    font-size: var(--type-body);
    line-height: 11px;
    text-align: center;
    vertical-align: middle;
}

.pf-table td.pf-areas {
    font-weight: 600;
}

/* ── the Players count row ── */
.pf-table tfoot td {
    padding: 8px 2px;
    color: var(--text-secondary);
    font-size: var(--type-label);
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.pf-table tfoot td.col-name {
    padding-left: 10px;
    color: var(--text-tertiary);
    text-align: left;
}

.pf-message {
    margin: 0 24px 24px;
    padding: 48px 0;
    color: var(--text-secondary);
    text-align: center;
}

/* Label row: the name with its direction glyph, then the sub-line, two lines
   high like Readiness. Two-sided qualities read "L 12/10 R" under the pair. */
.pf-name {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

/* L and R on their own line, each centred over its own cell. */
.pf-table thead th .pf-lr {
    display: flex;
    margin-top: 3px;
    color: var(--text-tertiary);
    font-size: var(--type-label);
    font-weight: 400;
    letter-spacing: 0;
}

.pf-table thead th .pf-lr > span {
    flex: 1 1 0;
    text-align: center;
}

.pf-table thead tr.squad-assessment-label-row th.pf-quality {
    padding-left: 2px;
    padding-right: 2px;
}

/* The label row holds two or three lines (name, date, L R): 8 px from the rule above and the one below, as every
   header's text (DESIGN_SYSTEM 5, 10/11); the row grows past --th-height instead of touching its rules. */
.pf-table thead tr.squad-assessment-label-row th {
    padding-top: 8px;
    padding-bottom: 8px;
}

/* The column's full name and tests, opened by clicking its header. */
.pf-container {
    position: relative;
}

.pf-table th.pf-quality {
    cursor: pointer;
}

.pf-table th.pf-quality:hover .pf-name,
.pf-table th.pf-quality:focus-visible .pf-name {
    color: var(--accent);
}

.pf-table th.pf-quality:focus-visible {
    outline: 1px solid var(--focus-ring);
    outline-offset: -2px;
}

.pf-info {
    position: fixed;
    z-index: 120;
    min-width: 220px;
    max-width: 320px;
    padding: 12px 14px;
    background: var(--surface-chrome);
    border: 0;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-pop);
    font-size: var(--type-label);
    color: var(--text-primary);
}

.pf-info-name {
    font-weight: 700;
}

.pf-info-dir {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    color: var(--text-secondary);
}

.pf-info-head {
    margin-top: 10px;
    color: var(--text-tertiary);
    font-size: var(--type-label);
    text-transform: uppercase;
    letter-spacing: calc(0.6px + var(--label-track));
}

.pf-info-tests {
    margin: 4px 0 0;
    padding-left: 16px;
}

/* ── "How flags work" card, opened from the legend ── */
.pf-info.pf-rules {
    width: 600px;
    max-width: calc(100vw - 48px);
    padding: 16px 18px;
}

.pf-rules-table {
    width: 100%;
    margin-top: 10px;
    border-collapse: collapse;
}

.pf-rules-table thead th {
    padding: 0 10px 6px 0;
    color: var(--text-tertiary);
    font-size: var(--type-label);
    font-weight: 400;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: calc(0.6px + var(--label-track));
}

.pf-rules-table thead th.pf-rules-red {
    color: var(--status-injured);
}

.pf-rules-table tbody th,
.pf-rules-table tbody td {
    padding: 6px 10px 6px 0;
    border-top: 1px solid var(--ink-line);
    text-align: left;
    vertical-align: top;
}

.pf-rules-table tbody th {
    font-weight: 600;
    white-space: nowrap;
}

.pf-rules-table td.pf-quiet {
    color: var(--text-tertiary);
}

.pf-rules-table .pf-rules-group td {
    padding-top: 12px;
    border-top-color: var(--ink-line-strong);
    color: var(--text-tertiary);
    font-size: var(--type-label);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: calc(0.6px + var(--label-track));
}

.pf-rules-foot {
    margin-top: 12px;
    color: var(--text-secondary);
}

/* ── cell popover (the attention popover's shell, at-pop) ── */
.pf-handle .pf-dot,
.pf-handle .pf-never { vertical-align: middle; }

.pf-pop {
    width: 660px;
}

/* Title over the test line, so a long name never pushes the season
   switch out of the card. */
.pf-pop-titles {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.pf-pop-head .pf-pop-season {
    flex: none;
}

.pf-pop-head .pf-pop-season {
    margin-left: auto;
}

.pf-pop-tabs {
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.pf-marker {
    width: 9px;
    height: 9px;
    margin-right: 6px;
    fill: currentColor;
    vertical-align: middle;
}

.pf-pop-chart {
    position: relative;
    height: 220px;
}

.pf-pop-legend,
.pf-pop-key {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: var(--type-label);
}

.pf-pop-key {
    align-items: center;
    color: var(--text-tertiary);
}

/* "Show all 12 tests" at the right end of the error key. */
.pf-pop-key .ac-btn {
    margin-left: auto;
}

.pf-lg {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.pf-lg i {
    display: inline-block;
}

.pf-lg-line {
    width: 9px;
    height: 9px;
    border-radius: var(--radius-circle);
    background: var(--c-sel);
}

/* Right: the hollow Rosa square of its points (2A, 11/11). */
.pf-lg-line.is-right {
    border-radius: 0;
    background: transparent;
    box-shadow: inset 0 0 0 1.5px var(--c-sel);
}

.pf-lg-cut {
    width: 16px;
    border-top: 1px dashed var(--c-now);
}


.pf-pop-ext {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    background: var(--ink-zebra);
    color: var(--text-secondary);
    font-size: var(--type-label);
    white-space: nowrap;
}

.pf-pop-ext b {
    color: var(--text-primary);
    font-weight: 700;
}

.pf-pop-table-wrap {
    margin-top: 10px;
    overflow-x: auto;
}

.pf-pop-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--type-label);
    font-variant-numeric: tabular-nums;
}

.pf-pop-table th {
    padding: 0 6px 6px;
    color: var(--text-tertiary);
    font-size: var(--type-label);
    font-weight: 400;
    text-align: left;
    white-space: nowrap;
}

.pf-pop-table td {
    padding: 6px;
    border-top: 1px solid var(--ink-line);
    white-space: nowrap;
}

.pf-pop-table .pf-num {
    text-align: right;
}

.pf-pop-table .is-latest {
    font-weight: 700;
}

.pf-pop-table .pf-quiet {
    color: var(--text-tertiary);
}

.pf-pop-table .is-flag {
    color: var(--text-primary);
    font-weight: 700;
}

.pf-pop-table .is-severe {
    color: var(--status-injured);
    font-weight: 700;
}

/* A flagged number carries its grid dot in front (decision 1A, 2026-10-30). */
.pf-pop-table .pf-value-dot {
    margin-right: 6px;
    vertical-align: 1px;
}

.pf-tag {
    margin-left: 6px;
    color: var(--text-tertiary);
    font-size: var(--type-label);
    font-weight: 400;
}

.pf-tag.is-below {
    color: var(--text-secondary);
}

.is-flag .pf-tag.is-below,
.is-severe .pf-tag.is-below {
    color: inherit;
}

.pf-pop-empty {
    color: var(--text-tertiary);
}


/* A flagged cell with an individual test planned: a small Rosa Palermo dot
   on the flag's corner. */
.pf-dot.is-planned {
    position: relative;
}

.pf-dot.is-planned::after {
    content: "";
    position: absolute;
    top: -4px;
    right: -5px;
    width: 6px;
    height: 6px;
    border-radius: var(--radius-circle);
    background: var(--accent);
    box-shadow: 0 0 0 2px var(--surface-recess);
}

/* ── plan an individual test, in the popover ── */
.pf-planned {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 12px;
    font-size: var(--type-label);
    color: var(--text-secondary);
}

.pf-planned-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pf-planned-dot {
    width: 7px;
    height: 7px;
    border-radius: var(--radius-circle);
    background: var(--accent);
    flex: none;
}

.pf-plan-actions {
    margin-top: 12px;
}

.pf-plan {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--ink-line);
}

.pf-plan-head {
    font-size: var(--type-label);
    color: var(--text-secondary);
}

.pf-plan-head b {
    color: var(--text-primary);
}

.pf-plan-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.pf-plan-label {
    color: var(--text-tertiary);
    font-size: var(--type-label);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: calc(0.6px + var(--label-track));
}

.pf-plan-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) auto minmax(0, 1fr);
    gap: 10px;
    align-items: end;
}

.pf-plan-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.pf-checks td .pf-quiet {
    margin-left: 6px;
    font-size: var(--type-label);
}

.pf-checks td .pf-check-sub {
    display: block;
    margin: 2px 0 0;
}

.pf-check-val {
    margin-right: 8px;
    font-weight: 700;
}

/* ── targets ── */
/* Targets show in the Targets column and the popover, never on a grid dot
   (decision 4B, 2026-10-30). */

.pf-targets-cell {
    text-align: center;
    color: var(--text-secondary);
    font-size: var(--type-label);
    white-space: nowrap;
}

.pf-controls-left .fp-chip {
    margin-left: 16px;
}

.pf-t-icon {
    width: 12px;
    height: 12px;
    flex: none;
    color: var(--accent);
}

.pf-targets {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 10px 0 2px;
}

.pf-target-line {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 30px;
    font-size: var(--type-label);
}

.pf-target-line .pf-t-text {
    flex: 1;
    min-width: 0;
}

.pf-target-line.is-reached .pf-t-icon { color: var(--text-secondary); }

.pf-t-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pf-t-reached {
    font-weight: 600;
    color: var(--text-primary);
}

.pf-t-missed {
    color: var(--status-injured);
}

.pf-plan-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pf-target-grid {
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
}

.pf-t-value {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pf-t-value .ds-input {
    min-width: 0;
    flex: 1;
}

/* A player's target list (Squad Assessment's Testing popover). Targets show only there (Risto 09/11). */
.pf-ir-list {
    order: 2;
    flex-basis: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 0.7fr) minmax(0, 0.9fr);
    column-gap: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--ink-line);
    font-size: var(--type-label);
    color: var(--text-primary);
}

.pf-ir-list[hidden] { display: none; }

.pf-ir-list > span {
    padding: 6px 0;
    border-top: 1px solid var(--ink-line);
}

.pf-ir-list > .pf-ir-h {
    padding: 0 0 6px;
    border-top: 0;
    color: var(--text-tertiary);
    font-size: var(--type-label);
}

/* Targets cell: opens the player's targets. */
.pf-tcell {
    padding: 4px 6px;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.pf-tcell:hover { color: var(--text-primary); }

.pf-tlist {
    min-width: 520px;
    max-width: 620px;
}

.pf-tl-grid {
    margin-top: 10px;
}

.pf-tl-go {
    padding: 6px 0;
    border: 0;
    border-top: 1px solid var(--ink-line);
    background: none;
    font: inherit;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
}

.pf-tl-go:hover { text-decoration: underline; }

/* Target lists size to their text: every cell on one line. */
.pf-ir-list {
    grid-template-columns: repeat(5, max-content);
    column-gap: 0;
}

.pf-ir-list > span,
.pf-ir-list > .pf-tl-go {
    white-space: nowrap;
    padding-right: 28px;
}

.pf-ir-list > :nth-child(5n) { padding-right: 0; }

.pf-tlist {
    width: max-content;
    min-width: 0;
    max-width: calc(100vw - 48px);
}

/* The targets card with Edit and Delete: a fifth column. */
.pf-ir-list.has-actions {
    grid-template-columns: repeat(6, max-content);
    align-items: center;
}

.pf-ir-list.has-actions > :nth-child(5n) { padding-right: 28px; }
.pf-ir-list.has-actions > :nth-child(6n) { padding-right: 0; }

.pf-tl-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Cells stretch to the row's height so every divider sits on one line;
   the text centres inside the cell. */
.pf-ir-list.has-actions {
    align-items: stretch;
}

.pf-ir-list.has-actions > span:not(.pf-ir-h),
.pf-ir-list.has-actions > .pf-tl-go {
    display: flex;
    align-items: center;
}

.pf-ir-list.has-actions > :nth-child(6n) {
    padding-top: 4px;
    padding-bottom: 4px;
}

.pf-tcell {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    line-height: 1.2;
}

.pf-tcell-n {
    color: var(--text-primary);
    font-weight: 700;
}

.pf-tcell-d {
    font-size: var(--type-label);
    color: var(--text-secondary);
}

/* ── the dot tooltip: drawn at once, the colour's reason on the first line ── */
.pf-tip {
    position: fixed;
    z-index: 125;
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-width: 320px;
    box-sizing: border-box;
    padding: 10px 12px;
    background: var(--surface-chrome);
    border: 0;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-pop);
    color: var(--text-secondary);
    font-family: var(--font-system);
    font-size: var(--type-label);
    line-height: 1.4;
    pointer-events: none;
}

.pf-tip[hidden] { display: none; }

.pf-tip b {
    margin-bottom: 2px;
    color: var(--text-primary);
    font-weight: 600;
}

.pf-tip b .is-red {
    color: var(--status-injured);
}

.pf-tip-line {
    display: flex;
    align-items: baseline;
    gap: 7px;
}

.pf-tip-dot {
    flex: none;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-primary);
    transform: translateY(-1px);
}

.pf-tip-dot.is-red {
    background: var(--status-injured);
}

.pf-tip-label {
    color: var(--text-primary);
    white-space: nowrap;
}
