/* ═══════════════════════════════════════════════════════════════════
   POSITIONAL ANALYSIS — Squad Overview (/apex)
   Loaded automatically by Dash (assets/*.css). Owned by the
   Positional Analysis module in pages/overview.py; custom.css is
   owned elsewhere — only OS design tokens are consumed here, never
   redefined.

   Semantic tones (shared with the comparison DataTable's inline
   conditional formatting):
     · green  rgb(var(--os-emerald-rgb)) → optimal   / IN BAND
     · cyan   rgb(var(--os-amber-rgb))   → caution   / BELOW BAND
     · red    rgb(var(--os-rose-rgb))    → risk      / ABOVE BAND
     · gold   rgb(var(--os-accent-rgb))  → primary / actuals (selection)
     · muted  #8A96B4                    → secondary / missing values ("—")

   Every translucent tint resolves from an RGB-channel token, so there
   are no hardcoded colour literals in this file.
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Section panel ─── */
.apex-positional-panel {
    margin-top: var(--os-gap);
}

.apex-positional-copy {
    margin: -8px 0 14px;
    max-width: 78ch;
}

/* Averaging-window caption rendered as the first summary child */
.apex-positional-scope {
    margin-bottom: 10px;
    color: var(--os-muted);
    font-family: var(--os-mono);
    font-size: var(--os-micro);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ─── Unit cards grid (five rugby units + optional Other bucket) ─── */
.apex-positional-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
    gap: var(--os-gap-sm);
}

.apex-positional-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--os-border-lo);
    border-radius: var(--os-radius-sm);
    background: var(--os-surface-inset);
    transition:
        transform var(--os-ease),
        border-color var(--os-ease),
        box-shadow var(--os-ease);
}

.apex-positional-card:hover {
    transform: translateY(-2px);
    border-color: var(--os-border-hi);
}

/* Chip coupling: the selected position-group chip highlights its card */
.apex-positional-card.selected {
    border-color: rgb(var(--os-accent-rgb) / 0.55);
    box-shadow:
        0 0 0 1px rgb(var(--os-accent-rgb) / 0.35),
        var(--os-shadow);
}

/* Muted empty state for units with no sessions in the window */
.apex-positional-card.empty {
    border-style: dashed;
    background: rgb(var(--os-surface-rgb) / 0.55);
}

.apex-positional-card.empty:hover {
    transform: none;
}

.apex-positional-card.empty .apex-positional-unit-name {
    color: var(--os-faint);
}

.apex-positional-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.apex-positional-unit-name {
    overflow: hidden;
    color: var(--os-ink);
    font-family: var(--os-mono);
    font-size: var(--os-title);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.apex-positional-count {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    min-height: 18px;
    padding: 2px 7px;
    border: 1px solid rgb(var(--os-accent-rgb) / 0.2);
    border-radius: var(--os-radius-pill);
    background: rgb(var(--os-accent-rgb) / 0.08);
    color: var(--os-accent-light);
    font-family: var(--os-mono);
    font-size: var(--os-micro);
    font-weight: 600;
    white-space: nowrap;
}

.apex-positional-units-sub {
    margin-top: -4px;
    overflow: hidden;
    color: var(--os-faint);
    font-family: var(--os-mono);
    font-size: var(--os-micro);
    letter-spacing: 0.04em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ─── Metric grid (label + value stacks) ─── */
.apex-positional-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 10px;
}

.apex-positional-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.apex-positional-label {
    overflow: hidden;
    color: var(--os-muted-deep);
    font-family: var(--os-mono);
    font-size: var(--os-micro);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.apex-positional-value {
    overflow: hidden;
    color: var(--os-ink-dim);
    font-family: var(--os-mono);
    font-variant-numeric: tabular-nums;
    font-size: var(--os-delta);
    font-weight: 700;
    letter-spacing: -0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Semantic tones */
.apex-positional-value.accent {
    color: var(--os-accent-light);
}

.apex-positional-value.ok {
    color: var(--os-emerald);
}

.apex-positional-value.caution {
    color: var(--os-amber);
}

.apex-positional-value.risk {
    color: var(--os-rose-light);
}

.apex-positional-value.muted {
    color: var(--os-faint);
}

/* ─── Meters vs target footer ─── */
.apex-positional-target-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    padding-top: 9px;
    border-top: 1px solid var(--os-border-grid);
}

.apex-positional-target-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.apex-positional-pct {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-height: 20px;
    padding: 2px 8px;
    border: 1px solid transparent;
    border-radius: var(--os-radius-pill);
    font-family: var(--os-mono);
    font-variant-numeric: tabular-nums;
    font-size: var(--os-micro);
    font-weight: 700;
    white-space: nowrap;
}

.apex-positional-pct.ok {
    border-color: rgb(var(--os-emerald-rgb) / 0.34);
    background: rgb(var(--os-emerald-rgb) / 0.12);
    color: var(--os-emerald-light);
}

.apex-positional-pct.caution {
    border-color: rgb(var(--os-amber-rgb) / 0.34);
    background: rgb(var(--os-amber-rgb) / 0.12);
    color: var(--os-amber-light);
}

.apex-positional-pct.risk {
    border-color: rgb(var(--os-rose-rgb) / 0.34);
    background: rgb(var(--os-rose-rgb) / 0.12);
    color: var(--os-rose-light);
}

.apex-positional-pct.muted {
    border-color: var(--os-border-lo);
    color: var(--os-faint);
}

/* ─── Muted empty state inside a unit card ─── */
.apex-positional-empty {
    margin-top: 2px;
    color: var(--os-muted-deep);
    font-size: var(--os-micro);
    line-height: 1.5;
}

/* ─── Comparison DataTable ─── */
#apex-positional-table {
    margin-top: var(--os-gap);
}

#apex-positional-table .dash-spreadsheet-container {
    background: transparent;
}

#apex-positional-table td div {
    line-height: 1.2;
}

/* ─── Data-gap alerts ─── */
.apex-positional-warning {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 10px;
}

.apex-positional-gap-line {
    color: var(--os-muted);
    font-size: 11px;
}

.apex-positional-gap-line::before {
    content: "△ ";
    color: var(--os-amber);
    font-size: 10px;
}

/* ─── Responsive tightening ─── */
@media (max-width: 900px) {
    .apex-positional-grid {
        grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    }
}
