/* ==========================================================================
   Load Model on Squad Assessment (lm-)

   The Current microcycle cell: one mark a day across the microcycle and the
   running figures, which open the player popover's Load tab (attention.css's
   at-pop), where the microcycle block is this file's; a day opens that day's
   metric set on the same surface.

   Geometry and ink only. Every colour is a token; the popover surface, head
   and blocks are attention.css's; the acute:chronic bands are styles.css's.
   ========================================================================== */

/* ── The Load Model part of the Load tab ── */

.lm-session-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 18px;
    align-items: start;
    margin-top: 12px;
}

/* One block takes the whole width. */
.lm-session-layout > .at-block:only-child { grid-column: 1 / -1; }

.lm-session-layout > .at-block + .at-block {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

/* ── The microcycle against the full-match microcycle: small bars, the range
      shaded (option B, 2026-10-15) ── */

.lm-rbar-track {
    position: relative;
    height: 8px;
    margin: 0 3px;
    background: var(--grey-bar);
    border-radius: 4px;
}

.lm-rbar-band {
    position: absolute;
    top: 0;
    bottom: 0;
    background: var(--accent-soft);
    border-radius: 4px;
}

.lm-rbar-mark {
    position: absolute;
    top: -3px;
    width: 4px;
    height: 14px;
    margin-left: -2px;
    background: var(--accent);
    border-radius: 2px;
}

/* The microcycle block is one table under its head line. */
.lm-load { align-items: stretch; }
.lm-load > .at-block { display: flex; flex-direction: column; }
.lm-mc-block { display: flex; flex: 1 1 auto; flex-direction: column; }
.lm-mc-scroll { flex: 1 1 auto; }
.lm-mc-table { height: 100%; }
.lm-mc-table .lm-mc-col-k { width: 17%; }
.lm-mc-table .lm-mc-col-val { width: 22%; }
.lm-mc-table thead th { white-space: nowrap; }
.lm-mc-table td.lm-mc-val { font-weight: 600; }
.lm-mc-table .lm-mc-val .is-low { color: var(--danger); }
.lm-mc-table .lm-mc-val .is-high { color: var(--status-modified); }
.lm-week-table.lm-mc-table td.lm-mc-track { padding-right: 10px; padding-left: 10px; }
.lm-mc-track .lm-rbar-track { display: block; }

/* The key under the bars: what the shading and each mark colour mean. */
.lm-mc-key {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    color: var(--text-secondary);
    font-size: var(--type-label);
}
.lm-mc-key span { display: inline-flex; align-items: center; gap: 6px; }
.lm-mc-key i { display: inline-block; flex: 0 0 auto; }
.lm-mc-key-band { width: 18px; height: 8px; background: var(--accent-soft); border-radius: 4px; }
.lm-mc-key-mark { width: 4px; height: 12px; background: var(--accent); border-radius: 2px; }
.lm-mc-key-mark.is-done { background: var(--text-tertiary); }
.lm-mc-key b { font-weight: 700; }
.lm-mc-key b.is-low { color: var(--danger); }
.lm-mc-key b.is-high { color: var(--status-modified); }

/* Two marks: grey done, accent planned. The number, not the mark, says below or above. */
.lm-rbar-mark.is-done { background: var(--text-tertiary); }
.lm-mbar-note {
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: var(--type-label);
    line-height: 1.4;
}

.lm-week-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 32px;
    margin-bottom: 6px;
}

.lm-week-head .at-block-k { margin: 0; }
.lm-week-scroll { overflow-y: visible; }
.lm-week-table { width: 100%; table-layout: fixed; }
.lm-week-table th,
.lm-week-table td { padding: 0.25rem 0.4rem; font-size: var(--type-label); }
.lm-week-table th:first-child { text-align: left; width: 34%; }
.lm-week-table thead th:not(:first-child),
.lm-week-table td { text-align: right; }
.lm-week-table tbody th { font-weight: 600; }
.lm-week-table tbody td { font-variant-numeric: tabular-nums; }
@media (max-width: 740px) {
    .lm-session-layout { grid-template-columns: 1fr; gap: 10px; }
    .lm-session-layout > .at-block + .at-block {
        padding-top: 10px;
        border-top: 1px solid var(--ink-line);
    }
}

@media (max-width: 520px) {
    .lm-week-table th,
    .lm-week-table td { padding-right: 0.4rem; padding-left: 0.4rem; }
}

/* ── Current microcycle: subtle target, actual bar, then running totals ── */

.player-table td.lm-mc-cell {
    text-align: left;
    padding: 4px 10px 4px 12px;
}

.lm-mc {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.lm-bars {
    display: inline-block;
    width: 112px;
    white-space: nowrap;
    line-height: 0;
}

.lm-bar {
    position: relative;
    display: inline-block;
    height: 30px;
    margin-left: 2px;
    vertical-align: bottom;
    cursor: pointer;
}

.lm-bar i {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: block;
    /* 2 px on the corners away from the axis, square base (02/11 question 36 B). */
    border-radius: var(--radius-bar-top);
}

/* Microcycle bars B (31/10): the plan in the bar grey 242424 behind, what was done in front in 9E9E9E,
   today's done bar white (white = now). */
.lm-bar-target {
    background: var(--grey-bar);
}
.lm-bar-target.is-today { background: var(--grey-bar); }
.lm-bar-done { left: 26%; right: 26%; background: var(--grey-word); }
.lm-bar-done.is-today { background: var(--c-now); }
.lm-bar-done.is-ahead { background: transparent; }
/* A match is an outline: it was not a prescription. */
.lm-bar-match { border: 1px solid var(--grey-word); }
/* A day with nothing: a tick on the baseline. */
.lm-bar-none { height: 1px; border-radius: 0; background: var(--grey-line); }
.lm-bar.is-on i { outline: 1px solid var(--accent); outline-offset: 1px; }

/* The figures are the handle that opens the Load tab. */
.lm-mc-open {
    padding: 2px 4px;
    margin: -2px -4px;
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.lm-mc-open:hover { background: var(--ink-wash); }
.lm-mc-open[aria-expanded="true"] { background: var(--soft-hover, var(--grey-bar)); }
.lm-mc-open:focus-visible { outline: 1px solid var(--focus-ring); outline-offset: 1px; }

/* 38B1 (14/11): the figures are three fixed columns (name, done, ACWR track) shared with the heading
   (.lm-head-cols), so every value sits under its column name. */
.lm-figs {
    display: inline-grid;
    grid-template-columns: 32px 52px 72px;
    column-gap: 12px;
    row-gap: 3px;
    align-items: center;
}

.lm-fig {
    display: contents;
}

.lm-fig-k {
    color: var(--text-tertiary);
    font-size: var(--type-label);
    font-weight: 700;
    letter-spacing: 0.04em;
}

.lm-fig-v {
    color: var(--text-primary);
    font-size: var(--type-label);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

/* 39A (14/11): the player's own target beside Done, in grey, when any player on the page has one. */
.lm-figs.has-target { grid-template-columns: 32px 52px 52px 72px; }

.lm-fig-t {
    color: var(--text-secondary);
    font-size: var(--type-label);
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.lm-figs-none {
    color: var(--text-secondary);
    font-size: var(--type-label);
}

/* The ACWR track: 0 to 2 on a 242424 line, the 0.8 to 1.3 range a short 383838 bar, the ratio a dot in the
   judgement colours (Blu above the range, Rosa Ton below, white inside). */
.lm-acwr {
    position: relative;
    display: block;
    height: 12px;
    cursor: pointer;
}

.lm-acwr::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 5.5px;
    height: 1px;
    background: var(--grey-line);
}

.lm-acwr.is-none {
    height: auto;
    color: var(--text-tertiary);
    font-size: var(--type-label);
    text-align: center;
    cursor: default;
}

.lm-acwr.is-none::before { display: none; }

.lm-acwr-band {
    position: absolute;
    left: 40%;
    width: 25%;
    top: 2px;
    height: 8px;
    background: var(--grey-line);
}

.lm-acwr-dot {
    position: absolute;
    top: 2.5px;
    width: 7px;
    height: 7px;
    margin-left: -3.5px;
    border-radius: var(--radius-circle);
    background: var(--text-primary);
}

.lm-acwr-dot.is-low { background: var(--c-lo); }
.lm-acwr-dot.is-high { background: var(--c-hi); }

.lm-acwr:focus-visible { outline: 1px solid var(--focus-ring); outline-offset: 2px; }
.lm-acwr.is-on .lm-acwr-dot { box-shadow: 0 0 0 2px var(--grey-fill), 0 0 0 3px var(--text-primary); }

/* In the column key: a track at its own width. */
.lm-acwr.is-key { display: inline-block; width: 72px; vertical-align: middle; cursor: default; }

/* The heading's Done and ACWR over their columns: the cell's 12 px inset, the 112 px bars and the 12 px gap
   come first. */
.player-table th.col-microcycle { text-align: left; padding-left: 12px; }
/* One line: the name spans the bars and the measure names, Done and ACWR sit over their columns, every
   name in the column names' own white small capitals (inherited from the header cell). */
.lm-head-cols {
    display: grid;
    grid-template-columns: 158px 52px 72px;
    column-gap: 12px;
    align-items: baseline;
    margin: 0;
    color: inherit;
}
.lm-head-cols.has-target { grid-template-columns: 158px 52px 52px 72px; }
.lm-head-cols span:not(.lm-head-name) { text-align: right; }
.lm-head-cols span:last-child { text-align: center; }
.lm-head-cols .lm-head-name { text-align: left; }
.player-table th.col-microcycle .th-key { width: 100%; padding: 0; text-align: left; }

/* The dot's popover: the measure, then ratio and reading, done, plan (or target). */
.lm-acwr-pop {
    position: fixed;
    z-index: 95;
    min-width: 200px;
    padding: 14px 16px;
}
.lm-acwr-pop .pop-label { margin-bottom: 8px; }
.lm-acwr-pop-grid {
    display: grid;
    grid-template-columns: auto auto;
    column-gap: 18px;
    row-gap: 4px;
    font-size: var(--type-body);
    font-variant-numeric: tabular-nums;
}
.lm-acwr-pop-k { color: var(--text-secondary); }
.lm-acwr-pop-v { text-align: right; color: var(--text-primary); }
.lm-acwr-pop-v.is-low { color: var(--c-lo); font-weight: 600; }
.lm-acwr-pop-v.is-high { color: var(--c-hi); font-weight: 600; }

/* ── The day popover, on attention.css's surface ── */
.lm-day { width: 368px; }

.lm-day-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 3px 0;
    font-size: var(--type-label);
}

.lm-day-row span { flex: 1 1 auto; color: var(--text-secondary); }
.lm-day-row b {
    flex: 0 0 76px;
    text-align: right;
    color: var(--text-primary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.lm-day-row i {
    flex: 0 0 76px;
    text-align: right;
    color: var(--text-tertiary);
    font-style: normal;
    font-variant-numeric: tabular-nums;
}
.lm-day-row strong {
    flex: 0 0 66px;
    text-align: right;
    color: var(--text-secondary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
/* Planned drills: names wrap, never cut (a drill name is what staff read). */
.lm-day-drill span { color: var(--text-primary); overflow-wrap: anywhere; }
.lm-day-drill b { flex: 0 0 44px; }
.lm-day-drill.is-out span,
.lm-day-drill.is-out b { color: var(--text-tertiary); font-weight: 400; }
.lm-day-total { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--ink-line); }
.lm-day-session span { color: var(--text-secondary); font-weight: 600; padding-top: 4px; }
.lm-day-head span,
.lm-day-head b,
.lm-day-head i,
.lm-day-head strong {
    color: var(--text-tertiary);
    font-size: var(--type-label);
    font-weight: 700;
    letter-spacing: calc(0.08em + var(--label-track));
    text-transform: uppercase;
}

/* A 14-inch MacBook is 1512 CSS pixels wide. The default Squad Assessment
   keeps every default column but gives the Load Model cell less intrinsic
   width: a shorter one-cycle strip, a stacked ratio, and tighter figure
   measures. Larger desktops keep the more open geometry above. */
@media (max-width: 1600px) {
    .player-table td.lm-mc-cell { padding-right: 7px; padding-left: 7px; }
    .lm-mc { gap: 8px; }
    .lm-bars { width: 84px; }
    /* The heading follows the narrower inset, bars and gap. */
    .player-table th.col-microcycle { padding-left: 7px; }
    .lm-head-cols { grid-template-columns: 126px 52px 72px; }
    .lm-head-cols.has-target { grid-template-columns: 126px 52px 52px 72px; }
}
