/* bGlic report portal. Palette from Defensible's bGlic report (teal #027890, deep #013F4F).
   Constraints: no external fonts, no JavaScript, no inline styles (CSP style-src 'self'), so every look is a class here.
   Mobile first: under 720px every table marked .stack becomes one card per row, each cell labelled from data-label.
   The one bold element is time against target (.bar); everything around it stays quiet. */

:root {
  --deep: #013F4F; --teal: #027890; --teal-dark: #01596B; --sky: #7FD3DE;
  --ink: #1B2733; --mut: #56656F; --line: #D5E3E8; --mist: #ECF0F2; --surface: #fff; --tint: #F5F9FA;
  --ok: #2E7D4F; --warn-ink: #8A4B00; --warn-bg: #FFF0DC; --bad-ink: #A12D22; --bad-bg: #FDECEA;
  --radius: 8px; --ctl: 42px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--mist); color: var(--ink);
       font: 15px/1.5 Quicksand, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--teal); text-underline-offset: 2px; }
a:hover { color: var(--teal-dark); }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 4px; }
h1 { color: var(--deep); font-size: 26px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -0.01em; }
h2 { color: var(--deep); font-size: 18px; line-height: 1.3; margin: 0 0 10px; }
p { margin: 0 0 12px; }
.muted { color: var(--mut); font-size: 14px; }
.lede { color: var(--mut); max-width: 72ch; margin-bottom: 18px; }

/* ---- top bar ---- */
header { background: var(--deep); color: #fff; }
header .top { max-width: 1200px; margin: 0 auto; padding: 10px 20px; display: flex; flex-wrap: wrap;
              align-items: center; gap: 8px 24px; }
header a, header button { color: #fff; }
header a.home { display: flex; align-items: center; gap: 12px; text-decoration: none; font-size: 17px; }
header a.home img { height: 34px; display: block; }
header a.home:hover strong, header a.home:focus-visible strong { text-decoration: underline; }
header nav { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; font-size: 14px; }
header nav a { text-decoration: none; padding: 6px 0; }
header nav a:hover { text-decoration: underline; }
header .me { color: #BFE3EA; }
header form { margin: 0; }
button.link { background: none; border: 0; padding: 6px 0; text-decoration: underline; cursor: pointer; font: inherit; }

main { max-width: 1200px; margin: 0 auto; padding: 24px 20px 48px; }

/* ---- page head ---- */
.crumb { margin: 0 0 6px; font-size: 14px; }
/* the course switcher: one line however many courses there are */
.switch { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 14px; color: var(--mut); }
.switch select { height: 34px; max-width: min(560px, 100%); flex: 0 1 auto; font-size: 14px; }
.switch .btn { flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; }
.chips a, .chips strong { display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: 13px;
                          border: 1px solid var(--line); background: var(--surface); text-decoration: none; }
.chips strong { background: var(--deep); border-color: var(--deep); color: #fff; font-weight: 600; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 24px; margin: 0 0 18px; color: var(--mut); font-size: 14px; }
.meta div { display: flex; gap: 6px; }
.meta dt { margin: 0; }
.meta dd { margin: 0; color: var(--ink); }
.links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0 0 16px; font-size: 14px; }

/* ---- surfaces ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
        margin-bottom: 16px; }
.notice { border-radius: var(--radius); padding: 10px 14px; margin: 0 0 16px; font-size: 14px; }
.notice.bad, .problems, .error { background: var(--bad-bg); color: var(--bad-ink); }
.notice.good, .ok { background: #E8F4EC; color: var(--ok); }
p.problems, p.error, p.ok { border-radius: var(--radius); padding: 10px 14px; }

/* ---- forms ---- */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; }
.filters label, .field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--mut); }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=date], input[type=month],
select { height: var(--ctl); padding: 0 10px; border: 1px solid #BFD2D9; border-radius: 6px; background: #fff;
         color: var(--ink); font: inherit; font-size: 15px; min-width: 0; }
input:focus, select:focus { border-color: var(--teal); }
label.check, .filters label.check { display: flex; flex-direction: row; align-items: center; gap: 8px; height: var(--ctl);
                                    color: var(--ink); font-size: 14px; cursor: pointer; }
/* a checkbox with its "?" explanation beside it (outside the label, so tapping "?" does not tick the box) */
.checkwrap { display: flex; align-items: center; gap: 6px; height: var(--ctl); }
.tip { position: relative; flex: none; width: 22px; height: 22px; padding: 0; border: 1px solid #BFD2D9;
       border-radius: 50%; background: var(--tint); color: var(--teal); font: inherit; font-size: 12px;
       font-weight: 700; line-height: 1; cursor: help; }
.tip::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%;
              transform: translateX(-50%); width: 280px; padding: 9px 11px; border-radius: 6px;
              background: var(--deep); color: #fff; font-size: 13px; font-weight: 400; line-height: 1.45;
              text-align: left; visibility: hidden; opacity: 0; pointer-events: none; z-index: 10; }
.tip:hover::after, .tip:focus::after { visibility: visible; opacity: 1; }
label.check input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--teal); }
.btn { display: inline-flex; align-items: center; justify-content: center; height: var(--ctl); padding: 0 18px;
       border: 1px solid var(--teal); border-radius: 6px; background: var(--teal); color: #fff; font: inherit;
       font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
.btn.alt { background: #fff; color: var(--teal); }
.btn.alt:hover { background: var(--tint); color: var(--teal-dark); }
.btn.small { height: 34px; padding: 0 12px; font-size: 13px; }
/* the downloads are the filter card's footer: their own row, under a rule, so they never crowd Apply */
.downloads { flex: 1 0 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
             margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.downloads .muted { margin-right: 6px; }
.downloads .btn { min-width: 72px; }
form.inline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
form.inline select { height: 34px; }

/* the home page search: one wide field, the switch and the button beside it */
.search { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: end; gap: 10px 14px; }
.search label.field input { width: 100%; height: 46px; font-size: 16px; }
.search .btn { height: 46px; }

/* ---- stats ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0; padding: 0; }
.stats > div { padding: 14px 18px; border-left: 1px solid var(--line); font-size: 13px; color: var(--mut); }
.stats > div:first-child { border-left: 0; }
.stats b { display: block; font-size: 24px; line-height: 1.2; color: var(--deep); font-variant-numeric: tabular-nums; }
.stats .bar { margin-top: 8px; }

/* ---- time against target: the bar (the page's one strong element) ---- */
.bar { display: block; width: 100%; max-width: 160px; height: 10px; }
.bar.wide { max-width: none; height: 12px; }

/* ---- the per-day chart ---- */
.days { display: block; width: 100%; height: 80px; }
.axis { display: flex; justify-content: space-between; color: var(--mut); font-size: 12px; margin-top: 4px; }

/* ---- tables ---- */
.table { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px;
         overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 10px 12px; background: var(--tint); color: var(--deep); font-weight: 600;
     font-size: 13px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: bottom; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #FAFCFC; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.num { width: 1%; }               /* number columns hug their content; the lead column takes the rest */
tr.section td { background: var(--mist); color: var(--deep); font-weight: 600; font-size: 13px; }
td.empty { color: var(--mut); padding: 18px 12px; }
td .sub { display: block; color: var(--mut); font-size: 12px; }
td.lead a { font-weight: 600; }
td.wrap { word-break: break-word; max-width: 360px; }
.kv td:first-child { color: var(--mut); width: 40%; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
        white-space: nowrap; }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); }
.pill.bad { background: var(--bad-bg); color: var(--bad-ink); }
.flag { color: var(--warn-ink); font-weight: 600; }

.rules { font-size: 13px; color: var(--mut); max-width: 80ch; }
.rules ul { padding-left: 18px; margin: 4px 0 0; }
.rules li { margin-bottom: 4px; }

/* ---- sign in ---- */
.login { max-width: 400px; margin: 48px auto; padding: 24px; }
.login form { display: flex; flex-direction: column; gap: 14px; }
.login label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--mut); }
.login input { width: 100%; }
.login .btn { width: 100%; margin-top: 4px; }

/* ---- phones and narrow windows ---- */
@media (max-width: 720px) {
  body { font-size: 15px; }
  header .top { padding: 8px 14px; gap: 4px 16px; }
  header a.home img { height: 28px; }
  header nav { margin-left: 0; width: 100%; gap: 2px 16px; }
  header .me { display: none; }
  main { padding: 16px 12px 40px; }
  h1 { font-size: 22px; }
  .card { padding: 14px; }

  .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .filters label { grid-column: span 2; }
  .filters label.half { grid-column: span 1; }
  .filters label input, .filters label select { width: 100%; }
  .filters label.check input { width: 18px; }
  .filters > .btn { grid-column: span 2; width: 100%; }
  .downloads { grid-column: span 2; }
  .downloads .muted { flex: 1 0 100%; }
  .downloads .btn { flex: 1; }

  .filters .checkwrap { grid-column: span 2; }
  .checkwrap { position: relative; }
  .tip { position: static; }                    /* on phones the bubble spans the row, not the small "?" */
  .tip::after { left: 0; right: 0; width: auto; transform: none; }
  .search { grid-template-columns: 1fr; }
  .search .btn { width: 100%; }

  .stats { grid-template-columns: 1fr 1fr; }
  .stats b { font-size: 20px; }
  .stats > div { border-left: 0; border-top: 1px solid var(--line); }
  .stats > div:nth-child(-n+2) { border-top: 0; }
  .stats > div:nth-child(even) { border-left: 1px solid var(--line); }

  /* one card per row; the header row is kept for screen readers only */
  .table { overflow: visible; border: 0; background: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stack tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
                   padding: 10px 14px; margin-bottom: 10px; }
  table.stack tbody tr:hover td { background: none; }
  table.stack td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0;
                   border: 0; text-align: right; max-width: none; }
  table.stack td::before { content: attr(data-label); color: var(--mut); font-size: 13px; text-align: left; flex: none; }
  table.stack td:empty { display: none; }
  table.stack td.lead { display: block; text-align: left; font-size: 16px; padding-bottom: 6px; }
  table.stack td.lead::before, table.stack td.empty::before, table.stack tr.section td::before { content: none; }
  table.stack td.full { display: block; }
  table.stack td.full::before { display: block; margin-bottom: 4px; }
  table.stack td.full .bar { max-width: none; }
  table.stack td .sub { margin-top: 2px; }
  table.stack td.empty { display: block; text-align: left; }
  table.stack tr.section { background: none; border: 0; padding: 12px 2px 4px; margin: 0; }
  table.stack tr.section td { background: none; padding: 0; text-align: left; font-size: 14px; display: block; }
  table.stack td.wrap { word-break: break-all; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
.card .filters + .muted { margin-top: 12px; }
