/* Student Performance Monitoring.
   Colours follow the SPU Brand Identity Guide (Council-approved, 1 April 2022):
   red Pantone 186 C, orange, beige and navy; black is not a brand colour.
   Red is the dominant identity colour, on white and grey neutrals with an amber accent,
   matching www.spu.ac.za. Institutional palette only; no faculty colours.
   Gotham is the digital typeface; Montserrat is the open substitute, Arial the primary face. */
.spm-workspace{
  --spm-red:#e21937; --spm-red-dark:#b5122c; --spm-orange:#ee5921; --spm-amber:#ffab1f;
  --spm-beige:#f1d5ab; --spm-sand:#e1d3b3;
  --spm-ink:#3d3838; --spm-muted:#666; --spm-line:#e2e2e2; --spm-line-soft:#eee;
  --spm-surface:#fff; --spm-wash:#f5f5f5; --spm-sand-wash:#fbf6ee;
  --spm-on-track:#bbb; --spm-moderate:var(--spm-amber); --spm-high:var(--spm-orange); --spm-critical:var(--spm-red); --spm-none:#d9d4cc;
  --spm-head:'Gotham','Montserrat',Arial,sans-serif; --spm-body:Arial,'Helvetica Neue',sans-serif;
  display:grid; grid-template-columns:minmax(0,1fr); gap:20px; min-width:0; color:var(--spm-ink); font:13px/1.5 var(--spm-body); font-variant-numeric:tabular-nums;
}
.spm-workspace *{box-sizing:border-box}
.spm-workspace>[role=status]:empty{position:absolute; width:1px; height:1px; overflow:hidden}
.spm-workspace h2,.spm-workspace h3{font-family:var(--spm-head); color:var(--spm-ink); letter-spacing:0}
.spm-workspace h2{font-size:16px; font-weight:600; line-height:1.35; margin:0 0 6px}
.spm-workspace h3{font-size:14px; font-weight:600; margin:0 0 6px}
.spm-workspace p{margin:0}
.spm-workspace button,.spm-workspace input,.spm-workspace select{font:inherit}
.spm-workspace :is(button,input,select,summary,a,[tabindex]):focus-visible{outline:2px solid var(--spm-red-dark); outline-offset:2px}
.spm-sr-only{position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0}

/* View switcher and tools */
.spm-toolbar{container-type:inline-size; display:flex; flex-wrap:wrap; justify-content:space-between; align-items:flex-end; gap:0 16px; padding:0 12px; background:var(--spm-surface); border:1px solid var(--spm-line); border-radius:8px}
.spm-toolbar-tools{padding-top:8px; margin-left:auto}
@container (max-width:860px){.spm-tabs small{display:none}}
.spm-tabs{display:flex; flex-wrap:wrap; gap:4px}
.spm-tabs button{position:relative; padding:10px 16px 12px; border:0; background:none; color:var(--spm-muted); font-family:var(--spm-head); font-size:13px; font-weight:600; cursor:pointer}
.spm-tabs button:hover:not(:disabled){color:var(--spm-ink)}
.spm-tabs button[aria-pressed=true]{color:var(--spm-ink)}
.spm-tabs button[aria-pressed=true]::after{content:''; position:absolute; left:12px; right:12px; bottom:-1px; height:3px; background:var(--spm-red)}
.spm-tabs button:disabled{color:#a3a3a3; cursor:not-allowed}
.spm-tabs small{font:400 11px var(--spm-body); color:#8a8a8a; margin-left:4px}
.spm-toolbar-tools{display:flex; gap:8px; align-items:center; padding-bottom:8px}
.spm-toolbar-tools>button,.spm-resources>summary{border:1px solid var(--spm-line); background:var(--spm-surface); color:var(--spm-ink); border-radius:4px; padding:7px 12px; font-size:12px; cursor:pointer; list-style:none}
.spm-resources>summary::-webkit-details-marker{display:none}
.spm-resources{position:relative}
.spm-resources>div{position:absolute; right:0; top:calc(100% + 6px); z-index:20; display:grid; min-width:260px; padding:6px; background:var(--spm-surface); border:1px solid var(--spm-line); border-radius:4px; box-shadow:0 8px 24px rgba(0,0,0,.12)}
.spm-resources a{padding:8px 10px; color:var(--spm-red-dark); text-decoration:none; border-radius:3px}
.spm-resources a:hover{background:var(--spm-wash); text-decoration:underline}
.spm-workspace>p,.spm-note{color:var(--spm-muted); font-size:12px; max-width:95ch}

/* Cohort and filters */
.spm-cohort{border:1px solid var(--spm-line); border-radius:8px; background:var(--spm-surface); min-width:0}
.spm-cohort>summary{display:flex; align-items:center; gap:12px; padding:10px 14px; cursor:pointer; list-style:none}
.spm-cohort>summary::-webkit-details-marker{display:none}
.spm-cohort-label{font-family:var(--spm-head); font-weight:600; color:var(--spm-ink); flex:none}
.spm-cohort-tags{display:flex; flex-wrap:wrap; gap:6px; min-width:0; font-size:12px}
.spm-cohort-tags>span{padding:3px 8px; background:var(--spm-sand-wash); border:1px solid var(--spm-beige); border-radius:3px; overflow-wrap:anywhere}
.spm-cohort-tags b{font-weight:700; margin-right:4px}
.spm-edit-cohort{margin-left:auto; flex:none; color:var(--spm-red-dark); font-size:12px; text-decoration:underline}
.spm-cohort[open] .spm-edit-cohort::after{content:' (close)'; text-decoration:none}
.spm-filter-form{padding:18px 16px; border-top:1px solid var(--spm-line-soft); background:#fcfcfc; border-radius:0 0 8px 8px}
.spm-filter-form summary{cursor:pointer; padding:4px 0 12px; color:var(--spm-red-dark)}
.spm-filter-grid{display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin-bottom:12px}
.spm-filter-grid label{display:grid; gap:4px; font-size:12px; font-weight:700; color:var(--spm-ink)}
.spm-filter-grid input,.spm-filter-grid select{width:100%; min-width:0; padding:7px 8px; border:1px solid #c9c9c9; border-radius:3px; background:#fff; font-weight:400}
.spm-filter-grid select[multiple]{min-height:110px; padding:4px; border-radius:6px; border-color:#d5d5d5; scrollbar-width:thin}
.spm-filter-grid select[multiple] option{padding:5px 8px; border-radius:4px; margin:1px 0; color:var(--spm-ink)}
.spm-filter-grid select[multiple] option:checked{background:#fde3e6 linear-gradient(#fde3e6,#fde3e6); color:var(--spm-red-dark); font-weight:700}
.spm-filter-grid select[multiple]:focus option:checked{background:var(--spm-red) linear-gradient(var(--spm-red),var(--spm-red)); color:#fff}
.spm-filter-grid :is(input,select):focus{border-color:var(--spm-red); outline:2px solid #fde3e6; outline-offset:0}
.spm-filter-form details[open] .spm-filter-grid{max-height:500px; overflow:auto; padding:4px}
.spm-check{display:flex; gap:8px; margin-bottom:12px}
.spm-actions{display:flex; flex-wrap:wrap; gap:10px; align-items:center}
.spm-actions>span{font-size:12px; color:var(--spm-muted)}
.spm-workspace .primary-button{background:var(--spm-red); border:1px solid var(--spm-red); color:#fff; border-radius:4px; padding:8px 16px; font-size:12px; font-weight:700; cursor:pointer}
.spm-workspace .secondary-button,.spm-pagination button{background:#fff; border:1px solid var(--spm-line); color:var(--spm-ink); border-radius:4px; padding:7px 12px; font-size:12px; cursor:pointer}
.spm-workspace button:disabled{opacity:.5; cursor:not-allowed}

/* Status messages */
.spm-error{padding:10px 14px; background:#fdecee; border-left:3px solid var(--spm-red); color:#7d0f1f}
.spm-export-status{padding:8px 14px; font-size:12px; background:var(--spm-sand-wash); border-left:3px solid var(--spm-orange)}
.spm-export-status a{color:var(--spm-red-dark); font-weight:700}

/* Profile distribution: one figure, one table */
.spm-distribution{background:var(--spm-surface); border:1px solid var(--spm-line); border-radius:4px; padding:16px 18px}
.spm-total{font-size:13px; color:var(--spm-muted); margin-bottom:10px}
.spm-total strong{font:600 22px/1 var(--spm-head); color:var(--spm-ink); margin-right:4px}
.spm-dist-bar{display:flex; height:12px; background:var(--spm-line-soft); margin-bottom:12px}
.spm-dist-bar span{display:block; height:100%}
.spm-dist-table{width:100%; max-width:640px; border-collapse:collapse; font-size:13px}
.spm-dist-table th,.spm-dist-table td{padding:7px 10px 7px 0; text-align:right; border-bottom:1px solid var(--spm-line-soft)}
.spm-dist-table thead th{font-size:12px; font-weight:700; color:var(--spm-muted)}
.spm-dist-table th:first-child{text-align:left; font-weight:700}
.spm-dist-table tbody th{font-weight:400}
.spm-dist-table td:last-child{text-align:left; padding-left:16px}
.spm-swatch{display:inline-block; width:10px; height:10px; margin-right:8px; vertical-align:-1px; background:var(--spm-none)}
.spm-text-button{border:0; background:none; padding:0; color:var(--spm-red-dark); text-decoration:underline; cursor:pointer; font-size:12px}
.spm-stats{display:flex; flex-wrap:wrap; gap:0; margin:0; background:var(--spm-surface); border:1px solid var(--spm-line); border-radius:8px}
.spm-stats>div{padding:12px 20px; border-right:1px solid var(--spm-line-soft)}
.spm-stats>div:last-child{border-right:0}
.spm-stats dt{font-size:12px; color:var(--spm-muted)}
.spm-stats dd{margin:2px 0 0; font:600 20px/1.2 var(--spm-head); color:var(--spm-ink)}

/* Dashboard board: panels on a grid, each with one chart */
.spm-board{display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:16px; align-items:stretch}
.spm-board>.spm-programmes{grid-column:1/-1}
.spm-panel{container-type:inline-size; background:var(--spm-surface); border:1px solid var(--spm-line); border-radius:8px; padding:18px 20px; min-width:0; box-shadow:0 1px 2px rgba(0,0,0,.04)}
.spm-panel-head{display:flex; justify-content:space-between; align-items:baseline; gap:12px; flex-wrap:wrap; padding-bottom:12px; margin-bottom:14px; border-bottom:1px solid var(--spm-line-soft)}
.spm-panel-head h2{margin:0}
.spm-panel-head>span{font-size:12px; color:var(--spm-muted)}

.spm-composition{display:flex; flex-direction:column}
.spm-composition-body{flex:1; display:grid; grid-template-columns:180px minmax(0,1fr); gap:24px; align-items:center; align-content:center}
.spm-ring{width:180px; height:180px; display:block}
.spm-ring circle{fill:none; stroke-width:24; transform:rotate(-90deg); transform-origin:90px 90px}
.spm-ring-track{stroke:var(--spm-line-soft)}
.spm-ring-arc{stroke:var(--spm-cat); transition:stroke-width .15s}
.spm-ring-total{font:600 30px var(--spm-head); fill:var(--spm-ink); text-anchor:middle}
.spm-ring-caption{font:12px var(--spm-body); fill:var(--spm-muted); text-anchor:middle}
.spm-legend-list{list-style:none; margin:0; padding:0; display:grid; gap:4px}
.spm-legend-row{position:relative; display:grid; grid-template-columns:12px minmax(0,1fr) auto 52px; align-items:center; gap:12px; width:100%; padding:10px 28px 10px 12px; border:1px solid transparent; border-radius:6px; background:none; color:var(--spm-ink); text-align:left; font-size:13px}
.spm-legend-label{white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
button.spm-legend-row::after{content:'›'; position:absolute; right:10px; top:50%; transform:translateY(-52%); font-size:18px; color:var(--spm-red-dark); opacity:0; transition:opacity .15s}
button.spm-legend-row:is(:hover,:focus-visible)::after{opacity:1}
button.spm-legend-row{cursor:pointer}
button.spm-legend-row:hover{background:var(--spm-cat-wash); border-color:var(--spm-cat)}
.spm-legend-row .spm-swatch{width:12px; height:12px; border-radius:2px; margin:0; background:var(--spm-cat)}
.spm-legend-row strong{font:600 18px var(--spm-head); text-align:right}
.spm-legend-share{color:var(--spm-muted); text-align:right}
.spm-level-grid{display:grid; grid-template-columns:max-content minmax(0,1fr) max-content; column-gap:14px; row-gap:10px; align-items:center}
.spm-level-row{display:contents}
.spm-level-name{font-size:13px; font-weight:700; white-space:nowrap}
.spm-level-key{font-size:12px; color:var(--spm-muted); text-align:right; white-space:nowrap}
.spm-level-key strong{font:600 15px var(--spm-head); color:var(--spm-ink)}
.spm-stack{display:flex; height:28px; border-radius:4px; overflow:hidden; background:var(--spm-line-soft)}
.spm-stack>:is(span,button){display:flex; align-items:center; justify-content:center; min-width:0; border:0; padding:0; font:700 11px var(--spm-body); color:var(--spm-cat-text); background:var(--spm-cat); overflow:hidden; white-space:nowrap}
.spm-stack>button{cursor:pointer}
.spm-stack>button:hover{filter:brightness(.92)}
.spm-stack>:is(span,button)+:is(span,button){box-shadow:inset 1px 0 0 #fff}

/* Programme ranking: one governed share per programme, read against the all-programmes share.
   Rows touch so the navy reference line runs unbroken down the chart. */
.spm-fail-chart{--spm-ref-colour:#283097; --spm-fail-cols:28px minmax(200px,42%) minmax(120px,1fr) 76px}
.spm-fail-axis,.spm-fail-row{display:grid; grid-template-columns:var(--spm-fail-cols); column-gap:16px}
.spm-fail-axis{padding:0 8px}
.spm-fail-scale{position:relative; display:flex; justify-content:space-between; align-items:flex-end; min-height:34px; padding-bottom:4px; font-size:11px; color:var(--spm-muted)}
.spm-fail-ref-label{position:absolute; top:0; left:var(--spm-ref); transform:translateX(-50%); white-space:nowrap; font:600 12px var(--spm-head); color:var(--spm-ref-colour)}
.spm-fail-ref-label.is-start{transform:translateX(-2px)}
.spm-fail-ref-label.is-end{transform:translateX(calc(-100% + 2px))}
.spm-fail-list{list-style:none; margin:0; padding:0; border-top:1px solid var(--spm-line)}
.spm-fail-list li+li{border-top:1px solid var(--spm-line-soft)}
.spm-fail-row{width:100%; min-height:54px; padding:0 8px; border:0; border-radius:4px; background:none; color:var(--spm-ink); text-align:left; cursor:pointer}
.spm-fail-row>:not(.spm-fail-track){align-self:center}
.spm-fail-row:hover{background:var(--spm-sand-wash)}
.spm-fail-row:hover .spm-fail-name{color:var(--spm-red-dark); text-decoration:underline; text-underline-offset:3px}
.spm-fail-pos{font:600 13px var(--spm-head); color:var(--spm-muted); text-align:right}
.spm-fail-label{display:flex; flex-direction:column; gap:2px; min-width:0; padding:9px 0}
.spm-fail-name{font-size:13px; font-weight:600; line-height:1.3; overflow-wrap:anywhere}
.spm-fail-count{font-size:12px; color:var(--spm-muted)}
.spm-fail-track{position:relative; display:flex; align-items:center}
.spm-fail-track::before{content:''; position:absolute; left:0; right:0; top:50%; height:12px; transform:translateY(-50%); background:var(--spm-wash)}
.spm-fail-bar{position:relative; height:12px; background:var(--spm-red)}
/* A withheld share has no track, so an empty bar cannot be read as zero */
.spm-fail-row:not(.is-shown) .spm-fail-track::before{display:none}
.has-ref :is(.spm-fail-track,.spm-fail-scale)::after{content:''; position:absolute; left:var(--spm-ref); top:0; bottom:0; margin-left:-1px; border-left:2px solid var(--spm-ref-colour)}
.has-ref .spm-fail-scale::after{top:20px}
.spm-fail-value{font:600 16px var(--spm-head); text-align:right; white-space:nowrap}
/* No recorded outcome: a dotted label where the bar would be, never an empty 0% track */
.spm-fail-none{position:relative; display:inline-block; padding:3px 8px; border:1px dotted var(--spm-muted); font-size:12px; line-height:1.3; color:var(--spm-ink); background:#fff}
.spm-fail-row:not(.is-shown) .spm-fail-value{font:12px var(--spm-body); color:var(--spm-muted)}
@container (max-width:560px){
  .spm-fail-chart{--spm-fail-cols:20px minmax(0,1fr) 64px}
  .spm-fail-axis{padding:0 4px}
  .spm-fail-axis>span:nth-child(2){display:none}
  .spm-fail-row{grid-template-areas:"pos label label" ". track value"; row-gap:4px; padding:10px 4px; min-height:0}
  .spm-fail-row>.spm-fail-pos{grid-area:pos; align-self:start; padding-top:1px}
  .spm-fail-label{grid-area:label; padding:0}
  .spm-fail-track{grid-area:track; min-height:16px}
  .spm-fail-value{grid-area:value; font-size:15px}
}

.spm-withheld-group{margin-top:14px; padding:14px 16px; border-radius:6px; background:repeating-linear-gradient(135deg,#fafafa 0 8px,#f3f3f3 8px 9px); border:1px dashed #d6d6d6}
.spm-withheld-group p{font-size:12px; color:var(--spm-muted); margin-bottom:10px}
.spm-withheld-group strong{color:var(--spm-ink)}
.spm-chip-row{display:flex; flex-wrap:wrap; gap:6px}
.spm-chip{padding:5px 10px; border:1px solid var(--spm-line); border-radius:999px; background:#fff; color:var(--spm-ink); font-size:12px}
button.spm-chip{cursor:pointer}
.spm-tabs{flex-wrap:nowrap}
.spm-tabs button{white-space:nowrap}
body.spu-experience .spm-workspace .spm-results :is(th,td){white-space:nowrap}
body.spu-experience .spm-workspace .spm-results td:has(.spm-advice){white-space:normal}
/* Long names wrap so the count columns stay on screen at laptop widths */
body.spu-experience .spm-workspace .spm-results td.spm-wrap{white-space:normal; min-width:200px}
button.spm-chip:hover{border-color:var(--spm-red); color:var(--spm-red-dark)}

@container (max-width:470px){
  .spm-composition-body{grid-template-columns:1fr; justify-items:center; gap:16px}
  .spm-legend-list{width:100%}
}
@container (max-width:420px){
  .spm-level-grid{grid-template-columns:minmax(0,1fr) max-content}
  .spm-level-name{grid-column:1/-1}
}
/* Ring: hovering a legend row isolates its arc */
.spm-composition:has(.spm-legend-list li:hover) .spm-ring-arc{opacity:.25}
.spm-composition:has(li[data-category="On Track"]:hover) .spm-ring-arc[data-category="On Track"],
.spm-composition:has(li[data-category="Moderate Risk"]:hover) .spm-ring-arc[data-category="Moderate Risk"],
.spm-composition:has(li[data-category="High Risk"]:hover) .spm-ring-arc[data-category="High Risk"],
.spm-composition:has(li[data-category="Critical Risk"]:hover) .spm-ring-arc[data-category="Critical Risk"]{opacity:1; stroke-width:30}
.spm-ring-arc{transition:opacity .15s,stroke-width .15s}

/* Evidence summary band */
.spm-summary{display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); grid-template-rows:auto auto auto 1fr; row-gap:0; background:var(--spm-surface); border:1px solid var(--spm-line); border-radius:8px; box-shadow:0 1px 2px rgba(0,0,0,.04); overflow:hidden}
.spm-summary-item{display:grid; grid-row:span 4; grid-template-rows:subgrid; grid-template-columns:minmax(0,1fr); row-gap:8px; align-content:start; min-width:0; padding:20px 22px; border-left:1px solid var(--spm-line-soft)}
.spm-summary-item>:last-child:not(h3):not(p){align-self:end}
.spm-summary-item:first-child{border-left:0}
.spm-summary-item h3{margin:0; font:700 12px var(--spm-body); color:var(--spm-muted)}
.spm-summary-value{margin:2px 0 0; font:600 40px/1 var(--spm-head); color:var(--spm-ink); letter-spacing:-.01em}
.spm-summary-item.is-review .spm-summary-value{color:var(--spm-red)}
.spm-summary-value.is-withheld{font-size:18px; color:var(--spm-muted)}
.spm-summary-note{margin:0; font-size:12px; line-height:1.45; color:var(--spm-muted)}
.spm-strip{display:block; width:100%; height:38px; padding-top:6px; overflow:visible}
.spm-strip-bg{fill:var(--spm-wash)}
.spm-strip line{stroke:var(--spm-red); stroke-opacity:.45; stroke-width:1; vector-effect:non-scaling-stroke}
.spm-strip text{font:9px var(--spm-body); fill:var(--spm-muted)}
.spm-gauge-wrap{position:relative; width:150px; max-width:100%; margin:2px 0 0}
.spm-gauge{display:block; width:100%; height:auto}
.spm-gauge path{fill:none; stroke-width:12; stroke-linecap:round}
.spm-gauge-track{stroke:var(--spm-line-soft)}
.spm-gauge-wrap.is-withheld .spm-gauge-track{stroke:#e6e6e6; stroke-dasharray:3 5; stroke-linecap:butt}
.spm-gauge-fill{stroke:var(--spm-red)}
.spm-gauge-wrap strong{position:absolute; left:0; right:0; bottom:2px; text-align:center; font:600 26px/1 var(--spm-head); color:var(--spm-ink)}
.spm-gauge-wrap.is-withheld strong{font-size:15px; color:var(--spm-muted)}
.spm-pill-link{justify-self:start; white-space:nowrap; display:inline-flex; align-items:center; gap:6px; padding:6px 12px; border:1px solid var(--spm-red); border-radius:999px; background:#fff; color:var(--spm-red-dark); font-size:12px; font-weight:700; cursor:pointer; transition:background .15s,color .15s}
.spm-pill-link:hover{background:var(--spm-red); color:#fff}

/* Resting side panel: lowest disclosed values */
.spm-lowest{background:var(--spm-surface); padding:18px 18px 10px}
.spm-lowest .spm-panel-head{margin-bottom:6px}
.spm-lowest ol{list-style:none; margin:0; padding:0}
.spm-lowest li+li{border-top:1px solid var(--spm-line-soft)}
.spm-lowest button{position:relative; display:grid; grid-template-columns:20px minmax(0,1fr) auto; gap:10px; align-items:center; width:100%; padding:10px 6px 14px; border:0; background:none; text-align:left; cursor:pointer; border-radius:6px}
.spm-lowest button:hover{background:var(--spm-wash)}
.spm-lowest-rank{font:600 13px var(--spm-head); color:var(--spm-muted)}
.spm-lowest-name{min-width:0}
.spm-lowest-name b{display:block; font-size:12px; color:var(--spm-ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.spm-lowest-name small{display:block; font-size:11px; color:var(--spm-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.spm-lowest-value{font:600 15px var(--spm-head); color:var(--spm-red)}
.spm-lowest button i{position:absolute; left:36px; right:6px; bottom:6px; height:3px; max-width:calc(100% - 42px); background:var(--spm-red); border-radius:2px; opacity:.55}

/* Selected evidence card */
.spm-evidence-detail:not(.spm-lowest):not(.spm-empty-detail){background:#fff; padding:20px 22px}
.spm-evidence-detail:not(.spm-lowest) h3{font-size:22px; margin-bottom:2px}
.spm-evidence-detail .spm-detail-metrics{display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:10px; margin:14px 0}
.spm-evidence-detail .spm-detail-metrics>div{display:grid; align-content:start; gap:4px; padding:12px 14px; border:1px solid var(--spm-line-soft); border-radius:6px; background:var(--spm-wash)}
.spm-evidence-detail .spm-detail-metrics dd{font:600 24px/1.1 var(--spm-head); color:var(--spm-ink)}
.spm-meter{display:block; height:5px; margin-top:6px; border-radius:3px; background:#e4e4e4; overflow:hidden}
.spm-meter i{display:block; height:100%; background:var(--spm-red); border-radius:3px}
.spm-detail-dates{display:flex; flex-wrap:wrap; gap:6px 20px; font-size:12px; color:var(--spm-muted)}
.spm-detail-dates b{color:var(--spm-ink); font-weight:700; margin-left:4px}

/* Report cells with a slim value bar */
.spm-cell-bar{display:grid; gap:3px; min-width:70px}
.spm-cell-bar i{display:block; height:3px; border-radius:2px; background:var(--spm-red); opacity:.5}

/* View switcher: segmented control */
.spm-views{display:inline-flex; flex-wrap:wrap; gap:2px; justify-self:start; padding:3px; background:#ececec; border-radius:8px}
.spm-views button{padding:7px 14px; border:0; border-radius:6px; background:transparent; color:var(--spm-muted); font-size:12px; font-weight:700; cursor:pointer}
.spm-views button:hover{color:var(--spm-ink)}
.spm-views button[aria-pressed=true]{background:#fff; color:var(--spm-red-dark); box-shadow:0 1px 3px rgba(0,0,0,.12)}

/* Lollipop ranking: label | track with stem and dot | value. Rows touch so grid and threshold lines run unbroken. */
.spm-module-ranking{margin-top:16px}
.spm-lolli-axis,.spm-lolli{display:grid; grid-template-columns:minmax(0,10.5rem) minmax(0,1fr) 3.75rem; column-gap:12px; align-items:center}
.spm-lolli-axis{height:20px}
.spm-lolli-scale{position:relative; height:100%}
.spm-lolli-scale b{position:absolute; top:2px; transform:translateX(-50%); font:400 11px var(--spm-body); color:var(--spm-muted); white-space:nowrap}
.spm-lolli-scale b:first-child{transform:none}
.spm-lolli-scale b:last-child{transform:translateX(-100%)}
.spm-lolli-list{list-style:none; margin:0; padding:0}
.spm-lolli{width:100%; min-height:26px; padding:0 4px; border:0; border-radius:0; background:transparent; color:var(--spm-ink); font:inherit; text-align:left; cursor:pointer}
.spm-lolli:is(:hover,:focus-visible,.is-selected){background:var(--spm-wash)}
.spm-lolli:focus-visible{outline:2px solid var(--spm-red-dark); outline-offset:-2px}
.spm-lolli-label{font-size:12px; font-weight:700; text-align:right; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.spm-lolli-track{position:relative; align-self:stretch; background:linear-gradient(to right,var(--spm-line-soft) 1px,transparent 1px) 0 0/25% 100%; border-right:1px solid var(--spm-line-soft)}
.spm-lolli-track::after{content:""; position:absolute; top:0; bottom:0; left:85%; border-left:1.5px dashed var(--spm-orange)}
.spm-lolli-track i{position:absolute; left:0; top:50%; height:3px; margin-top:-1.5px; border-radius:2px; background:#cfcfcf}
.spm-lolli-track i::after{content:""; position:absolute; right:-6px; top:50%; width:12px; height:12px; margin-top:-6px; border-radius:50%; background:var(--spm-red); box-shadow:0 0 0 2px #fff; z-index:1}
.spm-lolli:is(:hover,:focus-visible,.is-selected) .spm-lolli-track i::after{background:var(--spm-amber); width:16px; height:16px; right:-8px; margin-top:-8px}
.spm-lolli-value{font:600 12px var(--spm-head); text-align:right}
/* Phones: label and value on one line, the bar across the full width beneath them */
@media (max-width:560px){
  .spm-lolli-axis{grid-template-columns:0 minmax(0,1fr) 0; column-gap:0; padding:0 4px}
  .spm-lolli{grid-template-columns:minmax(0,1fr) auto; grid-template-areas:"label value" "track track"; row-gap:2px; padding:5px 4px 0}
  .spm-lolli-label{grid-area:label; text-align:left; white-space:normal}
  .spm-lolli-value{grid-area:value}
  .spm-lolli-track{grid-area:track; height:16px}
}

/* Scatter: softer frame, clearer points */
.spm-landscape-card .spm-landscape{background:linear-gradient(#fff,#fff) padding-box}
.spm-plot-point circle{fill-opacity:.55}

/* Category colours, shared by every chart, table and badge */
[data-category="On Track"]{--spm-cat:var(--spm-on-track); --spm-cat-text:#3d3838; --spm-cat-wash:#f0f0f0}
[data-category="Moderate Risk"]{--spm-cat:var(--spm-moderate); --spm-cat-text:#4a3000; --spm-cat-wash:#fff1d6}
[data-category="High Risk"]{--spm-cat:var(--spm-high); --spm-cat-text:#6b2208; --spm-cat-wash:#fde3d7}
[data-category="Critical Risk"]{--spm-cat:var(--spm-critical); --spm-cat-text:#fff; --spm-cat-wash:#fbdde2}
[data-category="No Results Available"]{--spm-cat:var(--spm-none); --spm-cat-text:#3d3a33; --spm-cat-wash:#f2efe9}
.spm-dist-bar [data-category],.spm-stack [data-category]{background:var(--spm-cat)}
.spm-dist-table tr[data-category] .spm-swatch{background:var(--spm-cat)}
.spm-legend span,.spm-badge{display:inline-block; padding:2px 7px; border-radius:3px; font-size:11px; background:var(--spm-cat-wash,#eee); color:#3d3838; border-left:4px solid var(--spm-cat,#ccc)}

/* Charts */
.spm-chart,.spm-results{background:var(--spm-surface); border:1px solid var(--spm-line); border-radius:8px; padding:18px 20px; min-width:0; box-shadow:0 1px 2px rgba(0,0,0,.04)}
.spm-chart>p{font-size:12px; color:var(--spm-muted); max-width:90ch; margin-bottom:10px}
.spm-chart-note{font-size:11px; color:var(--spm-muted); margin-top:10px}
.spm-legend{display:flex; flex-wrap:wrap; gap:6px; margin:10px 0 12px}
.spm-comparisons{display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:20px; align-items:start}
.spm-programme-row{padding:8px 0; border-top:1px solid var(--spm-line-soft)}
.spm-programme-row>div:first-child{display:flex; gap:10px; align-items:baseline; margin-bottom:6px}
.spm-programme-row button{border:0; background:none; padding:0; text-align:left; color:var(--spm-red-dark); text-decoration:underline; cursor:pointer; font-size:12px}
.spm-stack{display:flex; min-height:20px; background:var(--spm-line-soft); overflow:hidden}
.spm-programme-row .spm-stack{margin-left:28px}
.spm-stack span{display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:700; color:var(--spm-cat-text,#3d3838)}
.spm-stack-row{display:grid; grid-template-columns:minmax(180px,1fr) 2fr; gap:16px; align-items:center; margin:10px 0; font-size:12px}
.spm-withheld{width:100%; color:var(--spm-muted); background:repeating-linear-gradient(135deg,#f4f4f4 0 6px,#e9e9e9 6px 7px)!important}
.spm-heatmap-wrap{overflow-x:auto}
.spm-heatmap{width:100%; border-collapse:collapse; font-size:12px}
.spm-heatmap th{font-weight:700; font-size:11px; color:var(--spm-muted); padding:6px; text-align:center}
.spm-heatmap th[scope=row]{text-align:left; color:var(--spm-ink); white-space:nowrap}
.spm-heatmap td{padding:2px; min-width:64px}
.spm-heatmap button{width:100%; min-height:48px; padding:6px 4px; border:1px solid var(--spm-line-soft); cursor:pointer; color:#3d3838;
  background:color-mix(in srgb,var(--spm-cat,#ccc) var(--spm-cell-share,12%),white)}
.spm-heatmap strong{display:block; font-size:14px}
.spm-heatmap small{display:block; font-size:11px; color:var(--spm-muted)}
.spm-heat-empty{display:grid; place-items:center; min-height:48px; background:#f4f4f4; color:var(--spm-muted); font-size:11px}
.spm-bar{display:grid; grid-template-columns:minmax(180px,1fr) 2fr 60px; gap:12px; align-items:center; margin:8px 0; font-size:12px}
.spm-bar>div{height:12px; background:var(--spm-line-soft)}
.spm-bar i{display:block; height:100%; background:var(--spm-red)}

/* Module and assessment landscape */
.spm-landscape-layout{display:grid; grid-template-columns:minmax(0,1.7fr) minmax(250px,1fr); gap:16px; align-items:stretch}
.spm-landscape-layout:has(>:only-child){grid-template-columns:minmax(0,1fr)}
.spm-landscape{display:block; width:100%; height:auto; margin-top:10px; overflow:visible}
.spm-landscape text{font:12px var(--spm-body); fill:var(--spm-muted)}
.spm-landscape .spm-axis-title{fill:var(--spm-ink); font-weight:700; font-size:13px}
.spm-grid-line{stroke:var(--spm-line-soft)}
.spm-review-zone{fill:#fdf1ec}
.spm-threshold{stroke:var(--spm-orange); stroke-dasharray:5 4}
.spm-landscape .spm-threshold-label{fill:#b8400f}
.spm-plot-point{cursor:pointer; outline:none}
.spm-plot-point circle{fill:var(--spm-red); fill-opacity:.65; stroke:#fff; stroke-width:1.5}
.spm-plot-point:is(:hover,:focus-visible,.is-selected) circle{fill:var(--spm-amber); fill-opacity:1; stroke:var(--spm-ink); stroke-width:2}
.spm-evidence-detail{position:relative; min-width:0; padding:18px; background:var(--spm-wash); border:1px solid var(--spm-line); border-radius:4px}
.spm-evidence-detail h3{font-size:18px}
.spm-detail-name{font-size:12px}
.spm-context-pills{display:flex; flex-wrap:wrap; gap:6px; margin:10px 0}
.spm-context-pills span{font-size:11px; padding:2px 7px; border:1px solid var(--spm-line); border-radius:3px; background:#fff}
.spm-evidence-detail dl,.spm-support-detail dl{margin:12px 0}
.spm-evidence-detail dl>div,.spm-support-detail dl>div{display:flex; justify-content:space-between; align-items:baseline; gap:12px; padding:7px 0; border-bottom:1px solid var(--spm-line)}
.spm-evidence-detail dt,.spm-support-detail dt{font-size:12px; color:var(--spm-muted)}
.spm-evidence-detail dd,.spm-support-detail dd{margin:0; font:600 16px var(--spm-head); color:var(--spm-ink)}
.spm-detail-dates{font-size:11px; color:var(--spm-muted)}
.spm-detail-close{position:absolute; top:10px; right:10px; width:26px; height:26px; border:1px solid var(--spm-line); border-radius:3px; background:#fff; color:var(--spm-ink); font-size:16px; cursor:pointer}
.spm-workspace :is(.spm-action-link,.spm-record-link){border:0; background:none; padding:0; text-align:left; color:var(--spm-red-dark); text-decoration:underline; cursor:pointer; font-size:12px; font-weight:700}
.spm-empty-detail p{font-size:12px; color:var(--spm-muted)}
.spm-empty{padding:20px 14px; border:1px dashed var(--spm-line); color:var(--spm-muted); font-size:12px}

/* Report table */
.spm-result-heading{display:flex; flex-wrap:wrap; gap:8px; align-items:center}
.spm-result-heading h2{margin:0 auto 0 0}
.spm-results>p{font-size:12px; color:var(--spm-muted); margin-top:6px}
.spm-table-tools{display:flex; flex-wrap:wrap; gap:16px; align-items:end; margin:12px 0; padding:10px 12px; background:var(--spm-wash); border-radius:4px}
.spm-table-tools label{display:grid; gap:4px; font-size:12px; font-weight:700}
.spm-table-tools input,.spm-table-tools select{padding:6px 8px; border:1px solid #c9c9c9; border-radius:3px; font-weight:400}
.spm-table-tools>span{max-width:55ch; font-size:12px; color:var(--spm-muted)}
.spm-results .table-wrap{max-height:620px; overflow:auto; border:1px solid var(--spm-line-soft)}
.spm-results table{width:100%; border-collapse:collapse; font-size:12px}
.spm-results th,.spm-results td{padding:8px 10px; text-align:left; border-bottom:1px solid var(--spm-line-soft); min-width:72px; max-width:420px}
.spm-results th{position:sticky; top:0; z-index:1; background:#f2f2f2; color:var(--spm-ink); font:700 12px var(--spm-body); text-transform:none; letter-spacing:0}
.spm-results th button{border:0; background:none; padding:0; color:inherit; font:inherit; text-align:left; cursor:pointer}
.spm-results th[aria-sort=ascending] button::after{content:' ↑'}
.spm-results th[aria-sort=descending] button::after{content:' ↓'}
.spm-results th input{display:block; width:100%; min-width:52px; margin-top:6px; padding:4px 6px; border:1px solid #c9c9c9; border-radius:3px; font-weight:400}
.spm-results td:first-child,.spm-results th:first-child{position:sticky; left:0; background:#fff}
.spm-results th:first-child{background:#f2f2f2; z-index:3}
.spm-results:has([data-column="student_number"]) :is(td,th):first-child{position:static}
.spm-results [data-column="student_number"]{position:sticky; left:0; min-width:160px; width:160px; background:#fff; z-index:2}
.spm-results [data-column="student_full_name"]{position:sticky; left:var(--spm-identity-width,160px); min-width:200px; background:#fff; z-index:2}
.spm-results th:is([data-column="student_number"],[data-column="student_full_name"]){background:#f2f2f2; z-index:4}
.spm-results tbody tr:hover td{background:var(--spm-wash)}
.spm-results .spm-record-link{white-space:nowrap}
.spm-resize{position:absolute; top:0; right:0; bottom:0; width:7px; cursor:col-resize; touch-action:none}
.spm-pagination{margin-top:12px}
.spm-advice{min-width:320px; padding:10px; border-left:3px solid var(--spm-red-dark); background:var(--spm-sand-wash); white-space:normal}
.spm-advice[data-urgency="urgent_review"]{border-left-color:var(--spm-red); background:#fdecee}
.spm-advice ul{margin:0 0 8px; padding-left:18px}
.spm-advice small{display:block; margin-top:6px; color:var(--spm-muted)}

/* Support conversation (approved advisor roles) */
.spm-support-detail{display:grid; grid-template-columns:1fr 1fr; gap:20px; padding:20px; background:#fff; border:1px solid var(--spm-line); border-radius:4px}
.spm-support-detail h2{font-size:18px}
.spm-support-detail p{font-size:12px}
.spm-support-detail>div>button{margin-top:8px; padding:6px 12px; border:1px solid var(--spm-line); border-radius:4px; background:#fff; color:var(--spm-ink); font-size:12px; cursor:pointer}
.spm-profile-pair{display:grid; grid-template-columns:1fr 1fr; gap:10px}
.spm-profile-period{display:grid; gap:4px; padding:12px; background:var(--spm-wash); border-left:3px solid var(--spm-red-dark)}
.spm-profile-period>span,.spm-profile-period small{font-size:11px; color:var(--spm-muted)}
.spm-profile-period strong{font:600 16px var(--spm-head); color:var(--spm-ink)}
.spm-support-proposal{padding:14px; background:var(--spm-sand-wash); border-left:3px solid var(--spm-red-dark)}
.spm-support-proposal li{font-size:12px; margin:4px 0}
.spm-support-proposal strong{font-size:12px}

/* The shell styles every table (uppercase 9px headers, tinted header row, 16px cells).
   Reset that inside this workspace so the rules above apply. */
body.spu-experience .spm-workspace :is(th,td){font:400 12px/1.45 var(--spm-body); letter-spacing:0; text-transform:none; color:var(--spm-ink); background:transparent; padding:7px 10px; border:0; border-bottom:1px solid var(--spm-line-soft)}
body.spu-experience .spm-workspace thead th{font-weight:700; color:var(--spm-muted)}
body.spu-experience .spm-workspace .spm-dist-table :is(th,td){padding:7px 10px 7px 0; font-size:13px}
body.spu-experience .spm-workspace .spm-dist-table :is(td,thead th:not(:first-child)){text-align:right}
body.spu-experience .spm-workspace .spm-dist-table td:last-child{text-align:left; padding-left:16px}
body.spu-experience .spm-workspace .spm-results thead th{position:sticky; top:0; z-index:1; background:#f2f2f2; color:var(--spm-ink); padding:8px 10px}
body.spu-experience .spm-workspace .spm-results tbody td{background:#fff}
body.spu-experience .spm-workspace .spm-results tbody tr:hover td{background:var(--spm-wash)}
body.spu-experience .spm-workspace .spm-results :is(th,td)[data-column="student_number"],body.spu-experience .spm-workspace .spm-results :is(th,td)[data-column="student_full_name"]{background:#fff}
body.spu-experience .spm-workspace .spm-results thead th:is([data-column="student_number"],[data-column="student_full_name"],:first-child){background:#f2f2f2}
body.spu-experience .spm-workspace tbody tr:nth-child(even) :is(th,td){background:transparent}
body.spu-experience .spm-workspace .spm-results tbody tr:nth-child(even) td{background:#fff}
body.spu-experience .spm-workspace .spm-results tbody tr:hover td{background:var(--spm-wash)}
.spm-badge{white-space:nowrap}
body.spu-experience .spm-workspace tbody tr:hover :is(th,td){background:var(--spm-wash)}
.spm-toolbar-tools>button,.spm-resources>summary{white-space:nowrap}
body.spu-experience .spm-workspace .spm-heatmap :is(th,td){border:0; padding:2px}
body.spu-experience .spm-workspace .spm-heatmap thead th{padding:6px; text-align:center; font-size:11px}
body.spu-experience .spm-workspace .spm-heatmap th[scope=row]{padding:6px 8px 6px 0; text-align:left; white-space:nowrap}

/* Full-screen workspace */
/* Rows keep their content height: in a fixed-height grid, panels that clip their corners would otherwise collapse */
.spm-expanded{position:fixed; inset:0; z-index:1000; overflow:auto; padding:20px; background:#fff; grid-auto-rows:max-content}

/* Page chrome on this route: keep the title compact so the evidence starts in the first screen. */
body.spu-experience:is([data-page="education-spm"],[data-role-tab="education-spm"]) .topbar{min-height:0; padding:18px 0 14px; align-items:center}
body.spu-experience:is([data-page="education-spm"],[data-role-tab="education-spm"]) .page-eyebrow{display:none}
body.spu-experience:is([data-page="education-spm"],[data-role-tab="education-spm"]) #page-title{font:600 24px/1.25 'Gotham','Montserrat',Arial,sans-serif; letter-spacing:0; color:#e21937}
body.spu-experience:is([data-page="education-spm"],[data-role-tab="education-spm"]) #page-subtitle{margin-top:4px; font-size:12px}

@media (min-width:1301px){
  .spm-lowest li:nth-child(n+7){display:none}
}
@media (max-width:1300px){
  .spm-landscape-layout{grid-template-columns:minmax(0,1fr)}
  .spm-lowest ol{display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); column-gap:24px}
  .spm-lowest li+li{border-top:0}
  .spm-lowest li{border-bottom:1px solid var(--spm-line-soft)}
}
@media (max-width:1100px){
  .spm-board{grid-template-columns:1fr}
  .spm-comparisons{grid-template-columns:1fr}
}
@media (max-width:850px){
  .spm-summary{grid-template-columns:repeat(2,minmax(0,1fr))}
  .spm-summary-item:nth-child(3){border-left:0}
  .spm-summary-item:nth-child(n+3){border-top:1px solid var(--spm-line-soft)}
  /* A wrapping column sizes its line to the tabs' full width, so keep it single-line. */
  .spm-toolbar{flex-direction:column; flex-wrap:nowrap; align-items:stretch; padding:0 8px}
  .spm-tabs{overflow-x:auto; scrollbar-width:none; margin:0 -8px; padding:0 8px}
  .spm-tabs::-webkit-scrollbar{display:none}
  .spm-toolbar-tools{position:relative; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); margin-left:0; padding:8px 0 10px; border-top:1px solid var(--spm-line-soft)}
  .spm-toolbar-tools>button,.spm-resources>summary{width:100%; text-align:center}
  /* Open the guides menu from the left of the tools row so it stays on screen. */
  .spm-resources{position:static}
  .spm-resources>div{left:0; right:auto; min-width:0; width:min(100%,320px)}
  .spm-landscape-layout,.spm-support-detail{grid-template-columns:1fr}
  .spm-empty-detail{display:none}
  .spm-filter-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .spm-cohort>summary{flex-wrap:wrap}
  .spm-cohort-tags{order:3; width:100%}
  .spm-stack-row,.spm-bar{grid-template-columns:1fr}
}
@media (max-width:560px){
  .spm-composition-body{grid-template-columns:1fr; justify-items:center}
  .spm-legend-list{width:100%}
  .spm-tabs button{padding:8px 10px 10px; font-size:12px}
  .spm-tabs small{display:none}
  .spm-filter-grid,.spm-profile-pair{grid-template-columns:1fr}
  .spm-chart,.spm-results,.spm-distribution{padding:14px}
  .spm-stats>div{flex:1 1 50%; border-right:0; border-bottom:1px solid var(--spm-line-soft)}
  .spm-results [data-column="student_full_name"]{position:static}
  .spm-results [data-column="student_number"]{min-width:125px; width:125px}
  .spm-expanded{padding:12px}
}
@media (prefers-reduced-motion:reduce){.spm-workspace *{scroll-behavior:auto!important; transition:none!important}}

/* Keep chart text legible in narrow cards, with scrolling confined to the plot. */
.spm-plot-scroll{max-width:100%; overflow-x:auto; overscroll-behavior-x:contain}
.spm-plot-scroll .spm-landscape{min-width:680px}
.spm-plot-hint{font-size:12px; color:var(--spm-muted)}
.spm-error>p{margin:0 0 10px}
.spm-error>span{display:block; margin-top:8px; font-size:12px}
.spm-error>button{border:1px solid currentColor; background:#fff; color:inherit; padding:9px 14px; font:inherit; cursor:pointer}
