/* ============================================================================
   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 ----------------------------------------------------------------- */
:root {
  /* surfaces */
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f2f4f7;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  /* text */
  --fg: #101828;
  --fg-2: #344054;
  --muted: #667085;
  --faint: #98a2b3;
  /* accent (interactive, current) */
  --accent: #2457a6;
  --accent-hover: #1b4488;
  --accent-soft: #eef3fb;
  --accent-line: #c9d9f2;
  --accent-fg: #ffffff;
  /* semantic */
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --ok-line: #abefc6;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --warn-line: #fedf89;
  --err: #b42318;
  --err-soft: #fef3f2;
  --err-line: #fecdca;
  /* type scale */
  --t-xs: .75rem;
  --t-sm: .8125rem;
  --t-base: .9375rem;
  --t-md: 1rem;
  --t-lg: 1.125rem;
  --t-xl: 1.5rem;
  --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: 10px;
  --sh-1: 0 1px 2px rgb(16 24 40 / .05);
  --sh-menu: 0 8px 24px rgb(16 24 40 / .12);
  /* layout */
  --w-page: 72rem;
  --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 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: grid; gap: var(--s-1); margin-bottom: var(--s-4); }
.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 ---------------------------------------------------------------------- */
.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, 2rem) var(--s-7); 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;
  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-2);
}
.sb-head { padding: var(--s-1) var(--s-1) var(--s-3); }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--fg); text-decoration: none; font-weight: 650; letter-spacing: -.015em; padding: .3rem .4rem; border-radius: var(--r-2); }
.brand:hover { color: var(--fg); }
.brand-mark { display: grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 7px; background: var(--accent); color: var(--accent-fg); }
.brand-mark .ico { width: 1rem; height: 1rem; }
.sidebar nav { display: flex; flex-direction: column; gap: 1px; }
.nav-label { margin: var(--s-4) var(--s-2) var(--s-1); font-size: var(--t-xs); font-weight: 600; color: var(--faint); }
.navlink, .navgroup > summary {
  display: flex; align-items: center; gap: .6rem; min-height: 2.15rem; padding: .3rem .6rem;
  border-radius: var(--r-2); text-decoration: none; color: var(--fg-2); font-size: var(--t-base); font-weight: 500; cursor: pointer; list-style: none;
}
.navgroup > summary::-webkit-details-marker { display: none; }
.navlink .ico, .navgroup > summary .ico { color: var(--faint); }
.navlink:hover, .navgroup > summary:hover { background: var(--surface-3); color: var(--fg); }
.navlink[aria-current], .navgroup > summary[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.navlink[aria-current] .ico, .navgroup > summary[aria-current] .ico { color: var(--accent); }
.navgroup > summary { justify-content: flex-start; }
.navgroup > summary .chev { margin-left: auto; width: .85rem; height: .85rem; transition: transform .15s; color: var(--faint); }
.navgroup[open] > summary .chev { transform: rotate(90deg); }
.navgroup ul { list-style: none; margin: 1px 0 var(--s-1); padding: 0 0 0 1.2rem; display: flex; flex-direction: column; gap: 1px; border-left: 1px solid var(--line); margin-left: 1.15rem; }
.navgroup li a { display: block; padding: .28rem .6rem; border-radius: var(--r-2); text-decoration: none; color: var(--muted); font-size: var(--t-sm); font-weight: 500; }
.navgroup li a:hover { background: var(--surface-3); color: var(--fg); }
.navgroup li a[aria-current] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.sb-foot { margin-top: auto; padding-top: var(--s-3); border-top: 1px solid var(--line); }

.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h); display: flex; align-items: center; gap: var(--s-3);
  padding: 0 clamp(1rem, 3vw, 2rem); background: rgb(255 255 255 / .94); backdrop-filter: saturate(1.2) blur(6px); border-bottom: 1px solid var(--line);
}
.crumb { margin: 0; font-weight: 600; font-size: var(--t-base); color: var(--fg-2); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn.nav-toggle { display: 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; min-height: 0; }
.icon-btn:hover { background: var(--surface-3); }
.search-chip { display: inline-flex; align-items: center; gap: var(--s-2); height: 2.2rem; padding: 0 var(--s-3); border: 1px solid var(--line); border-radius: var(--r-2); color: var(--muted); text-decoration: none; background: var(--surface); font-size: var(--t-sm); min-width: 11rem; }
.search-chip:hover { border-color: var(--line-strong); color: var(--fg-2); }
.search-chip kbd { margin-left: auto; }
.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.9rem; height: 1.9rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.profile-name { font-size: var(--t-sm); font-weight: 600; 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; display: grid; gap: 2px; }
.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: 62rem) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .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; }
  .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-5); }
.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 { 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); }
.steps { list-style: none; margin: 0; padding: var(--s-4); display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s-2); counter-reset: none; }
.step { display: flex; flex-direction: column; gap: var(--s-1); padding-top: var(--s-2); border-top: 3px solid var(--line); font-size: var(--t-sm); color: var(--muted); }
.step-n { display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--surface-3); font-size: var(--t-xs); font-weight: 650; }
.step--done { border-top-color: var(--ok); color: var(--fg-2); }
.step--done .step-n { background: var(--ok-soft); color: var(--ok); }
.step--current { border-top-color: var(--accent); color: var(--fg); font-weight: 600; }
.step--current .step-n { background: var(--accent); color: var(--accent-fg); }
.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; } .step { flex-direction: row; align-items: center; border-top: 0; border-left: 3px solid var(--line); padding: var(--s-2) var(--s-3); } .step--done { border-left-color: var(--ok); } .step--current { border-left-color: var(--accent); } }
.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-5); }
.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); } }
