:root {
  /* Spacing scale (4pt): tight inside a field, generous between fields. */
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --changed-tint: #fdf1ee;
  --bfh-black: #000000;
  --bfh-dark: #1a1a1a;
  --bfh-gray-900: #2d2d2d;
  --bfh-gray-600: #6b6b6b;
  --bfh-gray-400: #a0a0a0;
  --bfh-gray-200: #e0e0e0;
  --bfh-gray-100: #f2f2f2;
  --bfh-white: #ffffff;
  --bfh-accent: #e63312;
  --intro: #3b82f6;
  --reinforced: #f59e0b;
  --mastered: #10b981;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* MW4: focus is always visible — one outline for every control, shown for keyboard
   focus (and for text fields on any focus). Nothing below removes it. */
:focus-visible { outline: 2px solid var(--bfh-black); outline-offset: 2px; }
.bfh-header :focus-visible { outline-color: var(--bfh-white); }

/* MW13: text layout. Balance short headings; avoid orphans in running text. */
h1, h2, h3 { text-wrap: balance; }
p, .hint, li { text-wrap: pretty; }
input[type="checkbox"] { accent-color: var(--bfh-black); }

/* MW13: full page loads that htmx does not boost (the form, help) cross-fade. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}

body {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: var(--bfh-gray-100);
  color: var(--bfh-dark);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--bfh-accent); }

/* --- Header --- */
.bfh-header {
  background: var(--bfh-black); color: var(--bfh-white);
  padding: 1rem 2rem; display: flex; align-items: center; gap: 1rem;
}
.bfh-header .bfh-logo {
  font-weight: 700; font-size: 1.1rem; letter-spacing: 0.05em;
  border-right: 2px solid var(--bfh-gray-600); padding-right: 1rem;
}
.bfh-header .bfh-app-name { font-size: 0.9rem; opacity: 0.85; }
.bfh-lang { margin-left: auto; display: flex; gap: 0.5rem; font-size: 0.75rem; }
/* Whose session this is (every save is recorded under them). */
.bfh-whoami {
  margin-left: auto; font-size: 0.78rem; color: var(--bfh-gray-200);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.bfh-whoami strong { color: var(--bfh-white); }
.bfh-whoami + .bfh-lang, .bfh-help + .bfh-lang { margin-left: 1rem; }
.bfh-help {
  margin-left: 1rem; color: var(--bfh-white); text-decoration: none; font-size: 0.75rem;
  font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
}
@media (hover: hover) { .bfh-help:hover { text-decoration: underline; } }
.bfh-footer {
  max-width: 980px; margin: 0 auto; padding: 0 1rem 2rem;
  display: flex; gap: 1.25rem; font-size: 0.75rem;
}
.bfh-footer a { color: var(--bfh-gray-600); }
@media (max-width: 700px) {
  .bfh-header { flex-wrap: wrap; row-gap: 0.4rem; }
  .bfh-whoami { order: 10; flex-basis: 100%; margin-left: 0; }
  .bfh-whoami + .bfh-lang { margin-left: auto; }
}
.bfh-lang a {
  color: var(--bfh-gray-400); text-decoration: none; font-weight: 700;
  letter-spacing: 0.05em;
}
.bfh-lang a.on { color: var(--bfh-white); }
.bfh-logout {
  color: var(--bfh-gray-400); text-decoration: none; font-size: 0.75rem;
  font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
}
@media (hover: hover) { .bfh-logout:hover { color: var(--bfh-white); } }

/* --- Layout --- */
.container { max-width: 980px; margin: 0 auto; padding: 2rem 1rem 4rem; }
.container.wide { max-width: 1240px; }
h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 0.25rem; letter-spacing: -0.01em; }
h2.section { font-size: 1.05rem; margin: 2rem 0 0.75rem; }
.subtitle { color: var(--bfh-gray-600); margin-bottom: 1.5rem; font-size: 0.9rem; }
.crumbs { font-size: 0.8rem; margin-bottom: 1rem; }
.crumbs a { text-decoration: none; }

.card {
  background: var(--bfh-white); border: 1px solid var(--bfh-gray-200);
  padding: 1.5rem; margin-bottom: 1.5rem;
}
.card h2 {
  font-size: 0.85rem; font-weight: 700; margin-bottom: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.hint { color: var(--bfh-gray-600); font-size: 0.8rem; margin-bottom: 0.75rem; }

/* --- Forms --- */
label { display: block; font-weight: 600; margin-bottom: 0.25rem; font-size: 0.85rem; }
textarea, select, input[type="text"], input[type="date"] {
  width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--bfh-gray-200);
  border-radius: 0; font-family: inherit; font-size: 0.9rem; background: var(--bfh-white);
  transition: border-color 0.15s;
}
textarea:focus, select:focus, input:focus { border-color: var(--bfh-black); }
textarea { min-height: 90px; resize: vertical; }

/* --- Rich-text editor --- */
.rich { border: 1px solid var(--bfh-gray-200); background: var(--bfh-white); }
.rich-toolbar {
  display: flex; gap: 0.25rem; padding: 0.3rem; border-bottom: 1px solid var(--bfh-gray-200);
  background: var(--bfh-gray-100);
}
.rich-toolbar button {
  min-inline-size: 1.9rem; min-block-size: 1.75rem; padding: 0.2rem 0.45rem;
  border: 1px solid var(--bfh-gray-200); background: var(--bfh-white); color: var(--bfh-dark);
  cursor: pointer; font: inherit; font-size: 0.8rem; line-height: 1.2;
}
@media (hover: hover) { .rich-toolbar button:hover { border-color: var(--bfh-black); } }
/* MW3: Bold / Italic on — the state comes from aria-pressed, not a class. */
.rich-toolbar button[aria-pressed="true"] {
  background: var(--bfh-black); color: var(--bfh-white); border-color: var(--bfh-black);
}
.rich-editor {
  min-height: 90px; padding: 0.6rem 0.75rem; font-size: 0.9rem; line-height: 1.45;
  overflow-wrap: anywhere;
}
.rich-editor:focus-visible { outline-offset: -3px; }
.rich:focus-within { border-color: var(--bfh-black); }
.rich-editor ul, .rich-editor ol { margin: 0.25rem 0 0.25rem 1.25rem; }
.rich-editor p { margin: 0 0 0.5rem; }

/* Rendered rich text (admin views) */
.rt-field { margin-bottom: 0.7rem; }
.rt-field > strong { display: block; color: var(--bfh-gray-600); font-size: 0.8rem; }
.rt > :first-child { margin-top: 0; }
.rt > :last-child { margin-bottom: 0; }
.rt ul, .rt ol { margin: 0.25rem 0 0.25rem 1.25rem; }
.rt p { margin: 0 0 0.4rem; }

/* --- Competence matrix --- */
.domain {
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--bfh-white); background: var(--bfh-black);
  padding: 0.35rem 0.6rem; margin: 1.25rem 0 0.5rem;
}
.domain:first-of-type { margin-top: 0; }

.comp { border-bottom: 1px solid var(--bfh-gray-100); padding: 0.6rem 0; }
.comp-head {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.comp-label { flex: 1; min-width: 220px; display: flex; align-items: center; gap: 0.4rem; }
.comp-name { font-weight: 600; font-size: 0.9rem; }
.comp-dim { color: var(--bfh-gray-400); font-size: 0.75rem; }

/* info (i) toggletip (MW1): a 24 px button; the description is a popover. */
.info {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  min-inline-size: 1.5rem; min-block-size: 1.5rem; border: 0; border-radius: 50%; padding: 0;
  cursor: pointer; background: var(--bfh-gray-200); color: var(--bfh-gray-900);
  font: inherit; font-size: 0.75rem; font-weight: 700; font-style: normal;
}
.info[aria-expanded="true"] { background: var(--bfh-black); color: var(--bfh-white); }
@media (hover: hover) { .info:hover { background: var(--bfh-black); color: var(--bfh-white); } }

/* --- Popovers: toggletips and dropdowns (MW1, MW7) ---------------------------------
   Opened by the browser (popovertarget), in the top layer: never clipped by a table.
   Placed under their trigger with anchor positioning; without it (Firefox) app.js
   sets top/left from the trigger. `display` is set only on the open state — on the
   closed one it would override the browser's display: none. */
.pop {
  margin: 0; padding: var(--space-xs) 0; border: 1px solid var(--bfh-dark);
  background: var(--bfh-white); color: var(--bfh-dark); font-size: 0.85rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12); max-inline-size: min(24rem, calc(100vw - 1rem));
}
.pop.tip {
  padding: 0.6rem 0.75rem; inline-size: 20rem; background: var(--bfh-dark); color: var(--bfh-white);
  font-size: 0.8rem; line-height: 1.45; border-color: var(--bfh-dark);
}
@supports (position-area: block-end) {
  .pop {
    inset: auto; margin-block: 0.4rem;
    position-area: block-end span-inline-end;
    position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
  }
  .pop--end { position-area: block-end span-inline-start; }
}
@supports not (position-area: block-end) {
  .pop { position: fixed; inset: auto; }
}
@media (prefers-reduced-motion: no-preference) {
  .pop { transition: opacity 120ms ease-out, display 120ms allow-discrete, overlay 120ms allow-discrete; }
  .pop:not(:popover-open) { opacity: 0; }
  @starting-style { .pop:popover-open { opacity: 0; } }
}

/* A dropdown's trigger: quiet text, like the inline disclosures. */
.menu-btn {
  background: none; border: 0; padding: 0; font: inherit; font-size: 0.8rem; cursor: pointer;
  color: var(--bfh-gray-600); text-decoration: underline; text-underline-offset: 2px;
}
.menu-btn[aria-expanded="true"] { color: var(--bfh-dark); }
@media (hover: hover) { .menu-btn:hover { color: var(--bfh-dark); } }

/* level buttons */
.lvl-group { display: flex; gap: 0.35rem; }
.lvl-btn {
  border: 1px solid var(--bfh-gray-200); background: var(--bfh-white); color: var(--bfh-dark);
  padding: 0.3rem 0.8rem; cursor: pointer; font-size: 0.8rem; font-weight: 700;
  font-family: inherit; transition: background-color 0.12s, color 0.12s, border-color 0.12s;
}
@media (hover: hover) { .lvl-btn:hover { background: var(--bfh-gray-100); } }
/* MW2: the chosen level — from aria-pressed, so look and announcement agree. */
.lvl-btn[aria-pressed="true"][data-level="introduced"] { background: var(--intro); color: #fff; border-color: var(--intro); }
.lvl-btn[aria-pressed="true"][data-level="reinforced"] { background: var(--reinforced); color: #fff; border-color: var(--reinforced); }
.lvl-btn[aria-pressed="true"][data-level="mastered"] { background: var(--mastered); color: #fff; border-color: var(--mastered); }
@media (prefers-reduced-motion: reduce) { .lvl-btn { transition: none; } }

.oper-row { margin: 0.5rem 0 0.25rem; padding-left: 0.1rem; }
.oper-row label { font-size: 0.8rem; }
.oper-row .req { color: var(--bfh-accent); font-weight: 700; font-size: 0.72rem; }

/* --- Evaluations --- */
.eval-row {
  display: flex; gap: 0.75rem; align-items: center; margin-bottom: 0.6rem;
}
.eval-row > * { flex: 1; }
.eval-row .eval-remove {
  flex: 0 0 auto; background: none; border: none; color: var(--bfh-gray-400);
  font-size: 1.3rem; cursor: pointer; line-height: 1; padding: 0 0.3rem;
}
@media (hover: hover) { .eval-row .eval-remove:hover { color: var(--bfh-accent); } }
.btn-add {
  background: none; border: 1px dashed var(--bfh-gray-400); padding: 0.4rem 1rem;
  cursor: pointer; font-size: 0.85rem; font-family: inherit; color: var(--bfh-gray-600);
  width: 100%; margin-top: 0.3rem;
}
@media (hover: hover) { .btn-add:hover { border-color: var(--bfh-black); color: var(--bfh-black); } }

/* --- Buttons --- */
.actions { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; }
.btn-primary {
  background: var(--bfh-black); color: var(--bfh-white); border: none;
  padding: 0.7rem 2rem; font-size: 0.9rem; cursor: pointer; font-weight: 700;
  font-family: inherit; text-transform: uppercase; letter-spacing: 0.04em;
}
@media (hover: hover) { .btn-primary:hover { background: var(--bfh-gray-900); } }
.btn-secondary {
  background: var(--bfh-white); color: var(--bfh-black);
  border: 1px solid var(--bfh-black);
  padding: 0.7rem 2rem; font-size: 0.9rem; cursor: pointer; font-weight: 700;
  font-family: inherit; text-transform: uppercase; letter-spacing: 0.04em;
  text-decoration: none; display: inline-block;
}
@media (hover: hover) { .btn-secondary:hover { background: var(--bfh-gray-100); } }
/* Approve: the primary button in green — same size and type, the "make it final"
   colour. #047857 keeps white text at WCAG AA (~5.5:1). */
.btn-primary.btn-approve { background: #047857; }
@media (hover: hover) { .btn-primary.btn-approve:hover { background: #065f46; } }
/* Link buttons (Edit, Print) look exactly like real buttons. */
a.btn-primary, a.btn-secondary { display: inline-block; text-decoration: none; line-height: normal; }

/* --- Messages --- */
.errors {
  background: #fee2e2; border: 1px solid #f5b5a8;
  padding: 0.75rem 1rem; margin-bottom: 1.5rem; font-size: 0.85rem;
}
.errors ul { margin: 0.25rem 0 0 1.1rem; }

/* --- Badges --- */
.badge {
  display: inline-block; padding: 0.1rem 0.5rem; font-size: 0.7rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
}
.badge.compulsory { background: var(--bfh-gray-200); color: var(--bfh-gray-900); }
.badge.elective { background: #ede9fe; color: #5b21b6; }
.badge.foundation { background: #e0e7ff; color: #3730a3; }
.badge.advanced { background: #fce7f3; color: #9d174d; }
.badge.flag { background: var(--bfh-accent); color: #fff; }
/* Header marker on pages opened with a read-only share link. */
.badge.view-only {
  background: rgba(255, 255, 255, 0.22); color: #fff; margin-left: 0.5rem;
  vertical-align: middle;
}

/* --- Tables --- */
.table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.table th, .table td {
  padding: 0.5rem 0.7rem; text-align: left; border-bottom: 1px solid var(--bfh-gray-200);
}
.table th {
  background: var(--bfh-gray-100); font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.04em;
}
@media (hover: hover) { .table tr:hover td { background: var(--bfh-gray-100); } }

/* --- Heatmap --- */
.heatmap { width: 100%; border-collapse: collapse; font-size: 0.72rem; }
.heatmap th, .heatmap td {
  padding: 0.35rem; text-align: center; border: 1px solid var(--bfh-gray-200);
}
.heatmap th.rotate { white-space: nowrap; }
.heatmap th.rotate > div {
  writing-mode: vertical-rl; transform: rotate(180deg); height: 130px;
  display: flex; align-items: center; margin: 0 auto; font-weight: 700;
}
.heatmap td.course-name { text-align: left; white-space: nowrap; min-width: 140px; }
.heatmap th.course-col { text-align: left; }

/* Course links (heatmap + tables) — a clear but calm clickable affordance. */
.course-link {
  color: var(--bfh-dark); font-weight: 600;
  text-decoration: underline; text-decoration-color: var(--bfh-gray-400);
  text-underline-offset: 2px;
}
.course-link::after { content: " \203A"; color: var(--bfh-gray-400); font-weight: 700; }
.course-link:focus {
  color: var(--bfh-accent); text-decoration-color: var(--bfh-accent);
}
@media (hover: hover) { .course-link:hover {
  color: var(--bfh-accent); text-decoration-color: var(--bfh-accent);
} }
.course-link:focus::after { color: var(--bfh-accent); }
@media (hover: hover) { .course-link:hover::after { color: var(--bfh-accent); } }
.heatmap .module-header {
  background: var(--bfh-black); color: var(--bfh-white); text-align: left;
  font-weight: 700; text-transform: uppercase; font-size: 0.68rem; letter-spacing: 0.04em;
}
.cell-introduced { background: #dbeafe; color: #1e40af; font-weight: 700; }
.cell-reinforced { background: #fef3c7; color: #92400e; font-weight: 700; }
.cell-mastered { background: #d1fae5; color: #065f46; font-weight: 700; }
.cell-none { color: var(--bfh-gray-400); }
.cell-missing { background: #fee2e2; color: #991b1b; }

.legend { display: flex; gap: 1.25rem; margin-bottom: 0.9rem; font-size: 0.78rem; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 0.4rem; }
.legend-swatch { width: 14px; height: 14px; border: 1px solid var(--bfh-gray-200); }

/* --- Coverage chart --- */
.cov-row {
  display: grid; grid-template-columns: 240px 1fr 150px; gap: 0.75rem;
  align-items: center; padding: 0.3rem 0; font-size: 0.8rem;
}
.cov-label { font-weight: 600; }
.cov-bar { display: block; inline-size: 100%; block-size: 20px; background: var(--bfh-gray-100); }
/* Match the heatmap cell colours (.cell-* above), not the saturated level buttons. */
.cov-seg.introduced { fill: #dbeafe; }
.cov-seg.reinforced { fill: #fef3c7; }
.cov-seg.mastered { fill: #d1fae5; }
.cov-counts { color: var(--bfh-gray-600); font-size: 0.75rem; }
.cov-counts b { color: var(--bfh-dark); }

/* --- Dashboard cards --- */
.prog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.prog-card {
  background: var(--bfh-white); border: 1px solid var(--bfh-gray-200);
  padding: 1.25rem; text-decoration: none;
  color: var(--bfh-dark); display: block;
}
@media (hover: hover) { .prog-card:hover { border-color: var(--bfh-dark); } }
.prog-card h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.prog-stat { font-size: 0.8rem; color: var(--bfh-gray-600); }
.prog-stat b { color: var(--bfh-dark); font-size: 1.05rem; }
.prog-flag { color: var(--bfh-accent); font-weight: 700; }

/* --- Success / error pages --- */
.notice { text-align: center; padding: 3rem 1rem; }
.notice h1 { margin-bottom: 0.5rem; }
.notice.error h1 { color: var(--bfh-accent); }
.notice p { color: var(--bfh-gray-600); }
.flag-note {
  background: #fef3c7; border: 1px solid #f0d58a;
  padding: 0.75rem 1rem; font-size: 0.85rem; margin: 1rem 0; text-align: left;
}

/* --- Submission requests --- */
.badge.submitted { background: #d1fae5; color: #065f46; }
.badge.awaiting { background: var(--bfh-gray-200); color: var(--bfh-gray-600); }
.link-url {
  font-family: 'SF Mono', Monaco, Consolas, monospace; font-size: 0.72rem;
  color: var(--bfh-gray-600); word-break: break-all; margin-right: 0.4rem;
}
.copy-btn {
  background: var(--bfh-black); color: var(--bfh-white); border: none;
  padding: 0.25rem 0.6rem; cursor: pointer; font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.03em; font-family: inherit;
}
@media (hover: hover) { .copy-btn:hover { background: var(--bfh-gray-900); } }

/* --- Management screens --- */
input[type="number"], input[type="email"] {
  width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--bfh-gray-200);
  border-radius: 0; font-family: inherit; font-size: 0.9rem; background: var(--bfh-white);
  transition: border-color 0.15s;
}
input[type="number"]:focus, input[type="email"]:focus { border-color: var(--bfh-black); }
.field-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.field { display: flex; flex-direction: column; flex: 1 1 150px; }
.field.grow { flex-basis: 100%; }
.field label { margin-bottom: 0.2rem; }
.field-actions { display: flex; gap: 0.5rem; align-items: center; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.card.archived { opacity: 0.55; }
.btn-save {
  background: var(--bfh-black); color: var(--bfh-white); border: none;
  padding: 0.45rem 1.1rem; cursor: pointer; font-size: 0.8rem; font-weight: 700;
  font-family: inherit; text-transform: uppercase; letter-spacing: 0.03em;
}
@media (hover: hover) { .btn-save:hover { background: var(--bfh-gray-900); } }
.btn-danger {
  background: none; border: 1px solid var(--bfh-accent); color: var(--bfh-accent);
  padding: 0.4rem 0.9rem; cursor: pointer; font-size: 0.8rem; font-weight: 600;
  font-family: inherit;
}
@media (hover: hover) { .btn-danger:hover { background: var(--bfh-accent); color: #fff; } }
.btn-danger:disabled {
  border-color: var(--bfh-gray-200); color: var(--bfh-gray-400); cursor: not-allowed;
}
@media (hover: hover) { .btn-danger:disabled:hover { background: none; color: var(--bfh-gray-400); } }
.banner {
  background: #d1fae5; border: 1px solid #9fdcc0;
  padding: 0.6rem 1rem; font-size: 0.85rem; margin-bottom: 1.5rem;
}
.banner.warn { background: #fef3c7; border-color: #f0d58a; }
.banner.whoami { background: var(--bfh-white); border-color: var(--bfh-gray-200); }
.banner.whoami strong { display: block; }
/* No lost work (N2, N6, N7) */
.version-line { font-size: 0.85rem; color: var(--bfh-gray-600); margin: -0.5rem 0 1rem; }
.version-line a { margin-left: 0.4rem; }
.banner.draft-banner p { margin: 0 0 0.4rem; }
.banner.draft-banner .draft-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.5rem 0 0; }
.banner.deadline { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 5; }
.banner.deadline .deadline-actions { display: inline-flex; gap: 0.5rem; }
.banner.deadline .deadline-actions[hidden] { display: none; }
.banner.deadline.closed { background: #fee2e2; border-color: #f5b5a8; font-weight: 700; }
@media print {
  .rich-toolbar, .actions, .banner.deadline, .banner.draft-banner, .bfh-header,
  .bfh-footer, #editors { display: none !important; }
}
details.new-course { margin-top: 0.75rem; border-top: 1px solid var(--bfh-gray-100); padding-top: 0.5rem; }
details.new-course > summary {
  cursor: pointer; font-weight: 700; font-size: 0.8rem; color: var(--bfh-accent);
  text-transform: uppercase; letter-spacing: 0.03em; padding: 0.2rem 0;
}
.badge.status-active { background: #d1fae5; color: #065f46; }
.badge.status-expired { background: #fef3c7; color: #92400e; }
.badge.status-revoked { background: #fee2e2; color: #991b1b; }
tr.archived { opacity: 0.5; }

/* --- Spring collection: status, change highlights, approval, copy --- */
/* Changed against the baseline: a hairline in the flag red plus a light tint, always
   next to a "changed" text badge — red is never the only signal. */
.card.changed, .comp.changed {
  border: 1px solid var(--bfh-accent); background: var(--changed-tint);
}
.comp.changed { padding: var(--space-xs); }
tr.changed td { background: var(--changed-tint); }
tr.removed td { color: var(--bfh-gray-600); }
.heatmap td.changed { box-shadow: inset 0 0 0 2px var(--bfh-accent); }
.badge.changed-badge { background: var(--bfh-accent); color: #fff; font-size: 0.65rem; }
.legend-swatch.changed-swatch {
  display: inline-block; background: var(--changed-tint); box-shadow: inset 0 0 0 2px var(--bfh-accent);
  vertical-align: middle;
}

.status-line { display: flex; gap: 0.6rem; align-items: center; margin: -0.75rem 0 1rem; }
.badge.status-not_started { background: var(--bfh-gray-200); color: var(--bfh-gray-600); }
.badge.status-in_progress { background: #fef3c7; color: #92400e; }
.badge.status-done { background: #dbeafe; color: #1e40af; }
.badge.status-approved { background: #d1fae5; color: #065f46; }
.badge.status-returned { background: #fee2e2; color: #991b1b; }
.returned-box {
  background: #fdf1ee; border: 1px solid #f5b5a8; padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-lg);
}
.returned-box h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: var(--space-xs); }
.feedback-text { white-space: pre-wrap; margin: 0; }
.returned-note { white-space: pre-wrap; }
.send-back[open] { flex-basis: 100%; }
.send-back summary { display: block; cursor: pointer; list-style: none; line-height: inherit; }
.send-back[open] summary { display: inline-block; }
.send-back summary::-webkit-details-marker { display: none; }
.actions-row .send-back form { margin-top: var(--space-md); display: grid; gap: var(--space-xs); max-width: 40rem; }
.send-back form button { justify-self: start; }
.badge.draft { background: #fef3c7; color: #92400e; }
.status-counts { display: flex; gap: 0.3rem; flex-wrap: wrap; }

.actions-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.75rem 0 1.25rem; }
.actions-row form { margin: 0; }
.banner.ok { background: #d1fae5; border-color: #9fdcc0; }

fieldset.form-body { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.form-body[disabled] .rich-toolbar { display: none; }
fieldset.form-body[disabled] .rich-editor,
fieldset.form-body[disabled] input { background: var(--bfh-gray-100); color: var(--bfh-gray-900); }
fieldset.form-body[disabled] .lvl-btn { cursor: default; }
.declaration label { display: flex; gap: 0.6rem; align-items: flex-start; cursor: pointer; }
.declaration input[type="checkbox"] { width: auto; margin-top: 0.2rem; }
.level-missing { color: #92400e; margin-bottom: 0.4rem; }
.inline-form { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { flex: 1 1 12rem; }
.matrix-head { margin-top: 0.75rem; }

.view-toggle {
  display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; justify-content: space-between;
  background: var(--changed-tint); border: 1px solid var(--bfh-accent);
  padding: var(--space-sm) var(--space-md); margin-bottom: var(--space-md);
}
details.previous { margin-top: 0.4rem; font-size: 0.85rem; color: var(--bfh-gray-600); }
details.previous summary { cursor: pointer; }
details.previous .rt { border-left: 1px solid var(--bfh-gray-400); padding-left: 0.6rem; margin-top: 0.3rem; }

/* --- A filled-out module, read as a document ---
   Each field: a small set label with Copy at the right end of its row, then the text
   across the full width. Fields are separated by space and a hairline. */
.field {
  display: flex; flex-direction: column; gap: var(--space-xs);
  padding: var(--space-md) 0; border-top: 1px solid var(--bfh-gray-200);
}
.card > section.field:first-of-type { border-top: 0; }
.field-head {
  display: flex; align-items: center; gap: var(--space-xs); min-height: 1.25rem; width: 100%;
}
.field-label {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--bfh-gray-600); margin: 0;
}
.field-body {
  font-size: 0.95rem; line-height: 1.55; color: var(--bfh-dark);
}
.field-body > p, .field-body > .rt { margin: 0; }
.field-body .table.matrix { font-size: 0.88rem; }

/* Copy: at the right end of every field's label row, quiet until hovered or focused. */
.copy-isa {
  margin: 0; font-size: 0.72rem; padding: var(--space-2xs) var(--space-sm);
  background: var(--bfh-white); color: var(--bfh-gray-900);
  border: 1px solid var(--bfh-gray-400); white-space: nowrap;
}
.copy-isa:focus-visible {
  border-color: var(--bfh-black); background: var(--bfh-black); color: var(--bfh-white);
}
@media (hover: hover) { .copy-isa:hover {
  border-color: var(--bfh-black); background: var(--bfh-black); color: var(--bfh-white);
} }
/* Copy floats to the right end of the label row, whatever the label's length. */
.field-head > .copy-isa { margin-left: auto; flex: none; }

.field.changed {
  background: var(--changed-tint); border: 1px solid var(--bfh-accent);
  padding: var(--space-md); margin: var(--space-xs) 0;
}
.field.changed + .field { border-top: 0; }
.field.changed .field-label { color: var(--bfh-dark); }
details.previous { margin: 0; }
details.previous .rt { background: var(--bfh-white); }

@media print {
  .copy-isa, .view-toggle, .actions-row, .crumbs, .bfh-lang, .bfh-logout, .bfh-whoami,
  .banner.whoami, .bfh-help, .bfh-footer { display: none !important; }
  .field { break-inside: avoid; }
  details.previous { display: none; }
}

/* --- Manage → People: one text row per person (MP6) --- */
.people-table th[scope="row"] { font-weight: 700; }
.people-table .roles { font-size: 0.85rem; line-height: 1.5; }
.people-table .mt-actions { vertical-align: baseline; }
.role-label { color: var(--bfh-gray-600); }
.role-item + .role-item::before { content: ", "; }
.dup-note { margin-left: var(--space-xs); font-size: 0.72rem; font-weight: 400; color: #92400e; }
.field-error { margin: var(--space-2xs) 0 0; font-size: 0.75rem; color: var(--bfh-accent); }
.btn-small { padding: 0.35rem 0.8rem; font-size: 0.75rem; }
/* The row you just saved: found again at a glance, then it settles. */
.people-table tr:target > *, .people-table tr.just-saved > * { animation: saved-row 2.4s ease-out; }
@keyframes saved-row { from { background: #fff4c2; } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) {
  .people-table tr.just-saved > * { animation: none; background: #fff9e0; }
}
/* Editors get their link, editor activity, link on another device (N11–N13) */
.activity { margin-top: 0.25rem; font-size: 0.8rem; }
.activity-warn { color: var(--bfh-accent); font-weight: 700; }
.resend-form { display: flex; gap: 0.5rem; align-items: flex-end; justify-content: center;
  flex-wrap: wrap; margin-top: 1rem; }
.resend-form label { display: flex; flex-direction: column; text-align: left; font-size: 0.85rem; }
.resend-btn { background: var(--bfh-white); color: var(--bfh-black);
  border: 1px solid var(--bfh-black); margin-left: 0.25rem; }
@media (hover: hover) { .resend-btn:hover { background: var(--bfh-gray-100); } }

/* --- Programme workspaces (PW1–PW7) ------------------------------------------
   A register, not a dashboard: hairlines and spacing group things; status is a
   word first, colour second; BFH red only for "changed" and the waiting count. */

/* Header switcher: the programme you are in, next to the app name. */
.ws-switch { position: relative; font-size: 0.85rem; color: var(--bfh-white); }
.ws-switch.ws-fixed {
  padding-left: 1rem; border-left: 1px solid var(--bfh-gray-600); font-weight: 700;
}
.ws-switch-btn {
  background: none; border: 0; border-left: 1px solid var(--bfh-gray-600); color: inherit;
  font: inherit; font-weight: 700; cursor: pointer; padding: 0.25rem 0.5rem 0.25rem 1rem;
  max-inline-size: 24rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ws-switch-btn::after { content: " ▾" / ""; font-weight: 400; color: var(--bfh-gray-400); }
.ws-menu { min-inline-size: 16rem; max-block-size: 70vh; overflow-y: auto; }
.ws-menu ul { list-style: none; }
.ws-menu li a {
  display: block; padding: var(--space-xs) var(--space-md); color: var(--bfh-dark);
  text-decoration: none;
}
.ws-menu li a:focus-visible { background: var(--bfh-gray-100); }
@media (hover: hover) { .ws-menu li a:hover { background: var(--bfh-gray-100); } }
.ws-menu li a:focus-visible { outline-offset: -2px; }
.ws-menu li a[aria-current="page"] { font-weight: 700; }
.ws-menu li:first-child { border-bottom: 1px solid var(--bfh-gray-200); }

/* Workspace head: name, collection line, tabs. */
.ws-head { margin-bottom: var(--space-xl); }
.ws-head h1 { margin-bottom: var(--space-2xs); }
.ws-collection { color: var(--bfh-gray-600); font-size: 0.9rem; margin-bottom: var(--space-lg); }
.ws-collection--open { color: var(--bfh-dark); }
.ws-tabs {
  display: flex; gap: var(--space-xl); border-bottom: 1px solid var(--bfh-gray-200);
  flex-wrap: wrap;
}
.ws-tabs a {
  padding: var(--space-xs) 0; margin-bottom: -1px; color: var(--bfh-gray-600);
  text-decoration: none; font-size: 0.9rem; border-bottom: 2px solid transparent;
}
@media (hover: hover) { .ws-tabs a:hover { color: var(--bfh-dark); } }
.ws-tabs a:focus-visible { outline: 2px solid var(--bfh-dark); outline-offset: 2px; }
.ws-tabs a[aria-current="page"] {
  color: var(--bfh-dark); font-weight: 700; border-bottom-color: var(--bfh-dark);
}
.ws-count {
  display: inline-block; min-width: 1.4em; padding: 0 0.35em; margin-left: 0.2em;
  background: var(--bfh-accent); color: var(--bfh-white); font-size: 0.75rem;
  font-weight: 700; text-align: center; line-height: 1.5;
}

.ws-empty, .ws-nothing { font-size: 0.95rem; margin-bottom: var(--space-lg); }
.ws-nothing strong { margin-right: 0.4em; }

/* Register tables: no boxes, hairline rows, room to read. */
.register { width: 100%; border-collapse: collapse; font-size: 0.9rem; background: transparent; }
.register th, .register td {
  text-align: left; vertical-align: baseline; padding: var(--space-sm) var(--space-md) var(--space-sm) 0;
  border-bottom: 1px solid var(--bfh-gray-200);
}
.register thead th {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--bfh-gray-600); padding-top: 0; border-bottom-color: var(--bfh-dark);
}
.register tbody th { font-weight: 400; }
.register tbody th a { color: var(--bfh-dark); font-weight: 700; text-decoration: none; }
@media (hover: hover) { .register tbody th a:hover { text-decoration: underline; } }
@media (hover: hover) { .register tbody tr:hover > * { background: var(--bfh-white); } }
.register .num { text-align: right; font-variant-numeric: tabular-nums; padding-right: var(--space-xl); }
.register th:last-child, .register td:last-child { padding-right: 0; }
.register-sub { display: block; color: var(--bfh-gray-600); font-size: 0.8rem; font-weight: 400; }
.register .code { font-weight: 700; margin-right: 0.35em; color: var(--bfh-gray-600); }
.register td.waiting { color: var(--bfh-accent); font-weight: 700; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
  white-space: nowrap;
}

/* Quality across programmes (PW2): a matrix of letters, hairlines, no boxes. */
.qa-section { margin-bottom: var(--space-xl); }
.qa-section h2 {
  font-size: 1.05rem; font-weight: 700; margin-bottom: var(--space-sm);
}
.qa-matrix-wrap { overflow-x: auto; }
.qa-matrix { border-collapse: collapse; font-size: 0.85rem; min-width: 100%; }
.qa-matrix th, .qa-matrix td { border-bottom: 1px solid var(--bfh-gray-200); }
.qa-prog-head { text-align: left; vertical-align: bottom; padding: 0 var(--space-md) var(--space-xs) 0;
  font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--bfh-gray-600); }
.qa-domain {
  font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 700;
  text-align: left; padding: 0 0 var(--space-2xs) var(--space-xs); border-bottom: 1px solid var(--bfh-dark);
}
.qa-comp {
  font-size: 0.7rem; font-weight: 400; color: var(--bfh-gray-600); text-align: center;
  padding: var(--space-2xs) 0 var(--space-xs); min-width: 3.2rem; white-space: nowrap;
  border-bottom: 1px solid var(--bfh-dark);
}
.qa-domain-start { border-left: 1px solid var(--bfh-gray-200); }
.qa-prog { text-align: left; font-weight: 400; padding: var(--space-sm) var(--space-md) var(--space-sm) 0;
  min-width: 16rem; }
.qa-prog a { color: var(--bfh-dark); font-weight: 700; text-decoration: none; }
@media (hover: hover) { .qa-prog a:hover { text-decoration: underline; } }
.qa-cell { text-align: center; position: relative; padding: var(--space-sm) 0; font-variant-numeric: tabular-nums; }
.qa-gap { color: var(--bfh-gray-400); background: transparent; }
.qa-mark {
  position: absolute; top: 3px; right: 4px; font-size: 0.7rem; font-weight: 700;
  color: var(--bfh-accent); line-height: 1;
}
.qa-legend { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-lg); font-size: 0.8rem;
  margin: var(--space-sm) 0 var(--space-2xs); color: var(--bfh-gray-600); }
.qa-key { display: inline-block; min-width: 1.6em; text-align: center; margin-right: 0.3em; }
.qa-key.qa-flagged { color: var(--bfh-accent); }
.qa-flags th:first-child { width: 34%; }
.qa-flags td { width: 33%; }
.qa-codes abbr {
  white-space: nowrap; cursor: help; text-decoration: underline dotted var(--bfh-gray-400);
  text-underline-offset: 3px;
}
.qa-flags thead th:not(:first-child) { text-transform: none; letter-spacing: 0; font-size: 0.8rem; }
.qa-data td.qa-issue { font-weight: 700; color: var(--bfh-dark); }
.qa-data th:first-child { width: 34%; }

.school-wide {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-sm) var(--space-lg);
  margin-top: var(--space-xl); padding-top: var(--space-md); border-top: 1px solid var(--bfh-gray-200);
  font-size: 0.9rem;
}
.school-wide a { color: var(--bfh-dark); text-decoration: none; }
.school-wide a:focus-visible { text-decoration: underline; }
@media (hover: hover) { .school-wide a:hover { text-decoration: underline; } }
.school-wide h2 {
  font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--bfh-gray-600);
}

/* Review groups: what asks something of you comes first and stays open. */
.review-group { margin-bottom: var(--space-2xs); }
.review-group[open] { margin-bottom: var(--space-xl); }
.review-group > summary {
  list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: var(--space-sm);
  padding: var(--space-xs) 0; font-size: 1.05rem; font-weight: 700;
}
.review-group > summary::-webkit-details-marker { display: none; }
.review-group > summary::before {
  content: "▸"; font-size: 0.8rem; color: var(--bfh-gray-600); width: 0.8rem;
  transition: transform 160ms cubic-bezier(0.25, 1, 0.5, 1);
}
.review-group[open] > summary::before { transform: rotate(90deg); }
.review-group > summary:focus-visible { outline: 2px solid var(--bfh-dark); outline-offset: 2px; }
/* MW13: open with a short height animation where ::details-content and
   interpolate-size exist; elsewhere they just open. */
@media (prefers-reduced-motion: no-preference) {
  .review-group, .send-back { interpolate-size: allow-keywords; }
  .review-group::details-content, .send-back::details-content {
    block-size: 0; overflow-y: clip;
    transition: block-size 200ms cubic-bezier(0.25, 1, 0.5, 1), content-visibility 200ms allow-discrete;
  }
  .review-group[open]::details-content, .send-back[open]::details-content { block-size: auto; }
}
.review-group-count { color: var(--bfh-gray-600); font-weight: 400; font-variant-numeric: tabular-nums; }
.review-group:not(.review-group--done) > summary { font-size: 0.95rem; }
.review-group--done > summary .review-group-count { color: var(--bfh-accent); font-weight: 700; }
.review .changed-count { color: var(--bfh-accent); }
.review td:nth-child(2), .review td:nth-child(3) { width: 22%; }
.review td.num { width: 8rem; }

.next-review { float: right; font-weight: 700; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  .review-group > summary::before { transition: none; }
}
@media print {
  .ws-switch, .ws-tabs, .school-wide, .next-review { display: none; }
  .review-group:not([open]) > table { display: table; }
}
/* The header holds app name, programme and identity: nothing wraps, the long
   names shorten with an ellipsis (full name in the title / the menu). */
.bfh-header .bfh-app-name { white-space: nowrap; }
.ws-switch.ws-fixed {
  max-width: 24rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ws-switch { min-width: 0; flex-shrink: 1; }
.bfh-header .bfh-logout, .bfh-header .bfh-help, .bfh-header .bfh-lang { white-space: nowrap; flex-shrink: 0; }

/* --- Modules tab (PW9–PW16) ----------------------------------------------------
   Groups are sections, not cards; row actions stay quiet until needed. */
.mt-filters {
  display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-sm) var(--space-lg);
  margin: 0 0 var(--space-lg); font-size: 0.8rem; color: var(--bfh-gray-600);
}
.mt-filters label { display: grid; gap: var(--space-2xs); }
.mt-search { flex: 1 1 18rem; }
.mt-search input, .mt-filters select, .mt-place input[type=search] {
  font: inherit; font-size: 0.9rem; padding: 0.45rem 0.6rem; border: 1px solid var(--bfh-gray-400);
  background: var(--bfh-white); color: var(--bfh-dark); width: 100%;
}
.mt-filters select { width: auto; min-width: 9rem; }
.mt-count { font-size: 0.9rem; margin-bottom: var(--space-lg); }
.mt-count a { margin-left: var(--space-sm); }

.mt-group { margin-bottom: var(--space-xl); scroll-margin-top: var(--space-lg); }
.mt-group-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-xs) var(--space-md);
  margin-bottom: var(--space-xs);
}
.mt-group-head h2 { font-size: 1.05rem; }
.mt-sem { color: var(--bfh-gray-600); font-size: 0.85rem; margin-right: auto; }

.mt-inline { font-size: 0.8rem; }
.mt-inline > summary {
  list-style: none; cursor: pointer; color: var(--bfh-gray-600); text-decoration: underline;
  text-underline-offset: 2px;
}
.mt-inline > summary::-webkit-details-marker { display: none; }
@media (hover: hover) { .mt-inline > summary:hover { color: var(--bfh-dark); } }
.mt-inline > summary:focus-visible { outline: 2px solid var(--bfh-dark); outline-offset: 2px; }
.mt-inline[open] > summary { color: var(--bfh-dark); }
.mt-group-head .mt-inline[open] { flex-basis: 100%; order: 5; }
.mt-inline-form {
  display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-xs) var(--space-sm);
  margin-top: var(--space-xs);
}
.mt-inline-form label { display: grid; gap: var(--space-2xs); font-size: 0.75rem; color: var(--bfh-gray-600); }
.mt-inline-form input, .mt-inline-form select {
  font: inherit; font-size: 0.85rem; padding: 0.35rem 0.5rem; border: 1px solid var(--bfh-gray-400);
  background: var(--bfh-white);
}
.mt-num { width: 5rem; }
.mt-danger > summary { color: var(--bfh-gray-600); }
.link-button {
  background: none; border: 0; padding: 0; font: inherit; color: var(--bfh-dark);
  text-decoration: underline; cursor: pointer;
}

.mt-table td, .mt-table th { vertical-align: middle; }
.mt-table td:nth-child(2) { width: 12rem; }
.mt-table select { font: inherit; font-size: 0.85rem; padding: 0.25rem 0.35rem;
  border: 1px solid var(--bfh-gray-200); background: transparent; }
.mt-table select:focus { border-color: var(--bfh-gray-600); background: var(--bfh-white); }
@media (hover: hover) { .mt-table select:hover { border-color: var(--bfh-gray-600); background: var(--bfh-white); } }
.mt-level {
  color: var(--bfh-dark); text-decoration: underline dotted var(--bfh-gray-400);
  text-underline-offset: 3px;
}
@media (hover: hover) { .mt-level:hover { text-decoration-style: solid; } }
.mt-saved { margin-left: var(--space-xs); font-size: 0.75rem; color: #065f46; }
.mt-table tr.just-saved > * { animation: saved-row 2.4s ease-out; }
.mt-status { font-size: 0.8rem; white-space: nowrap; }
.mt-status--done { color: #1e40af; font-weight: 700; }
.mt-status--returned { color: var(--bfh-accent); font-weight: 700; }
.mt-status--approved { color: #065f46; }
.mt-status--not_started { color: var(--bfh-gray-600); }

.mt-actions { white-space: nowrap; text-align: right; width: 1%; padding-right: 0; }
.mt-actions > form { display: inline-flex; gap: 2px; vertical-align: middle; }
.icon-button {
  width: 2rem; height: 2rem; border: 1px solid transparent; background: none; cursor: pointer;
  font-size: 0.95rem; color: var(--bfh-dark);
}
@media (hover: hover) { .icon-button:hover:not(:disabled) { border-color: var(--bfh-gray-400); background: var(--bfh-white); } }
.icon-button:focus-visible { outline: 2px solid var(--bfh-dark); outline-offset: 1px; }
.icon-button:disabled { color: var(--bfh-gray-200); cursor: default; }
.mt-menu { display: inline-block; margin-left: var(--space-xs); vertical-align: middle; }
.mt-menu-body {
  inline-size: 22rem; padding: var(--space-md); gap: var(--space-md); text-align: left;
  white-space: normal;
}
.mt-menu-body:popover-open { display: grid; }
.mt-menu-body form { display: grid; gap: var(--space-xs); justify-items: start; }
.mt-menu-body label { display: grid; gap: var(--space-2xs); font-size: 0.75rem; color: var(--bfh-gray-600); width: 100%; }
.mt-menu-body select { width: 100%; }
.mt-menu-body form + form { border-top: 1px solid var(--bfh-gray-200); padding-top: var(--space-md); }

.mt-new { margin-top: var(--space-sm); font-size: 0.85rem; }
.mt-new > summary { cursor: pointer; color: var(--bfh-gray-600); }
.mt-new[open] > summary { margin-bottom: var(--space-sm); color: var(--bfh-dark); }

.mt-place, .mt-add-group {
  margin-top: var(--space-xl); padding-top: var(--space-lg); border-top: 1px solid var(--bfh-dark);
}
.mt-place h2, .mt-add-group h2 { font-size: 1.05rem; margin-bottom: var(--space-sm); }
.mt-place > form { display: flex; gap: var(--space-sm); align-items: center; max-width: 40rem;
  margin-bottom: var(--space-md); }

@media print {
  .mt-filters, .mt-actions, .mt-inline, .mt-new, .mt-place, .mt-add-group { display: none; }
}
.mt-place-results th { width: 45%; }
.mt-place-results td { width: 55%; }
.mt-place-results .mt-inline-form { flex-wrap: nowrap; justify-content: flex-end; margin-top: 0; }

/* --- Module page as the module's home (PW18–PW22) ----------------------------- */
.module-facts {
  display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--space-xl);
  margin: var(--space-lg) 0 var(--space-xl);
}
@media (max-width: 860px) { .module-facts { grid-template-columns: 1fr; } }
.module-section { margin-bottom: var(--space-xl); }
.module-facts .module-section { margin-bottom: 0; }
.module-section h2, .version > h2 {
  font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: var(--space-sm);
}
.module-section-head { display: flex; align-items: baseline; gap: var(--space-sm); }
.facts {
  display: grid; grid-template-columns: max-content 1fr; gap: var(--space-xs) var(--space-lg);
  font-size: 0.9rem; padding-top: var(--space-sm); border-top: 1px solid var(--bfh-dark);
}
.facts dt { color: var(--bfh-gray-600); font-size: 0.8rem; }
.facts dd { margin: 0; }
.module-edit, .module-delete { margin-top: var(--space-sm); }
.module-edit form { margin-top: var(--space-sm); }
.appears { list-style: none; border-top: 1px solid var(--bfh-dark); }
.appears li { padding: var(--space-xs) 0; border-bottom: 1px solid var(--bfh-gray-200); font-size: 0.9rem; }
.appears a, .appears-prog { color: var(--bfh-dark); font-weight: 700; text-decoration: none; }
@media (hover: hover) { .appears a:hover { text-decoration: underline; } }

/* Versions: sections under a rule, not boxes inside boxes. */
.version {
  border-top: 1px solid var(--bfh-dark); padding-top: var(--space-md); margin-top: var(--space-xl);
}
.version > h2 { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs); }

/* --- People & links tab (PW24–PW28) -------------------------------------------- */
.pl-section { margin-bottom: var(--space-xl); scroll-margin-top: var(--space-lg); }
.pl-section > h2, .pl-head h2 { font-size: 1.05rem; margin-bottom: var(--space-sm); }
.pl-head { display: flex; align-items: baseline; gap: var(--space-md); flex-wrap: wrap; }
.pl-bulk { display: flex; align-items: center; gap: var(--space-md); margin-bottom: var(--space-sm); font-size: 0.85rem; }
.pl-check { width: 2rem; padding-right: var(--space-xs); }
.pl-check input { width: 1rem; height: 1rem; }
.pl-lect td:nth-child(3) { width: 24%; }
.pl-state { width: 26%; }
.pl-row-form { display: inline-flex; gap: var(--space-md); margin-left: var(--space-sm); font-size: 0.85rem; }
.pl-status { font-size: 0.85rem; }
.pl-status--revoked, .pl-status--expired { color: var(--bfh-gray-600); }
.pl-add { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-sm) var(--space-xl); margin-top: var(--space-sm); }
.pl-viewer { display: flex; align-items: baseline; gap: var(--space-sm); font-size: 0.85rem; }
.mt-menu-body label input, .mt-menu-body label select { font: inherit; font-size: 0.85rem; padding: 0.35rem 0.5rem;
  border: 1px solid var(--bfh-gray-400); background: var(--bfh-white); }
@media print { .pl-bulk, .pl-check, .pl-add, .mt-new { display: none; } }
.mt-actions > form.pl-row-form { gap: var(--space-md); margin-left: var(--space-md); }
.pl-section .copy-btn {
  background: none; border: 0; padding: 0; font: inherit; font-size: 0.85rem; font-weight: 400;
  text-transform: none; letter-spacing: 0; color: var(--bfh-dark); text-decoration: underline;
  text-underline-offset: 2px; cursor: pointer;
}
.pl-section .copy-btn:focus-visible { color: var(--bfh-accent); }
@media (hover: hover) { .pl-section .copy-btn:hover { color: var(--bfh-accent); } }
.pl-section .mt-menu { margin-left: var(--space-md); }

/* --- Your modules on the lecturer form (PW30) ----------------------------------- */
.your-modules { margin: var(--space-lg) 0; scroll-margin-top: var(--space-lg); }
.your-modules h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: var(--space-xs); }
.your-modules ul { list-style: none; border-top: 1px solid var(--bfh-dark); }
.your-modules li {
  display: grid; grid-template-columns: minmax(0, 1fr) 8rem 8rem 7rem; gap: var(--space-md);
  align-items: baseline; padding: var(--space-xs) 0; border-bottom: 1px solid var(--bfh-gray-200);
  font-size: 0.9rem;
}
.your-modules .code { font-weight: 700; color: var(--bfh-gray-600); }
.ym-role { color: var(--bfh-gray-600); font-size: 0.85rem; }
.ym-current .ym-name { font-weight: 700; }
.ym-here { font-size: 0.8rem; color: var(--bfh-dark); justify-self: end; }
.ym-form { display: flex; gap: var(--space-sm); align-items: baseline; margin-top: var(--space-sm);
  font-size: 0.85rem; color: var(--bfh-gray-600); }
@media (max-width: 640px) { .your-modules li { grid-template-columns: 1fr auto; } .ym-role { display: none; } }
@media print { .your-modules { display: none; } }

/* --- Modern web platform (MW5–MW9) ---------------------------------------------- */
/* MW5: wide tables scroll sideways in a focusable region. */
.scroll-x, .qa-matrix-wrap { overflow-x: auto; }

/* MW6: copy feedback, next to the button (a live region). */
.copy-status {
  margin-left: var(--space-xs); font-size: 0.75rem; font-weight: 700; color: #065f46;
  opacity: 0; transition: opacity 150ms;
}
.copy-status.shown { opacity: 1; }
.copy-status[data-failed] { color: var(--bfh-accent); }
@media (prefers-reduced-motion: reduce) { .copy-status { transition: none; } }
.copy-holder { position: fixed; left: -9999px; }

/* MW8: the merge question. */
.confirm-dialog {
  margin: auto; max-inline-size: min(32rem, calc(100vw - 2rem)); padding: var(--space-lg);
  border: 1px solid var(--bfh-dark); color: var(--bfh-dark);
}
.confirm-dialog p + p { margin-top: var(--space-xs); color: var(--bfh-gray-600); font-size: 0.85rem; }
.dialog-actions { display: flex; gap: var(--space-xs); justify-content: flex-end; margin-top: var(--space-lg); }
dialog:modal { overscroll-behavior: contain; }
dialog::backdrop { background: rgba(0, 0, 0, 0.35); overflow: hidden; overscroll-behavior: contain; }

/* MW9: what used to be inline style attributes. */
.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 0.75rem; }
.mt-lg { margin-top: 1.5rem; }
.ml-xs { margin-left: 0.5rem; }
.success-print { margin: 1rem 0 1.25rem; }
.print-link { margin: 0.75rem 0 1rem; }
.field.basis-110 { flex-basis: 110px; }
.field.basis-90 { flex-basis: 90px; }
.row-form { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; }
form.inline { display: inline; }
.nowrap { white-space: nowrap; }
.cell-actions { white-space: nowrap; text-align: right; }
.col-level { width: 60px; text-align: center; }
.center { text-align: center; }
.legend-swatch.swatch-introduced { background: #dbeafe; }
.legend-swatch.swatch-reinforced { background: #fef3c7; }
.legend-swatch.swatch-mastered { background: #d1fae5; }
.legend-swatch.swatch-none { background: #fff; }
.legend-swatch.swatch-missing { background: #fee2e2; }
.plain-page { max-width: 620px; margin: 4rem auto; padding: 0 1rem; }

/* --- Staff navigation (NV1–NV3) --------------------------------------------------- */
/* Manage, right of the programme switcher: quieter until you are on one of its pages. */
.ws-manage { flex: none; font-size: 0.85rem; color: var(--bfh-gray-400); }
.ws-manage-btn.is-current { color: var(--bfh-white); }
@media (hover: hover) { .ws-manage-btn:hover { color: var(--bfh-white); } }
.manage-index th:first-child { width: 14rem; }
.manage-index td.num { width: 6rem; }
@media print { .ws-manage { display: none; } }

/* --- Manage pages in the workspace look (MP1–MP4) ------------------------------- */
.mt-actions > .mt-menu + .mt-menu, .mt-actions .menu-btn + form.inline { margin-left: var(--space-md); }
.mp-row-action { margin-left: var(--space-md); }
.mp-programmes td.num a { color: var(--bfh-dark); }
.mp-domain { margin-bottom: var(--space-xl); }
.mp-domain > h2, .mp-programme { font-size: 1.05rem; margin-bottom: var(--space-sm); }
.mp-programme { margin-top: var(--space-lg); }
.mp-competences td.code { width: 6rem; font-weight: 700; color: var(--bfh-gray-600); }
.mp-competences td.num { width: 5rem; }
.mp-competences td:nth-child(3) { width: 12rem; }
.mp-archived { margin-left: var(--space-xs); font-size: 0.75rem; font-weight: 400; color: var(--bfh-gray-600); }
.mp-add { margin-top: var(--space-lg); }
.mp-add form { margin-top: var(--space-sm); }
.mp-add .mp-fields + button { margin-top: var(--space-sm); }
/* The competence fields: a two-column grid; descriptions span both. */
.mp-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm) var(--space-md); }
.mp-fields label { display: grid; gap: var(--space-2xs); font-size: 0.75rem; color: var(--bfh-gray-600); }
.mp-fields .mp-wide { grid-column: 1 / -1; }
.mp-fields input, .mp-fields textarea { font: inherit; font-size: 0.9rem; color: var(--bfh-dark); }
.mp-add .mp-fields { max-width: 48rem; }
.mp-dialog { inline-size: min(44rem, calc(100vw - 2rem)); max-inline-size: none; text-align: left; white-space: normal; }
.mp-dialog h2 { font-size: 1.05rem; margin-bottom: var(--space-md); }
.mp-lecturers td:nth-child(2) { width: 14rem; }
.mp-lecturers td:nth-child(3) { width: 12rem; }
.mp-links td:nth-child(3), .mp-links td:nth-child(4), .mp-links td:nth-child(5) { width: 8rem; }
/* What you type is regular text, not the label's bold (fields wrapped in their label). */
label input, label select, label textarea { font-weight: 400; }
.pl-head form .link-button { font-size: 0.85rem; }
