/* The manager Dashboard (dashboard.js). Loaded after style.css and reviews.css, whose tokens (light and dark) it uses. No inline styles are used
   anywhere (the CSP blocks them): the charts are SVG shapes whose sizes are attributes, and every colour is a class. Every chart also has its numbers
   as text, so nothing depends on colour alone. */
:root {
  --d-paid: #2e7d32; --d-partly: #b35400; --d-notpaid: #c62828; --d-none: #b9b2a6; --d-bar: #0e7c7b; --d-track: #e7e2d9;
  --chip-ab-bg: #f8d7d7; --chip-ab-fg: #7a1414; --chip-pr-bg: #d4efe0; --chip-pr-fg: #14522f;
  --chip-la-bg: #f9e9c4; --chip-la-fg: #6d4b00; --chip-ex-bg: #e8d9f0; --chip-ex-fg: #4a1262;
}
@media (prefers-color-scheme: dark) {
  :root {
    --d-paid: #5cb860; --d-partly: #e0913d; --d-notpaid: #ef6b6b; --d-none: #6b7d7a; --d-bar: #3cb8b5; --d-track: #2d3836;
    --chip-ab-bg: #5a2222; --chip-ab-fg: #ffc4c4; --chip-pr-bg: #1d4630; --chip-pr-fg: #a8e2c0;
    --chip-la-bg: #4a3b12; --chip-la-fg: #f3d58a; --chip-ex-bg: #3d2a4a; --chip-ex-fg: #e2c4f3;
  }
}
.chip.ab { background: var(--chip-ab-bg); color: var(--chip-ab-fg); }
.chip.pr { background: var(--chip-pr-bg); color: var(--chip-pr-fg); }
.chip.la { background: var(--chip-la-bg); color: var(--chip-la-fg); }
.chip.ex { background: var(--chip-ex-bg); color: var(--chip-ex-fg); }

.dashcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 10px; margin: 0 0 18px; }
.dashcard { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.dashcard .sub { color: var(--muted); font-size: .8rem; }
.dashcard strong { font-size: 1.4rem; line-height: 1.4; }
.dashsec { margin: 0 0 20px; }
.dashsec h3 { font-size: 1rem; margin: 0 0 8px; }
.dashgrid { display: grid; grid-template-columns: 1fr; gap: 0 24px; }
@media (min-width: 900px) { .dashgrid { grid-template-columns: 1fr 1fr; } }

.barrow { display: grid; grid-template-columns: minmax(5rem, 9rem) 1fr minmax(3rem, 7rem); gap: 8px; align-items: center; padding: 3px 0; }
.barrow .bl { font-size: .9rem; text-align: start; }
.barrow button.bl { margin: 0; padding: 4px 0; min-height: 32px; border: 0; background: none; color: var(--link); text-decoration: underline; cursor: pointer; }
.barrow .bv { font-size: .85rem; color: var(--muted); }
svg.bar { width: 100%; height: 12px; display: block; }
svg.bar .track { fill: var(--d-track); }
svg.bar .fill { fill: var(--d-bar); }
svg.bar .s-paid { fill: var(--d-paid); }
svg.bar .s-partly { fill: var(--d-partly); }
svg.bar .s-notpaid { fill: var(--d-notpaid); }
svg.bar .s-none { fill: var(--d-none); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .82rem; margin: 4px 0 0; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: 5px; }
.legend i.s-paid { background: var(--d-paid); } .legend i.s-partly { background: var(--d-partly); }
.legend i.s-notpaid { background: var(--d-notpaid); } .legend i.s-none { background: var(--d-none); }
.stackrow { margin: 0 0 10px; }
.stackrow .bl { font-size: .9rem; display: block; margin-bottom: 2px; }

svg.line { width: 100%; max-width: 560px; height: auto; display: block; }
svg.line polyline { fill: none; stroke: var(--d-bar); stroke-width: 2; }
svg.line circle { fill: var(--d-bar); }
svg.line line { stroke: var(--line); stroke-width: 1; }
.pointlist { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: .8rem; color: var(--muted); margin: 4px 0 0; padding: 0; list-style: none; }
.pointlist li { border: 0; padding: 0; }

.dashtools { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center; margin: 0 0 8px; }
.dashtools label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; font-size: .9rem; }
.dashtools input[type=checkbox] { width: 18px; height: 18px; margin: 0; }
.dashwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table.dashtable { border-collapse: collapse; width: 100%; font-size: .9rem; }
.dashtable th, .dashtable td { padding: 8px 10px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dashtable thead th { background: var(--surface-2); font-weight: 600; }
.dashtable thead button { margin: 0; padding: 0; min-height: 32px; border: 0; background: none; color: var(--fg); font-weight: 600; cursor: pointer; }
.dashtable thead th[aria-sort] button::after { content: " \25B2"; font-size: .7em; }
.dashtable thead th[aria-sort=descending] button::after { content: " \25BC"; }
.dashtable tbody button { margin: 0; padding: 4px 0; min-height: 32px; border: 0; background: none; color: var(--link); text-decoration: underline; cursor: pointer; text-align: start; }
.dashtable tbody tr:last-child td, .dashtable tbody tr:last-child th { border-bottom: 0; }
.dashtable td.low { color: var(--d-notpaid); font-weight: 600; }

#dashStudent h2 { font-size: 1.15rem; margin: 6px 0 2px; }
#dashStudent .sub { color: var(--muted); font-size: .85rem; margin: 0 0 12px; }
.crit-line { display: grid; grid-template-columns: 1fr 5rem; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.crit-line:last-child { border-bottom: 0; }
.crit-line em { font-style: normal; color: var(--muted); }
