/* ============================================================================
   Academic Portal — design system (v2)

   One calm, typography-first workspace for a single academic professional.
   Structure of this file:
     1. Tokens        colors (semantic), type scale, space scale, radii, shadows
     2. Base          reset, typography, links, focus, forms
     3. Shell         sidebar, top bar, mobile drawer
     4. Primitives    page head, panel, section, list/row, timeline, facts,
                      status, badge, source mark, tabs, buttons, notices,
                      empty states, metrics, tables (responsive)
     5. Compositions  overview, career, publications, teaching, research,
                      integrations, auth/forms
   Colour is semantic only: blue = interactive/current, green = complete,
   amber = needs attention, red = problem, grey = inactive/secondary.
   No gradients, no glass, no decorative shadows. Native controls and
   <details> work without JavaScript.
   ========================================================================== */

/* 1. Tokens ----------------------------------------------------------------- */
/* IBM Plex Sans (SIL Open Font License 1.1, see static/fonts/OFL.txt), self-hosted.
   Latin subset only; other characters fall back to the system UI font. */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/IBMPlexSans-Regular-Latin1.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/IBMPlexSans-Medium-Latin1.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/IBMPlexSans-SemiBold-Latin1.woff2") format("woff2"); }

:root {
  /* surfaces */
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #f1f3f7;
  --line: #e3e6eb;
  --line-strong: #c9cfd8;
  --line-hair: #edeff3;
  /* text */
  --fg: #14181f;
  --fg-2: #4a5361;
  --muted: #5b6472;
  --faint: #8a93a1;
  /* accent (interactive, current) */
  --accent: #1f4fd8;
  --accent-hover: #1a43b8;
  --accent-soft: #eef3fe;
  --accent-line: #c7d5f7;
  --accent-fg: #ffffff;
  /* semantic */
  --ok: #1a7f4b;
  --ok-soft: #eaf6ef;
  --ok-line: #b7e1c8;
  --warn: #8a5a00;
  --warn-soft: #fff8e8;
  --warn-line: #ead9ae;
  --err: #b42318;
  --err-soft: #fef3f2;
  --err-line: #fecdca;
  /* type scale */
  --t-xs: .75rem;
  --t-sm: .8125rem;
  --t-base: .875rem;
  --t-md: .9375rem;
  --t-lg: 1.0625rem;
  --t-xl: 1.625rem;
  --t-2xl: 1.75rem;
  /* space scale (4px base) */
  --s-1: .25rem;
  --s-2: .5rem;
  --s-3: .75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  /* shape */
  --r-1: 4px;
  --r-2: 6px;
  --r-3: 8px;
  --sh-1: none;
  --sh-menu: 0 8px 24px rgb(16 24 40 / .12);
  /* layout */
  --w-page: 80rem;
  --w-read: 46rem;
  --sidebar-w: 15rem;
  --topbar-h: 3.25rem;
  /* aliases kept for the Agenda stylesheet and legacy markup */
  --error: var(--err);
  --error-soft: var(--err-soft);
  --tag: var(--surface-3);
  --radius: var(--r-3);
  --radius-sm: var(--r-2);
  --shadow: var(--sh-1);
  --menu-shadow: var(--sh-menu);
  --space: var(--s-5);
  color-scheme: light;
}

/* 2. Base --------------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: var(--t-base)/1.5 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; color: var(--fg); letter-spacing: -.012em; }
h1 { font-size: var(--t-xl); line-height: 1.2; font-weight: 650; }
h2 { font-size: var(--t-md); line-height: 1.3; font-weight: 650; }
h3 { font-size: var(--t-base); line-height: 1.35; font-weight: 600; }
p { margin: 0 0 var(--s-3); }
a { color: var(--accent); text-underline-offset: .18em; overflow-wrap: anywhere; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-1); }
::selection { background: var(--accent-line); }
code, kbd { font: .85em ui-monospace, SFMono-Regular, Menlo, monospace; }
code { background: var(--surface-3); padding: .08em .35em; border-radius: var(--r-1); }
kbd { border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: var(--r-1); padding: 0 .35em; background: var(--surface); color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-5) 0; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: var(--s-3); top: -3rem; background: var(--accent); color: var(--accent-fg); padding: var(--s-2) var(--s-3); border-radius: var(--r-2); z-index: 100; }
.skip-link:focus { top: var(--s-3); }
.muted, .quiet { color: var(--muted); }
.quiet { font-size: var(--t-sm); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.ico { width: 1.05rem; height: 1.05rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.go { width: .95rem; height: .95rem; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; color: var(--faint); }

/* forms */
label { display: block; font-size: var(--t-sm); font-weight: 600; color: var(--fg-2); }
input, select, textarea {
  font: inherit; color: var(--fg); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-2);
  padding: .5rem .65rem; min-height: 2.5rem; max-width: 100%;
}
input[type="checkbox"], input[type="radio"] { min-height: 0; width: 1rem; height: 1rem; accent-color: var(--accent); }
textarea { min-height: 6rem; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input::placeholder { color: var(--faint); }
label > input, label > select, label > textarea { display: block; margin-top: var(--s-1); width: 100%; font-weight: 400; }
fieldset { border: 1px solid var(--line); border-radius: var(--r-3); padding: var(--s-4); margin: 0 0 var(--s-4); background: var(--surface); }
legend { font-weight: 600; padding: 0 var(--s-2); }
.field { display: block; margin-bottom: var(--s-4); font-weight: 500; color: var(--fg-2); }
/* Controls take the full width on their own line; the label text and the
   required mark share the first line. */
.field > input:not([type="checkbox"]):not([type="radio"]), .field > select, .field > textarea, .field > datalist { display: block; width: 100%; box-sizing: border-box; margin-top: var(--s-1); }
.field .req { color: var(--err); margin-left: 2px; }
.error, [role="alert"].error { color: var(--err); background: var(--err-soft); border: 1px solid var(--err-line); border-radius: var(--r-2); padding: var(--s-2) var(--s-3); font-size: var(--t-sm); }
.flash { margin: 0 0 var(--s-4); padding: var(--s-2) var(--s-3); border: 1px solid var(--ok-line); background: var(--ok-soft); color: var(--ok); border-radius: var(--r-2); font-size: var(--t-sm); }

/* buttons */
.btn, .button, button.btn-quiet, a.btn-quiet, button[type="submit"], button.link-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 2.5rem; padding: .45rem .9rem; border-radius: var(--r-2);
  font: inherit; font-weight: 600; font-size: var(--t-sm); line-height: 1.2; text-decoration: none; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-fg);
}
.btn:hover, .button:hover, button[type="submit"]:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-fg); }
.btn-ghost, button.btn-quiet, a.btn-quiet, .btn-quiet {
  background: var(--surface); color: var(--fg-2); border: 1px solid var(--line-strong);
}
.btn-ghost:hover, .btn-quiet:hover { background: var(--surface-2); color: var(--fg); border-color: var(--faint); }
.btn-quiet.is-on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.btn-danger { background: var(--surface); color: var(--err); border-color: var(--err-line); }
.btn-danger:hover { background: var(--err-soft); color: var(--err); border-color: var(--err); }
.btn-sm, .button.btn-sm { min-height: 2.1rem; padding: .3rem .7rem; font-size: var(--t-sm); }
button[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
button.link, .link { background: none; border: 0; padding: 0; min-height: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: .18em; }
.inline, .inline-tight { display: inline; margin: 0; }

/* 3. Shell ---------------------------------------------------------------------- */
/* Sidebar: the six groups of the approved design, every destination one click away.
   Pinned on desktop; the header button hides it (state kept per viewer). Below
   62rem it becomes a drawer opened from the header. */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.shell-main { min-width: 0; display: flex; flex-direction: column; }
main { width: 100%; max-width: var(--w-page); margin: 0 auto; padding: var(--s-5) clamp(1rem, 3vw, 1.5rem) var(--s-7); box-sizing: border-box; flex: 1; overflow-wrap: anywhere; }
body:not(.has-shell) main { max-width: 34rem; padding-top: var(--s-7); }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overscroll-behavior: contain; box-sizing: border-box;
  background: var(--surface); border-right: 1px solid var(--line); padding: var(--s-3) var(--s-3) var(--s-5);
  display: flex; flex-direction: column; gap: var(--s-3);
}
.sb-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding: var(--s-1) var(--s-1) 0; }
.brand { display: flex; align-items: center; gap: .55rem; color: var(--fg); text-decoration: none; font-weight: 600; font-size: var(--t-md); letter-spacing: -.01em; white-space: nowrap; min-width: 0; }
.brand:hover { color: var(--fg); }
.brand-mark { display: grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: var(--r-1); background: var(--accent); color: var(--accent-fg); flex: none; }
.brand-mark .ico { width: .85rem; height: .85rem; }
.sb-collapse { width: 2rem; height: 2rem; }

.sidenav { display: flex; flex-direction: column; gap: var(--s-3); }
.sidegroup-title { margin: 0 var(--s-2) var(--s-1); font-size: var(--t-xs); font-weight: 600; color: var(--muted); letter-spacing: .02em; text-transform: uppercase; }
.sidegroup ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.navlink {
  display: flex; align-items: center; min-height: 2rem; padding: .25rem var(--s-2); border-radius: var(--r-2);
  text-decoration: none; color: var(--fg-2); font-size: var(--t-base); font-weight: 400;
}
.navlink:hover { background: var(--surface-3); color: var(--fg); }
.navlink[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 500; }

/* Collapsed desktop sidebar: the grid column closes and the page takes the width. */
body.sb-hidden .shell { grid-template-columns: minmax(0, 1fr); }
body.sb-hidden .sidebar { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 20; min-height: 3.25rem; display: flex; align-items: center; gap: var(--s-3);
  padding: 0 clamp(1rem, 3vw, 1.5rem); background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar > * { flex: none; }
.icon-btn { display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: var(--r-2); border: 1px solid var(--line); background: var(--surface); color: var(--fg-2); cursor: pointer; padding: 0; }
.icon-btn:hover { background: var(--surface-3); }
.icon-btn.nav-toggle { display: none; }
.search-chip { display: inline-flex; align-items: center; gap: var(--s-2); height: 2.1rem; padding: 0 var(--s-3); border: 1px solid var(--line-strong); border-radius: var(--r-2); color: var(--muted); text-decoration: none; background: var(--surface); font-size: var(--t-sm); margin-left: auto; }
.search-chip:hover { border-color: var(--fg-2); color: var(--fg-2); }
.search-chip kbd { margin-left: var(--s-3); font-size: var(--t-xs); color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 0 .3rem; }
.profile { position: relative; }
.profile > summary { list-style: none; display: flex; align-items: center; gap: var(--s-2); cursor: pointer; padding: .2rem .4rem; border-radius: var(--r-2); }
.profile > summary::-webkit-details-marker { display: none; }
.profile > summary:hover { background: var(--surface-3); }
.avatar { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.profile-name { font-size: var(--t-sm); font-weight: 500; color: var(--fg-2); }
.profile-menu { position: absolute; right: 0; top: calc(100% + .35rem); min-width: 14rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--sh-menu); padding: var(--s-2); z-index: 30; }
.profile-menu a, .profile-menu .link { display: block; padding: .45rem .6rem; border-radius: var(--r-2); text-decoration: none; color: var(--fg-2); font-size: var(--t-sm); text-align: left; }
.profile-menu a:hover, .profile-menu .link:hover { background: var(--surface-3); color: var(--fg); }
.profile-who { margin: 0; padding: .35rem .6rem .5rem; font-size: var(--t-xs); color: var(--muted); border-bottom: 1px solid var(--line); }
.logout { margin: 0; }
.logout .link { width: 100%; text-decoration: none; }
.scrim { position: fixed; inset: 0; background: rgb(16 24 40 / .4); z-index: 40; }

@media (max-width: 61.99rem) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  body.sb-hidden .sidebar { display: flex; }
  .sidebar { position: fixed; z-index: 50; inset: 0 auto 0 0; width: min(19rem, 86vw); transform: translateX(-102%); transition: transform .18s ease; box-shadow: var(--sh-menu); }
  body.nav-open .sidebar { transform: none; }
  .sb-collapse { display: none; }
  .icon-btn.nav-toggle { display: inline-grid; }
  .search-chip { min-width: 0; padding: 0; width: 2.4rem; justify-content: center; height: 2.4rem; }
  .search-chip span, .search-chip kbd { display: none; }
  .profile-name { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* 4. Primitives ------------------------------------------------------------------ */

/* page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-5); }
.page-head > div:first-child { min-width: 0; }
.page-sub { margin: var(--s-1) 0 0; color: var(--muted); font-size: var(--t-base); max-width: 46rem; }
.page-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; }
.crumbs { margin: 0 0 var(--s-2); font-size: var(--t-sm); color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
/* legacy heading row used by forms/views not yet rebuilt */
.heading-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-4); }

/* layout helpers */
.stack { display: grid; gap: var(--s-4); }
.stack-sm { display: grid; gap: var(--s-3); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.layout-aside { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: var(--s-5); align-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-5); align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
@media (max-width: 62rem) { .layout-aside, .grid-2 { grid-template-columns: minmax(0, 1fr); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 40rem) { .grid-3 { grid-template-columns: minmax(0, 1fr); } }

/* panel & section */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--sh-1); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); }
.panel-title { font-size: var(--t-base); font-weight: 650; }
.panel-note { font-size: var(--t-sm); color: var(--muted); }
.panel-body { padding: var(--s-4); }
.panel-foot { padding: var(--s-2) var(--s-4); border-top: 1px solid var(--line); font-size: var(--t-sm); background: var(--surface-2); border-radius: 0 0 var(--r-3) var(--r-3); }
.sec { margin: 0; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-3); }
.sec-title { font-size: var(--t-md); font-weight: 650; }
.sec-note { color: var(--muted); font-size: var(--t-sm); }
.link-more { display: inline-flex; align-items: center; gap: .25rem; font-size: var(--t-sm); font-weight: 600; text-decoration: none; white-space: nowrap; }
.link-more:hover { text-decoration: underline; }

/* list / row: the default representation of "a thing with a date" */
.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--line); }
.row { display: grid; grid-template-columns: var(--lead, 5.5rem) minmax(0, 1fr) auto; gap: var(--s-3); align-items: start; padding: var(--s-3) var(--s-4); color: inherit; text-decoration: none; }
.row.no-lead { grid-template-columns: minmax(0, 1fr) auto; }
a.row:hover { background: var(--surface-2); }
a.row:hover .row-title { color: var(--accent); }
.row-lead { color: var(--muted); font-size: var(--t-sm); padding-top: .12rem; line-height: 1.35; }
.row-lead strong { display: block; color: var(--fg-2); font-weight: 600; }
.row-main { min-width: 0; }
.row-title { font-weight: 600; color: var(--fg); line-height: 1.35; }
.row-sub { color: var(--muted); font-size: var(--t-sm); margin-top: 2px; }
.row-sub > * + *::before { content: "·"; margin: 0 .4em; color: var(--faint); }
.row-end { display: flex; align-items: center; gap: var(--s-2); justify-content: flex-end; text-align: right; color: var(--muted); font-size: var(--t-sm); white-space: nowrap; }
.row.is-past .row-title { color: var(--fg-2); font-weight: 550; }
.group-label { padding: var(--s-2) var(--s-4); background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: var(--t-xs); font-weight: 650; color: var(--muted); letter-spacing: .02em; }
.list > li.group-label { border-top: 1px solid var(--line); }
.list > li.group-label:first-child { border-top: 0; border-radius: var(--r-3) var(--r-3) 0 0; }
@media (max-width: 40rem) {
  .row { grid-template-columns: minmax(0, 1fr) auto; padding: var(--s-3); gap: var(--s-1) var(--s-3); }
  .row-lead { grid-column: 1 / -1; padding: 0; order: -1; display: flex; gap: .5em; }
  .row-lead strong { display: inline; }
}

/* timeline: chronological career records */
.tl { list-style: none; margin: 0; padding: 0; position: relative; }
.tl { --when: 5.2rem; }
.tl--wide { --when: 9.2rem; }
.tl::before { content: ""; position: absolute; left: calc(var(--when) + .85rem); top: .6rem; bottom: .6rem; width: 1px; background: var(--line-strong); }
.tl-item { display: grid; grid-template-columns: var(--when) 1.7rem minmax(0, 1fr); gap: 0; position: relative; padding: var(--s-2) 0; }
.tl-when { text-align: right; padding-right: var(--s-3); color: var(--muted); font-size: var(--t-sm); padding-top: .12rem; line-height: 1.3; }
.tl-when strong { display: block; color: var(--fg-2); font-weight: 600; }
.tl-dot { position: relative; }
.tl-dot::before { content: ""; position: absolute; left: .55rem; top: .38rem; width: .65rem; height: .65rem; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.tl-item.is-current .tl-dot::before { border-color: var(--accent); background: var(--accent); }
.tl-what { padding: 0 0 var(--s-1) var(--s-2); min-width: 0; }
.tl-title { font-weight: 600; line-height: 1.35; }
.tl-title a { color: inherit; text-decoration: none; }
.tl-title a:hover { color: var(--accent); text-decoration: underline; }
.tl-sub { color: var(--muted); font-size: var(--t-sm); margin-top: 2px; }
.tl-sub > * + *::before { content: "·"; margin: 0 .4em; color: var(--faint); }
.tl--grade .tl-dot::before { border-radius: 2px; transform: rotate(45deg); }
.tl--grade .tl-item.is-current .tl-dot::before { border-color: var(--fg-2); background: var(--fg-2); }
@media (max-width: 40rem) {
  .tl::before { left: .55rem; }
  .tl-item { grid-template-columns: 1.1rem minmax(0, 1fr); }
  .tl-when { grid-column: 2; grid-row: 2; text-align: left; padding: 0 0 0 var(--s-2); }
  .tl-dot { grid-column: 1; grid-row: 1 / span 2; }
  .tl-dot::before { left: 0; }
  .tl-what { grid-column: 2; grid-row: 1; padding-left: var(--s-2); }
}

/* facts: label/value pairs */
.facts { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-6); margin: 0; }
.facts > div { min-width: 0; }
.facts dt { font-size: var(--t-xs); color: var(--muted); font-weight: 500; }
.facts dd { margin: 0; font-weight: 600; color: var(--fg); }
.facts-stack { display: grid; gap: var(--s-3); margin: 0; }
.facts-stack > div { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: var(--s-3); }
.facts-stack dt { font-size: var(--t-sm); color: var(--muted); }
.facts-stack dd { margin: 0; }

/* status, badges, source mark */
.dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--faint); flex: none; }
.dot-ok, .dot--ok { background: var(--ok); }
.dot-warn, .dot--warn { background: #d97706; }
.dot-err, .dot--err { background: var(--err); }
.dot-busy, .dot--info { background: var(--accent); }
.status { display: inline-flex; align-items: center; gap: .45rem; font-size: var(--t-sm); font-weight: 500; color: var(--fg-2); }
.badge, .tag, .pill, .status-pill {
  display: inline-flex; align-items: center; gap: .3rem; padding: .08rem .5rem; border-radius: 999px; font-size: var(--t-xs); font-weight: 600; line-height: 1.5;
  background: var(--surface-3); color: var(--fg-2); border: 1px solid var(--line); white-space: nowrap;
}
.badge--ok, .state-linked, .state-ok, .st-ongoing, .st-completed { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.badge--warn, .state-unlinked, .state-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.badge--err, .state-failed, .state-error { background: var(--err-soft); color: var(--err); border-color: var(--err-line); }
.badge--info, .state-running { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.badge--muted { background: var(--surface-3); color: var(--muted); }
.tag.archived { background: var(--surface-3); color: var(--muted); }
.src { font-size: var(--t-xs); color: var(--faint); font-weight: 500; white-space: nowrap; cursor: help; border-bottom: 1px dotted var(--line-strong); }
.src:hover { color: var(--muted); }

/* tabs and segmented control */
.seg { display: inline-flex; padding: 2px; background: var(--surface-3); border-radius: var(--r-2); gap: 2px; max-width: 100%; overflow-x: auto; }
.seg a, .seg button { min-height: 2rem; padding: .25rem .8rem; border-radius: var(--r-1); border: 0; background: transparent; color: var(--muted); font: inherit; font-size: var(--t-sm); font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; }
.seg a:hover, .seg button:hover { color: var(--fg); }
.seg a[aria-current], .seg a.is-on, .seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--sh-1); }
.tabs { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--line); margin-bottom: var(--s-4); overflow-x: auto; }
.tabs a { padding: .55rem .9rem; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); text-decoration: none; font-weight: 600; font-size: var(--t-sm); white-space: nowrap; }
.tabs a:hover { color: var(--fg); }
.tabs a[aria-current], .tabs a.is-on { color: var(--accent); border-bottom-color: var(--accent); }
.tabs .count { margin-left: .35rem; color: var(--faint); font-weight: 500; }

/* notices, empty states */
.notice { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: var(--r-3); font-size: var(--t-sm); color: var(--fg-2); }
.notice > :last-child { margin-bottom: 0; }
.notice strong { color: var(--fg); }
.notice--ok { border-color: var(--ok-line); background: var(--ok-soft); }
.notice--warn { border-color: var(--warn-line); background: var(--warn-soft); }
.notice--err { border-color: var(--err-line); background: var(--err-soft); }
.notice .dot { margin-top: .4rem; }
.empty, .empty-soft, .empty-state { padding: var(--s-6) var(--s-4); text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--r-3); background: var(--surface); }
.empty strong, .empty-soft strong { display: block; color: var(--fg-2); font-weight: 600; margin-bottom: var(--s-1); }
.empty .btn { margin-top: var(--s-3); }
.is-busy::after { content: ""; display: inline-block; width: .9em; height: .9em; margin-left: .5em; border: 2px solid var(--accent-line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -.1em; }
@keyframes spin { to { transform: rotate(360deg); } }

/* metrics: one compact connected band */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--sh-1); overflow: hidden; }
.metric { padding: var(--s-3) var(--s-4); border-left: 1px solid var(--line); min-width: 0; }
.metric:first-child { border-left: 0; }
.metric-label { font-size: var(--t-xs); color: var(--muted); font-weight: 500; }
.metric-value { font-size: var(--t-xl); font-weight: 650; line-height: 1.15; letter-spacing: -.02em; margin-top: 2px; }
.metric-value small { font-size: var(--t-sm); font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: .25rem; }
.metric-hint { font-size: var(--t-xs); color: var(--muted); margin-top: 2px; }
@media (max-width: 40rem) { .metric { border-left: 0; border-top: 1px solid var(--line); } .metric:first-child { border-top: 0; } .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } .metric:nth-child(odd) { border-right: 1px solid var(--line); } .metric:nth-child(2) { border-top: 0; } }

/* tables: for genuinely tabular data. Stack on phones. */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-3); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: var(--t-xs); padding: .55rem var(--s-3); background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: .65rem var(--s-3); border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
.table-stack { border: 1px solid var(--line); border-radius: var(--r-3); background: var(--surface); overflow: hidden; }
@media (max-width: 40rem) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: var(--s-3); border-bottom: 1px solid var(--line); }
  .table-stack tr:last-child { border-bottom: 0; }
  .table-stack td { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: var(--s-2); padding: .15rem 0; border: 0; }
  .table-stack td::before { content: attr(data-label); color: var(--muted); font-size: var(--t-xs); padding-top: .1rem; }
  .table-stack td:empty { display: none; }
}

/* generic details disclosure */
details.disclosure > summary { cursor: pointer; font-weight: 600; font-size: var(--t-sm); color: var(--fg-2); padding: var(--s-2) 0; list-style: none; }
details.disclosure > summary::before { content: "›"; display: inline-block; width: 1rem; color: var(--faint); transition: transform .15s; }
details.disclosure[open] > summary::before { transform: rotate(90deg); }
details.panel > summary { cursor: pointer; padding: var(--s-3) var(--s-4); font-weight: 600; font-size: var(--t-sm); }
details.panel > :not(summary) { padding: 0 var(--s-4) var(--s-4); }
details.popover { position: relative; }
details.popover > summary { list-style: none; cursor: pointer; }
details.popover > summary::-webkit-details-marker { display: none; }

/* pager */
.pager { display: flex; justify-content: space-between; gap: var(--s-3); margin-top: var(--s-4); font-size: var(--t-sm); }

/* 5. Compositions ------------------------------------------------------------------ */

/* career pages ----------------------------------------------------------------- */
.provenance, .prov { color: var(--muted); font-size: var(--t-xs); }
.page-foot { width: 100%; max-width: none; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; margin-top: var(--s-6); padding-top: var(--s-3); border-top: 1px solid var(--line); }
.panel-pad { padding: var(--s-3) var(--s-4); }
.panel-flush { overflow: hidden; }
.list-wide { --lead: 10.5rem; }
.list-narrow { --lead: 4.5rem; }
.career-sec + .career-sec, .heroes + .career-sec, .metrics + .career-sec, .panel + .career-sec, .tabs + .career-sec { margin-top: var(--s-5); }
.sec-note-top { margin: 0 0 var(--s-3); }
.figure { display: inline-flex; align-items: baseline; gap: .3rem; color: var(--fg); }
.figure strong { font-size: var(--t-md); font-weight: 650; }
.figure small { color: var(--muted); font-size: var(--t-xs); }
.tl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin-top: var(--s-1); }
.hero { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--sh-1); padding: var(--s-4) var(--s-5); border-left: 3px solid var(--accent); min-width: 0; }
.hero-eyebrow { margin: 0; font-size: var(--t-xs); font-weight: 600; color: var(--muted); }
.hero-title { margin: var(--s-1) 0 0; font-size: var(--t-xl); font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }
.hero-sub { margin: 2px 0 0; color: var(--fg-2); }
.hero .facts { margin-top: var(--s-3); }
.hero-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin: var(--s-3) 0 0; }
.hero--empty { border-left-color: var(--line-strong); }
.hero--empty .hero-title { color: var(--muted); font-size: var(--t-lg); font-weight: 600; }
.heroes { display: grid; gap: var(--s-4); margin-bottom: var(--s-5); }
.heroes-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.heroes-2 .hero:nth-child(2) { border-left-color: var(--fg-2); }
@media (max-width: 52rem) { .heroes-2 { grid-template-columns: minmax(0, 1fr); } }
.metrics-compact { margin: 0 0 var(--s-5); }
.metrics-compact .metric-value { font-size: var(--t-lg); }
.metrics dd, .metrics dt { margin: 0; }
.steps-panel { margin-bottom: var(--s-5); }
/* Progress track: one node per stage, joined by a connector. The connector is
   the stage's own ::before, so the state colour of the stage shows on the line
   that leaves it. Desktop lays stages out in a row; phones stack them. */
.steps { list-style: none; margin: 0; padding: var(--s-5) var(--s-4) var(--s-4); display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); gap: var(--s-3); }
.step { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-1); min-width: 0; font-size: var(--t-sm); color: var(--muted); }
.step::before { content: ""; position: absolute; top: .7rem; left: 1.75rem; right: calc(-1 * var(--s-3)); height: 2px; background: var(--line); }
.step:last-child::before { display: none; }
.step-n { position: relative; z-index: 1; display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--surface); border: 1px solid var(--line-strong); font-size: var(--t-xs); font-weight: 600; color: var(--muted); }
.step-label { font-weight: 500; color: var(--fg-2); line-height: 1.3; }
.step-hint { font-size: var(--t-xs); color: var(--muted); font-weight: 400; line-height: 1.4; }
.step--done::before { background: var(--ok); }
.step--done .step-n { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.step--done .step-label { color: var(--fg); }
.step--current .step-n { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); box-shadow: 0 0 0 4px var(--accent-soft); }
.step--current .step-label { color: var(--accent); font-weight: 600; }
.step--next .step-n { border: 1.5px dashed var(--accent); background: var(--surface); color: var(--accent); }
.step--next .step-label { color: var(--accent); }
.step--next::before { height: 0; background: none; border-top: 2px dashed var(--accent-line); }
.step--unknown .step-n { border-style: dotted; color: var(--faint); }
.step--unknown .step-label { color: var(--muted); }
.steps-note { margin: 0; padding: 0 var(--s-4) var(--s-4); color: var(--fg-2); font-size: var(--t-sm); }
@media (max-width: 52rem) {
  .steps { grid-template-columns: minmax(0, 1fr); gap: 0; padding: var(--s-4) var(--s-4) var(--s-3); }
  .step { display: grid; grid-template-columns: 1.4rem minmax(0, 1fr); column-gap: var(--s-3); row-gap: 2px; padding-bottom: var(--s-4); }
  .step::before { top: 1.45rem; bottom: 0; left: .69rem; right: auto; width: 2px; height: auto; }
  .step-n { grid-column: 1; grid-row: 1; }
  .step-label { grid-column: 2; grid-row: 1; align-self: center; }
  .step-hint { grid-column: 2; grid-row: 2; }
  .step:last-child { padding-bottom: 0; }
}
.elig { margin-bottom: var(--s-5); }
.elig .table-stack { border: 0; border-radius: 0 0 var(--r-3) var(--r-3); }

.status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--s-3); }
.status-tile { display: flex; flex-direction: column; gap: 2px; padding: var(--s-3) var(--s-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--sh-1); text-decoration: none; color: inherit; min-width: 0; }
.status-tile:hover { border-color: var(--accent-line); background: var(--surface-2); }
.status-label { font-size: var(--t-xs); color: var(--muted); font-weight: 500; }
.status-value { font-size: var(--t-lg); font-weight: 650; letter-spacing: -.01em; color: var(--fg); line-height: 1.25; }
.status-value.is-ok { color: var(--ok); }
.status-sub { font-size: var(--t-sm); color: var(--muted); }
.notice + .sec, .notice + .career-sec { margin-top: var(--s-5); }
.notice p { margin: var(--s-1) 0 0; }
.sec + .sec, .sec + .career-sec, .status-grid + .career-sec { margin-top: var(--s-6); }

/* overview ----------------------------------------------------------------------- */
.ov-layout { align-items: start; }
.attn { margin-bottom: var(--s-5); border-color: var(--warn-line); }
.attn .panel-head { background: var(--warn-soft); border-radius: var(--r-3) var(--r-3) 0 0; }
.panel-title .count { margin-left: .35rem; padding: 0 .45rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--warn-line); color: var(--warn); font-size: var(--t-xs); font-weight: 650; }
.row-title .dot { margin-right: .5rem; vertical-align: .08em; }
.lead-time { --lead: 4.5rem; }
.lead-code { --lead: 6.5rem; }
.group-label.is-today { color: var(--accent); }
.kv { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 0 var(--s-3); padding: var(--s-2) var(--s-4); text-decoration: none; color: inherit; align-items: baseline; }
.kv:hover { background: var(--surface-2); }
.kv-label { font-size: var(--t-xs); color: var(--muted); grid-row: span 2; align-self: start; padding-top: .15rem; }
.kv-value { font-weight: 650; color: var(--fg); line-height: 1.3; }
.kv-value.is-ok { color: var(--ok); }
.kv-sub { font-size: var(--t-sm); color: var(--muted); grid-column: 2; }
.list > li + li > .kv { border-top: 0; }
.recent { padding: var(--s-2) var(--s-4); }
.recent-top { display: flex; justify-content: space-between; gap: var(--s-2); font-size: var(--t-sm); }
.recent-top span { color: var(--muted); }
.recent-what { color: var(--fg-2); font-size: var(--t-sm); margin-top: 2px; }
.pub-figures { gap: var(--s-2) var(--s-5); align-items: baseline; }
.big { font-size: var(--t-xl); font-weight: 650; letter-spacing: -.02em; }
.bars { list-style: none; margin: var(--s-4) 0 0; padding: 0; display: flex; gap: 3px; align-items: flex-end; height: 5rem; }
.bar-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: stretch; height: 100%; }
.bar-track { flex: 1; display: block; min-height: 0; }
.bar-track svg { width: 100%; height: 100%; display: block; }
.bar { fill: var(--accent-line); }
.is-latest .bar { fill: var(--accent); }
.bar-yr { text-align: center; font-size: .6rem; color: var(--faint); margin-top: 2px; overflow: hidden; }
progress { appearance: none; -webkit-appearance: none; width: 4.5rem; height: .4rem; border: 0; border-radius: 99px; overflow: hidden; background: var(--surface-3); }
progress::-webkit-progress-bar { background: var(--surface-3); }
progress::-webkit-progress-value { background: #d97706; border-radius: 99px; }
progress::-moz-progress-bar { background: #d97706; border-radius: 99px; }
.sources-foot { margin-top: var(--s-6); padding-top: var(--s-3); border-top: 1px solid var(--line); font-size: var(--t-sm); }
.sources-foot p { margin: 0; display: flex; align-items: center; gap: var(--s-2); }

/* forms, auth, record detail, search and misc ---------------------------------------- */
.record-form { display: grid; gap: var(--s-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--sh-1); padding: var(--s-5); max-width: 42rem; }
.record-form.compact { box-shadow: none; border: 0; padding: var(--s-3) 0 0; max-width: none; }
.record-form label.field, .record-form label { margin: 0; }
.form-panel { max-width: 42rem; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: var(--s-3); }
.form-actions { display: flex; gap: var(--s-2); align-items: center; margin-top: var(--s-2); }
label.check { display: flex; align-items: center; gap: var(--s-2); font-weight: 500; color: var(--fg-2); }
.req { color: var(--err); }
.narrow { max-width: 26rem; margin: var(--s-6) auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--sh-1); padding: var(--s-5); display: grid; gap: var(--s-3); }
.narrow h1 { font-size: var(--t-lg); }
.narrow form { display: grid; gap: var(--s-3); }
.narrow label { display: grid; gap: var(--s-1); }
.narrow p { margin: 0; }
.secret { word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); padding: 0; list-style: none; }
.codes li { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-2); padding: var(--s-2) var(--s-3); text-align: center; }
.detail-body { padding: var(--s-4) var(--s-5); }
.facts-stack > div { padding: 0; }
.sub-stack, .sub-panel { margin-top: var(--s-4); }
/* A small form inside a panel (add topic, add note): fields and button share one baseline. */
form.inline:not(.search-bar) { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-2) var(--s-3); }
form.inline:not(.search-bar) .field { margin-bottom: 0; }
form.add-topic, form.add-topic .field { margin-bottom: 0; }
form.add-topic { align-items: flex-end; }
.sub-panel .table-stack { border: 0; border-radius: 0; }
.panel-head + .table-stack, .panel-head + .list { border-top: 0; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.fold { margin-top: var(--s-5); }
.fold > summary { cursor: pointer; padding: var(--s-3) var(--s-4); font-weight: 600; font-size: var(--t-sm); }
.fold .count { color: var(--faint); font-weight: 500; }
.revisions { list-style: none; margin: 0; padding: 0 var(--s-4) var(--s-3); display: grid; gap: var(--s-3); }
.rev-head { margin: 0; font-size: var(--t-sm); }
.rev-head span { color: var(--muted); }
.changes { margin: var(--s-1) 0 0; display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 2px var(--s-3); font-size: var(--t-sm); }
.changes dt { color: var(--muted); }
.changes dd { margin: 0; }
.rel { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: baseline; padding: var(--s-2) var(--s-4); }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .1rem .55rem; border-radius: 999px; background: var(--accent-soft); border: 1px solid var(--accent-line); font-size: var(--t-sm); margin: 0 var(--s-1) var(--s-1) 0; }
.chip a { text-decoration: none; }
.add-topic { margin-top: var(--s-3); align-items: flex-end; }
.archive-form { display: flex; gap: var(--s-2); align-items: flex-end; flex-wrap: wrap; margin-top: var(--s-4); }
.archived-toggle { margin: var(--s-4) 0 0; }
.records { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.authors { margin: 0 0 var(--s-4); padding-left: 1.2rem; }
.search-bar { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: flex-end; margin-bottom: var(--s-4); }
.search-bar > input[type="search"] { flex: 1 1 18rem; }
.search-layout { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; gap: var(--s-5); align-items: start; }
@media (max-width: 52rem) { .search-layout { grid-template-columns: minmax(0, 1fr); } }
.search-facets h3 { font-size: var(--t-sm); color: var(--muted); margin: var(--s-3) 0 var(--s-1); }
.search-facets ul { list-style: none; margin: 0; padding: 0; font-size: var(--t-sm); }
.facets, .chips { font-size: var(--t-sm); color: var(--muted); }
.facet { margin-right: var(--s-3); }
.table-scroll + .table-scroll { margin-top: var(--s-3); }

/* toolbars (search + filters) ------------------------------------------------------- */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; margin-bottom: var(--s-4); }
.tb-search { flex: 1 1 16rem; margin: 0; }
.tb-search input { width: 100%; margin: 0; }
.tb-sem { margin: 0; }
.tb-sem select { margin: 0; min-width: 12rem; }
.tb-more { position: relative; }
.tb-more > summary .count { margin-left: .25rem; background: var(--accent); color: var(--accent-fg); border-radius: 99px; padding: 0 .4rem; font-size: var(--t-xs); }
.pop-panel { position: absolute; z-index: 15; top: calc(100% + .35rem); left: 0; min-width: 16rem; display: grid; gap: var(--s-3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--sh-menu); padding: var(--s-4); }
.js .apply { display: none; }
.active-filters { display: flex; flex-wrap: wrap; gap: var(--s-2); list-style: none; margin: 0 0 var(--s-4); padding: 0; font-size: var(--t-sm); }
.active-filters li { background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent); border-radius: 999px; padding: .1rem .6rem; }
.active-filters .af-reset { background: none; border: 0; }

/* teaching ------------------------------------------------------------------------ */
.sem-band { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; padding: var(--s-4) var(--s-5); margin-bottom: var(--s-3); background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--r-3); box-shadow: var(--sh-1); }
.sem-title { font-size: var(--t-xl); font-weight: 650; letter-spacing: -.02em; margin: 2px 0 0; }
.course-list { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.course-list.flush { border-top: 1px solid var(--line); }
.course { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-3); align-items: start; padding: var(--s-3) var(--s-4); }
.course + .course { border-top: 1px solid var(--line); }
.course-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-1) var(--s-3); }
.course-code { color: var(--muted); font-size: var(--t-sm); min-width: 6.2rem; }
.course-title { font-weight: 600; color: var(--fg); text-decoration: none; }
.course-title:hover { color: var(--accent); text-decoration: underline; }
.course-figure { text-align: right; line-height: 1.2; }
.course-figure strong { display: block; font-size: var(--t-md); }
.course-figure small { color: var(--muted); font-size: var(--t-xs); }
.chips-inline { display: flex; flex-wrap: wrap; gap: var(--s-1); list-style: none; margin: var(--s-2) 0 0 6.2rem; padding: 0; }
.chip-class { display: inline-block; padding: .05rem .55rem; border-radius: var(--r-2); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--fg-2); font-size: var(--t-sm); text-decoration: none; }
.chip-class:hover { border-color: var(--accent); color: var(--accent); }
.history-line { margin: var(--s-3) 0 var(--s-5); }
details.fold > summary { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
.fold-title { font-weight: 650; }
.fold-sum { color: var(--muted); font-size: var(--t-sm); font-weight: 500; }
@media (max-width: 40rem) { .chips-inline { margin-left: 0; } .course-code { min-width: 0; } }

.toolbar-gap { margin-top: var(--s-5); }
.metrics + .sec, .metrics + .stack, .toolbar + .stack, .toolbar + .quiet { margin-top: var(--s-4); }
.sec-title .count { color: var(--faint); font-weight: 500; margin-left: .25rem; }
.st-granted { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.st-proposed { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.st-rejected { background: var(--err-soft); color: var(--err); border-color: var(--err-line); }
.is-caps { text-transform: lowercase; }
.is-caps::first-letter { text-transform: uppercase; }
.yearjump { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; margin: var(--s-3) 0 var(--s-3); font-size: var(--t-sm); color: var(--muted); }
.yearjump a { padding: .1rem .55rem; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); text-decoration: none; color: var(--fg-2); }
.yearjump a:hover { border-color: var(--accent); color: var(--accent); }
.js-only { display: none; }
.js .js-only { display: revert; }
.js label.tb-search.js-only { display: block; }
.js .seg.js-only { display: inline-flex; }

.hl-ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.hl-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.hl-err { background: var(--err-soft); color: var(--err); border-color: var(--err-line); }
.hl-info { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.hl-muted { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.int-rows { display: grid; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--sh-1); overflow: hidden; }
.int-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-1) var(--s-3); padding: var(--s-3) var(--s-4); align-items: center; }
.int-row + .int-row { border-top: 1px solid var(--line); }
.int-name { font-weight: 600; }
.int-sub { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: var(--t-sm); overflow-wrap: anywhere; }
.int-row details { grid-column: 1 / -1; }
.int-row details > summary { cursor: pointer; font-size: var(--t-sm); color: var(--accent); }
.int-actions { display: grid; gap: var(--s-3); padding-top: var(--s-2); min-width: 0; }
.int-actions form { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; min-width: 0; }
.int-actions input[type="file"] { max-width: 100%; }

/* legacy-structure pages (integrations, security): readable defaults ---------------- */
main > section, main > .stack > section { margin-top: var(--s-5); }
main > section > h2, main > h2 { margin: 0 0 var(--s-3); }
main > section > h3, main > h3 { margin: var(--s-4) 0 var(--s-2); font-size: var(--t-sm); color: var(--fg-2); }
main > section > p, main > p { max-width: 70ch; }
main > form:not(.toolbar):not(.panel):not(.record-form):not(.inline):not(.search-bar) { display: grid; gap: var(--s-3); max-width: 42rem; margin-top: var(--s-3); }
main > form > label, main > section > form > label { display: grid; gap: var(--s-1); }
main section > form:not(.inline) { display: grid; gap: var(--s-3); max-width: 42rem; margin: var(--s-3) 0; }
main .facts-stack.panel + * { margin-top: var(--s-4); }
.heading-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-3); }
.button { display: inline-flex; align-items: center; padding: .45rem .9rem; border-radius: var(--r-2); background: var(--accent); color: var(--accent-fg); text-decoration: none; font-weight: 600; font-size: var(--t-sm); }
main > h1 + p { color: var(--muted); }

.class-more { margin: var(--s-2) 0 0 6.2rem; font-size: var(--t-sm); }
.class-more > summary { cursor: pointer; color: var(--muted); }
.class-detail { list-style: none; margin: var(--s-2) 0 0; padding: 0; display: grid; gap: var(--s-1); }
.class-detail li { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); align-items: baseline; }
@media (max-width: 40rem) { .class-more { margin-left: 0; } }

.results { list-style: none; margin: 0; padding: 0; }
.results li { padding: var(--s-3) var(--s-4); }
.results li + li { border-top: 1px solid var(--line); }
.result-title { font-weight: 600; color: var(--fg); text-decoration: none; overflow-wrap: anywhere; }
.result-title:hover { color: var(--accent); text-decoration: underline; }
.result-meta { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); align-items: center; margin-top: var(--s-1); font-size: var(--t-sm); color: var(--muted); }
.summary { margin: var(--s-1) 0 0; color: var(--fg-2); font-size: var(--t-sm); }
.search-bar label { display: grid; gap: var(--s-1); }
@media (max-width: 40rem) {
  .sec-head { flex-direction: column; align-items: flex-start; gap: var(--s-1); }
}

/* touch targets: comfortable hit areas on coarse pointers --------------------------- */
@media (pointer: coarse) {
  .navlink, .sidebar summary, .nav-sub a, .seg button, .btn, .btn-sm, .icon-btn { min-height: 2.75rem; }
  .yearjump a, .chip-class { min-height: 2rem; display: inline-flex; align-items: center; }
  .row { min-height: 3rem; }
}

/* BKD semester detail ----------------------------------------------------------------- */
.bkd .panel-head { align-items: baseline; }
.bkd-result { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-6); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--line); }
.bkd-final strong { display: block; font-size: var(--t-xl); letter-spacing: -.01em; color: var(--ok); }
.bkd-statement { margin: 0; padding: var(--s-2) var(--s-5); color: var(--fg-2); font-size: var(--t-sm); border-bottom: 1px solid var(--line); }
.bkd-sum { border: 0; border-radius: 0; box-shadow: none; }
.bkd-sum .is-total td { background: var(--surface-2); }
.bkd-profile { margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.bkd-sec { border-top: 1px solid var(--line); padding: var(--s-4) 0 var(--s-2); }
.bkd-sec .sec-head { padding: 0 var(--s-5); }
.bkd-cat { margin: var(--s-3) 0 var(--s-1); padding: 0 var(--s-5); font-size: var(--t-sm); color: var(--muted); font-weight: 600; }
.bkd-list { list-style: none; margin: 0; padding: 0; }
.bkd-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-3); align-items: start; padding: var(--s-3) var(--s-5); }
.bkd-row + .bkd-row { border-top: 1px solid var(--line); }
.bkd-fig { display: flex; flex-direction: column; align-items: flex-end; gap: var(--s-1); text-align: right; }
.assess { margin-top: var(--s-2); font-size: var(--t-sm); }
.assess > summary { cursor: pointer; color: var(--muted); }
.assess-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--s-3); margin-top: var(--s-2); }
.assess-grid p { margin: var(--s-1) 0 0; color: var(--fg-2); }
.bkd-foot { padding: var(--s-3) var(--s-5) var(--s-4); margin: 0; border-top: 1px solid var(--line); }
@media (max-width: 40rem) { .bkd-row { grid-template-columns: minmax(0, 1fr); } .bkd-fig { align-items: flex-start; text-align: left; flex-direction: row; flex-wrap: wrap; } .bkd-result, .bkd-statement, .bkd-cat, .bkd-sec .sec-head, .bkd-row, .bkd-foot { padding-left: var(--s-4); padding-right: var(--s-4); } }

/* career hub: sections as a card grid ------------------------------------------ */
.section-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: var(--s-3); }
.section-card { position: relative; display: flex; flex-direction: column; gap: 2px; height: 100%; box-sizing: border-box; padding: var(--s-4); padding-right: calc(var(--s-4) + 1rem); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); text-decoration: none; color: inherit; min-width: 0; }
.section-card:hover { border-color: var(--accent-line); background: var(--surface-2); }
.section-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.section-title { font-weight: 600; color: var(--fg); line-height: 1.3; }
.section-sub { font-size: var(--t-sm); color: var(--muted); line-height: 1.4; overflow-wrap: anywhere; }
.section-go { position: absolute; top: var(--s-4); right: var(--s-3); color: var(--faint); }
.section-go .go { width: .9rem; height: .9rem; }

/* integrations family: status card, action bar, resource tables ----------------- */
/* Shared status card for an external source. The state is the first thing read,
   the facts are a two-column grid on wide screens, and actions sit on one row
   with the primary action first. */
.sis-status { display: grid; gap: var(--s-3); padding: var(--s-4) var(--s-5); background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: var(--r-3); }
.sis-status.sis-ok, .sis-status.sis-synced, .sis-status.sis-linked { border-left-color: var(--ok); }
.sis-status.sis-warn, .sis-status.sis-unlinked, .sis-status.sis-auth_required { border-left-color: var(--warn); }
.sis-status.sis-error, .sis-status.sis-failed { border-left-color: var(--err); }
.sis-state { display: flex; align-items: center; gap: var(--s-2); margin: 0; font-size: var(--t-md); }
.sis-state strong { font-weight: 650; color: var(--fg); }
.sis-state .dot { width: .6rem; height: .6rem; }
.sis-note { margin: 0; color: var(--fg-2); max-width: 60ch; }
.sis-status .facts-stack.panel { border: 0; box-shadow: none; } .sis-status .facts-stack { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: var(--s-3) var(--s-5); margin: 0; padding: var(--s-3) 0 0; border-top: 1px solid var(--line-hair); background: none; border-radius: 0; box-shadow: none; }
.sis-status .facts-stack > div { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.sis-status .facts-stack dt { font-size: var(--t-xs); color: var(--muted); font-weight: 500; }
.sis-status .facts-stack dd { margin: 0; color: var(--fg); overflow-wrap: anywhere; }
.sis-status .error { margin: 0; }
.sis-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); padding-top: var(--s-3); border-top: 1px solid var(--line-hair); }
.sis-actions form { margin: 0; }
.sis-sec { display: grid; gap: var(--s-3); margin-top: var(--s-6); }
.sis-sec > h2 { margin: 0; }
.sis-sec .sec-note, .sis-sec > p { margin: 0; color: var(--muted); font-size: var(--t-sm); max-width: 70ch; }
.sis-form { display: grid; gap: var(--s-3); max-width: 30rem; }
/* Resource tables: the first column carries the resource name and its endpoint.
   Endpoints are monospace and may wrap at any character. */
.sis-sec .table-stack td:first-child { min-width: 17rem; }
.sis-sec .table-stack code { display: inline-block; max-width: 100%; overflow-wrap: anywhere; font-size: .8em; line-height: 1.5; }
.sis-sec .table-stack td { vertical-align: top; }
/* Plain tables (no data-label reflow) keep a readable minimum width inside their
   scroll region, so their columns are not squeezed on a phone. */
.table-scroll > table:not(.table-stack) { min-width: 34rem; }
.table-scroll > table:not(.table-stack) td { overflow-wrap: break-word; }

/* lists and tables family: shared data view -------------------------------------
   One pattern for every record list: a toolbar (search, filter, archived toggle),
   a panel with the rows, and a pager footer that says which page is shown. */
.archived-toggle { margin: 0; }
.toolbar .archived-toggle { margin-left: auto; }
.pager { align-items: center; justify-content: space-between; flex-wrap: wrap; padding-top: var(--s-3); border-top: 1px solid var(--line); }
.pager .btn.is-disabled { opacity: .5; pointer-events: none; }
.pager-at { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
/* Long values wrap instead of pushing rows wider than the panel. */
.row-title, .row-sub > span { overflow-wrap: anywhere; }
/* Table cells break only when a word cannot fit; 'anywhere' would shrink short words
   such as 'Research' into fragments. The record title may be one unbroken token, so it
   uses 'anywhere'. */
.table-stack td, .table-scroll td { overflow-wrap: break-word; }
.table-stack td:first-child a { overflow-wrap: anywhere; }
/* Row trailing content: badges and the chevron wrap under the title on narrow screens. */
@media (max-width: 40rem) {
  /* Badges wrap inside the trailing column; the chevron stays beside the title. */
  .row-end { white-space: normal; flex-wrap: wrap; justify-content: flex-end; text-align: right; max-width: 11rem; }
  /* Stacked record table: the record title is the card heading, not a labelled cell. */
  .table-stack td:first-child { display: block; padding: 0 0 var(--s-2); font-size: var(--t-base); }
  .table-stack td:first-child::before { content: none; display: none; }
  .table-stack td:first-child a { color: var(--fg); }
}
/* Plain comparison tables on tablets and phones: the first column stays visible while
   the rest scroll sideways. A solid edge marks the stuck column; no gradient. */
@media (max-width: 52rem) {
  .table-scroll > table:not(.table-stack) th:first-child,
  .table-scroll > table:not(.table-stack) td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--line); }
  .table-scroll > table:not(.table-stack) th:first-child { background: var(--surface-2); }
}
/* record titles in the record table: no permanent underline; hover and focus show the link */
.table-stack td a { text-decoration: none; }
.table-stack td a:hover, .table-stack td a:focus-visible { text-decoration: underline; }

/* forms family: one record form ----------------------------------------------------
   Every record form (generic records, person, organization, publication) uses
   label.field per control. Errors sit inside their field; the invalid control gets
   the error border. On desktop the form is two columns; long text, groups and the
   action row span both. The compact inline form on detail pages is not affected. */
.field-msg { display: block; margin-top: var(--s-1); color: var(--err); font-size: var(--t-sm); font-weight: 500; line-height: 1.4; }
.field:has(> .field-msg) > input, .field:has(> .field-msg) > select, .field:has(> .field-msg) > textarea { border-color: var(--err); }
.record-form:not(.compact) { grid-template-columns: minmax(0, 1fr); gap: var(--s-4); max-width: 52rem; }
.record-form:not(.compact) .form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: var(--s-4) var(--s-3); }
.record-form:not(.compact) fieldset { margin: 0; }
.record-form textarea { resize: vertical; }
.form-actions { border-top: 1px solid var(--line); padding-top: var(--s-4); }
@media (min-width: 52rem) {
  .record-form:not(.compact) { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--s-5); }
  .record-form:not(.compact) > .field--wide, .record-form:not(.compact) > .check--wide, .record-form:not(.compact) > fieldset,
  .record-form:not(.compact) > .form-row, .record-form:not(.compact) > .form-actions, .record-form:not(.compact) > .error { grid-column: 1 / -1; }
}
/* link search (link_new): the relation, the search and the Find action share one row
   on desktop and stack full width on phones. */
.search-bar > .field { flex: 1 1 12rem; margin: 0; min-width: 0; }
.search-bar > .field > select, .search-bar > .field > input { width: 100%; }
.search-bar > button { min-height: 2.5rem; }
@media (max-width: 40rem) {
  .search-bar > .field, .search-bar > button { flex: 1 1 100%; }
}
h1 + .search-bar { margin-top: var(--s-4); }

/* detail family: facts, prose and related panels ---------------------------------
   Facts are label and value rows. On desktop they flow in two columns; long prose
   (notes, abstracts) spans both. Values wrap long words instead of pushing the layout. */
.facts-stack > div { min-width: 0; }
.facts-stack dd { overflow-wrap: anywhere; min-width: 0; }
@media (min-width: 52rem) {
  .facts-stack.detail-body { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--s-5); align-items: start; }
  .facts-stack.detail-body > div:has(> dd.prose), .facts-stack.detail-body > div:has(> dd > .prose), .facts-stack.detail-body > div.is-wide { grid-column: 1 / -1; }
}
/* The authors list keeps the author order visible and wraps long affiliations. */
ol.authors { list-style-position: outside; }
ol.authors li { overflow-wrap: anywhere; }
/* Related-record panels: the closed "Add" disclosure keeps the panel padding, so its
   chevron sits inside the panel, not on the border. */
.sub-panel details.disclosure > summary { padding: var(--s-3) var(--s-4); }
.sub-panel details.disclosure[open] > .record-form { margin: 0 var(--s-4) var(--s-4); }
/* BKD tables: on tablet widths the stacked-table layout is off, so the table needs its
   own minimum width inside the scroll region; the category name stays readable. */
@media (min-width: 40.01rem) {
  .table-scroll > table.table-stack { min-width: 36rem; }
}
.bkd-sum td:first-child { min-width: 12rem; }
/* Record forms, including the compact ones inside panels, use one column bounded by the
   container. Without the bound a select with long options widens the whole panel. */
.record-form { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.record-form select, .record-form input, .record-form textarea { max-width: 100%; }
/* Grid items in a stack may shrink below their content width; otherwise the widest
   child (a long table or select) widens every panel on the page. */
.stack > *, .sub-stack > * { min-width: 0; }

/* ---- Overview (dashboard) composition v2 -------------------------------------
   Header with a kicker, a row of key figures, alerts, then a two-column grid whose
   cells follow the order of the page: time-sensitive work first (coming up,
   teaching), then output and career, then housekeeping. */
.ov-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-4); }
.ov-head-text { min-width: 0; }
.ov-kicker { margin: 0 0 var(--s-1); font-size: var(--t-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.ov-head h1 { margin-bottom: var(--s-1); }
.ov-head .page-sub { margin: 0; }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); margin-bottom: var(--s-4); }
@media (min-width: 52rem) { .kpis { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); } }
.kpi {
  display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: var(--s-3);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2);
  border-top: 3px solid var(--accent);
}
.kpi-label { font-size: var(--t-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); overflow-wrap: anywhere; }
.kpi-value { font-size: var(--t-xl); font-weight: 650; letter-spacing: -.02em; color: var(--fg); line-height: 1.15; overflow-wrap: anywhere; }
.kpi-unit { font-size: var(--t-sm); font-weight: 500; color: var(--muted); letter-spacing: 0; }
.kpi-note { font-size: var(--t-sm); color: var(--muted); overflow-wrap: anywhere; }
.kpi.is-muted { border-top-color: var(--line-strong); }
.kpi.is-muted .kpi-value { font-size: var(--t-md); font-weight: 600; color: var(--muted); }

.ov-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-4); align-items: start; }
.ov-grid > .panel { min-width: 0; }
@media (min-width: 52rem) { .ov-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ov-grid .attn { margin-bottom: 0; }

.sub-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-2);
  padding: var(--s-2) var(--s-4); border-top: 1px solid var(--line); background: var(--surface-2);
  font-size: var(--t-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}

/* Sidebar: groups are disclosures; only the current section opens by default. */
.sg-details > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: var(--s-2);
  margin: 0 var(--s-2) var(--s-1); border-radius: var(--r-1);
}
.sg-details > summary::-webkit-details-marker { display: none; }
.sg-details > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sg-details > summary::after {
  content: "›"; font-size: var(--t-md); line-height: 1; color: var(--faint); transform: rotate(0deg); transition: transform .15s ease;
}
.sg-details[open] > summary::after { transform: rotate(90deg); }
.sg-count { margin-left: auto; margin-right: var(--s-1); font-size: var(--t-xs); font-weight: 500; color: var(--faint); letter-spacing: 0; }
.sidegroup:not(.is-active) .sg-details > summary { color: var(--muted); }
.sidegroup.is-active .sg-details > summary { color: var(--fg); }
.sg-details > ul { margin-top: 2px; }
