/* Calm, academic, greyscale. Serif for reading, sans for controls and data. */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --surface: #f6f6f5;
  --text: #1a1a1a;
  --muted: #6a6a6a;
  --line: #e2e2e0;
  --line-strong: #bdbdbb;
  --ink: #111111;
  --on-ink: #ffffff;
  --accent: #1f4e9c;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Noto Serif", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --width: 64rem;
  --gutter: clamp(1rem, 4vw, 2rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --surface: #1b1b1b;
    --text: #e6e6e4;
    --muted: #9b9b99;
    --line: #2c2c2c;
    --line-strong: #4a4a4a;
    --ink: #f0f0ee;
    --on-ink: #121212;
    --accent: #8fb4f0;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.6 var(--sans);
}

main {
  flex: 1;
  width: 100%;
  max-width: var(--width);
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3rem) var(--gutter);
}

h1 {
  margin: 0 0 .5rem;
  font: 400 clamp(1.6rem, 5vw, 2.1rem)/1.2 var(--serif);
  letter-spacing: -.01em;
}

p { margin: 0 0 1rem; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 1px; }
strong { font-weight: 600; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.muted { color: var(--muted); }

/* The research topic, wherever it is named. */
.topic { color: var(--accent); font: 600 1.3em/1.25 var(--serif); }

.eyebrow {
  margin: 0 0 .75rem;
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Icons */
.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -.25em;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  max-width: var(--width);
  margin: 0 auto;
  padding: .75rem var(--gutter);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
  font: 400 1.05rem/1 var(--serif);
  text-decoration: none;
}
.brand .icon { width: 1.5rem; height: 1.5rem; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.account { display: flex; align-items: center; gap: .25rem; min-width: 0; }
.account form { display: flex; margin: 0; }

.who {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
  margin-right: .5rem;
  font-size: .9rem;
}
.who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 14rem; }

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  object-fit: cover;
  /* Photos sit quietly in the greyscale page and regain colour on hover. */
  filter: grayscale(1);
  transition: filter .2s;
}
.avatar:hover { filter: none; }
.avatar .icon { width: 1rem; height: 1rem; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
}
.icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn[aria-disabled="true"] { opacity: .35; pointer-events: none; }

/* Buttons and fields */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 2.5rem;
  padding: .45rem 1rem;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
  color: var(--on-ink);
  font: 500 .9rem/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { opacity: .85; }
.btn-quiet { border-color: transparent; background: none; color: var(--muted); }
.btn-quiet:hover { color: var(--text); opacity: 1; }
.btn-small { min-height: 2rem; padding: .25rem .6rem; font-size: .8rem; }

/* Google's own mark and colours, as its sign-in branding requires. */
.btn.google { border-color: #747775; background: #fff; color: #1f1f1f; }
.btn.google svg { width: 18px; height: 18px; }

.field {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 2.5rem;
  padding: 0 .75rem;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--bg);
  color: var(--muted);
}
.field:focus-within { border-color: var(--ink); }
.field input, .field select {
  flex: 1;
  min-width: 0;
  height: 2.4rem;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 1rem; /* 16px keeps iOS from zooming in on focus */
}

.status {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  margin: 1rem 0;
  padding: .6rem .8rem;
  border-left: 2px solid var(--ink);
  background: var(--surface);
  font-size: .9rem;
  text-align: left;
}
.status .icon { margin-top: .12em; }
[hidden] { display: none !important; }

/* Text pages */
.prose { max-width: 38rem; font: 1.08rem/1.7 var(--serif); }

/* Steps of a research method: done marks and their results */
.reader-text ol.steps { list-style: none; padding: 0; }
.step { margin: 0 0 1rem; padding: .5rem 0 .75rem; border-bottom: 1px solid var(--line); }
.step-head { display: flex; align-items: flex-start; gap: .25rem; }
.step-head .check { margin-top: -.45rem; flex: none; }
.step-head form { display: flex; align-items: center; margin: 0; }
.step-number { font-weight: 600; }
.step.done .step-text { color: var(--muted); }
span.check .check-box { cursor: default; }
.step.done span.check .check-box { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.step-result { margin: .5rem 0 0 2.75rem; padding: .25rem 0 .25rem 1rem; border-left: 2px solid var(--accent); font-size: .98rem; }
.step-result > :last-child { margin-bottom: 0; }
.step-meta { margin: .35rem 0 0 2.75rem; font: .78rem/1.4 var(--sans); }
.step-edit { margin: .5rem 0 0 2.75rem; font-family: var(--sans); }
.step-edit summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.step-edit summary:hover { color: var(--text); }
.step-edit textarea {
  display: block; width: 100%; margin-top: .5rem; padding: .6rem .75rem; resize: vertical;
  border: 1px solid var(--line-strong); border-radius: 2px; background: var(--bg); color: var(--text);
  font: 1rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; /* 16px keeps iOS from zooming */
}
.step-edit textarea:focus { border-color: var(--ink); outline: 0; }
.step-actions { display: flex; align-items: center; gap: .75rem; margin: .5rem 0 0; font-size: .8rem; }
@media (max-width: 44rem) {
  .step-result, .step-meta, .step-edit { margin-left: 0; }
}

/* Reading a material's text */
.reader { max-width: 42rem; }
.reader-head h1 { font-size: clamp(1.5rem, 4.5vw, 2rem); }
.reader-authors { margin: .25rem 0 1rem; font: 1.02rem/1.5 var(--serif); }
.reader-meta { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin: 0 0 1rem; font-size: .85rem; }
.reader-meta dt { color: var(--muted); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; }
.reader-meta dd { margin: 0; }
.reader-actions { display: flex; flex-wrap: wrap; gap: .5rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.reader-note { font-size: .9rem; }
.reader-text { max-width: none; overflow-wrap: anywhere; }
.reader-text h2, .reader-text h3, .reader-text h4, .reader-text h5, .reader-text h6 {
  margin: 2rem 0 .75rem; font-family: var(--serif); font-weight: 600; line-height: 1.3;
}
.reader-text h2 { font-size: 1.35rem; }
.reader-text h3 { font-size: 1.15rem; }
.reader-text h4, .reader-text h5, .reader-text h6 { font-size: 1rem; }
.reader-text p { margin: 0 0 1.1rem; }
.reader-text ul, .reader-text ol { margin: 0 0 1.1rem; padding-left: 1.4rem; }
.reader-text li { margin-bottom: .3rem; }
.reader-text blockquote { margin: 0 0 1.1rem; padding-left: 1rem; border-left: 2px solid var(--line-strong); color: var(--muted); }
.reader-text code { font: .88em/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface); padding: .05rem .25rem; border-radius: 2px; }
.reader-text pre { overflow-x: auto; padding: .75rem 1rem; background: var(--surface); border-radius: 2px; }
.reader-text pre code { padding: 0; background: none; }
.reader-text img { max-width: 100%; height: auto; }
.reader-text table { display: block; overflow-x: auto; margin: 0 0 1.1rem; border-collapse: collapse; font: .85rem/1.45 var(--sans); }
.reader-text th, .reader-text td { padding: .35rem .6rem; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.reader-text hr { margin: 2rem 0; border: 0; border-top: 1px solid var(--line); }
.reader-text em:only-child { color: var(--muted); font-size: .9rem; }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.tile {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  min-height: 9rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  text-decoration: none;
  transition: border-color .12s, background .12s;
}
.tile:hover { border-color: var(--ink); background: var(--surface); }
.tile-icon { width: 2rem; height: 2rem; margin-bottom: auto; color: var(--muted); stroke-width: 1.25; }
.tile:hover .tile-icon { color: var(--text); }
.tile-title { margin-top: 1rem; font: 400 1.25rem/1.25 var(--serif); }
.tile { min-width: 0; }
.tile-title { overflow-wrap: anywhere; }
.tile-file { font-size: 1.05rem; }
.tile-sub { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .85rem; }
.tile-sub .icon { width: 1rem; height: 1rem; }

.tile-video { grid-column: span 2; gap: 0; min-height: 0; padding: 0; overflow: hidden; }
.tile-video:hover { background: none; }
.cam { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.tile-caption { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; padding: .85rem 1.25rem; color: var(--muted); }
.tile-caption .tile-title { margin: 0; color: var(--text); }
.tile-caption .tile-sub { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 2px; }
.seg button {
  min-width: 2.75rem;
  min-height: 2rem;
  padding: 0 .6rem;
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 .78rem/1 var(--sans);
  letter-spacing: .06em;
  cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }

/* Person snapshots under the camera */
.tile-events { grid-column: 1 / -1; gap: 0; min-height: 0; padding: 0; }
.tile-events:hover { background: none; }
.tile-events .status { margin: 0 1.25rem 1.25rem; }
.tile-events .empty { padding: 2rem 1rem; border-bottom: 0; }
.tile-events .btn { align-self: center; margin-bottom: 1rem; }
.shots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: .75rem;
  margin: 0;
  padding: 0 1.25rem 1.25rem;
  list-style: none;
}
.shots:empty { display: none; }
.shot { display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.shot img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border: 1px solid var(--line); background: var(--surface); }
.shot:hover img { border-color: var(--ink); }
.shot time { display: block; margin-top: .3rem; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }

.shot-view {
  width: min(96vw, 72rem);
  max-height: 96dvh;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--bg);
  color: var(--text);
}
.shot-view::backdrop { background: rgb(0 0 0 / .7); }
.shot-view img { display: block; width: 100%; max-height: calc(96dvh - 3.5rem); aspect-ratio: 16 / 9; object-fit: contain; background: #000; }
.shot-bar { display: flex; align-items: center; gap: .25rem; padding: .25rem .5rem .25rem 1.25rem; }
.shot-bar time { flex: 1; color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.shot-bar .icon-btn:disabled { opacity: .35; cursor: default; }

/* Sign-in and "no access" */
body.bare main { display: grid; place-items: center; }
.notice { width: 100%; max-width: 26rem; text-align: center; }
.notice p { color: var(--muted); }
.notice strong { color: var(--text); overflow-wrap: anywhere; }
.notice-icon { width: 2.5rem; height: 2.5rem; margin-bottom: 1rem; color: var(--muted); stroke-width: 1.25; }
.actions { margin: 1.75rem 0 0; }

/* Settings */
.settings { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: 2.5rem; }

.settings-nav nav { display: flex; flex-direction: column; gap: .125rem; }
.settings-nav a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .75rem;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: .95rem;
  text-decoration: none;
}
.settings-nav a:hover { color: var(--text); }
.settings-nav a[aria-current="page"] { border-left-color: var(--ink); background: var(--surface); color: var(--text); }

.section-head { margin-bottom: 1.5rem; }
.section-head p { margin: 0; }

/* Individual plan: requisites of the approved dissertation topic */
.plan {
  display: flex;
  align-items: flex-start;
  gap: .9rem;
  margin: 0 0 1.5rem;
  padding: 1rem 1.25rem;
  border-left: 2px solid var(--accent);
  background: var(--surface);
}
.plan-icon { flex: none; width: 1.5rem; height: 1.5rem; margin-top: .1rem; color: var(--accent); stroke-width: 1.5; }
.plan-title { margin: 0 0 .4rem; font: 400 1.15rem/1.3 var(--serif); }
.plan-facts { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; margin: 0; font-size: .9rem; }
.plan-facts dt { color: var(--muted); }
.plan-facts dd { margin: 0; }
@media (max-width: 34rem) {
  .plan-facts { grid-template-columns: 1fr; }
  .plan-facts dd { margin-bottom: .35rem; }
}

.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
main.wide { max-width: none; }
.filter-note { margin: 0 0 1rem; font-size: .9rem; }
.byline { text-decoration: none; }
.byline:hover { color: var(--text); text-decoration: underline; }
.stats { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1.75rem; margin-bottom: 1rem; padding: .75rem 0; border-block: 1px solid var(--line); }
.stats-main { margin: 0; font: 1.1rem/1.3 var(--serif); }
.stats-main strong { font-size: 1.45rem; font-weight: 600; }
.stats-list { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; margin: 0; font-size: .85rem; }
.stats-list div { display: flex; gap: .35rem; }
.stats-list dt { color: var(--muted); }
.stats-list dd { margin: 0; font-variant-numeric: tabular-nums; }
.field-search { flex: 1 1 14rem; }

/* Users table */
.users { width: 100%; border-collapse: collapse; font-size: .92rem; }
.users th {
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.users td { padding: .7rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.users th:first-child, .users td:first-child { padding-left: 0; }
.users th:last-child, .users td:last-child { padding-right: 0; }
.users .col-access, .users .cell-access { text-align: right; }

.cell-user { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.cell-user .avatar { width: 2rem; height: 2rem; }
.user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.user-name { font-weight: 500; }
.user-name, .user-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-email { font-size: .85rem; }
.cell-date { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Works table (materials): the users table with wrapping titles and no avatar */
.works td { vertical-align: top; }
.works .user-name, .works .user-email { white-space: normal; }
.works .cell-source { white-space: normal; }
.works a.tag:hover { border-color: var(--ink); color: var(--ink); }
.works .col-num, .works .cell-num { text-align: right; }
.works .cell-sub { display: block; font-size: .85rem; }
.works th a.sort { display: inline-flex; align-items: center; gap: .25rem; color: inherit; text-decoration: none; }
.works th a.sort:hover, .works th[aria-sort] a.sort { color: var(--ink); }
.works th a.sort .icon { width: .9rem; height: .9rem; }
.works .col-num a.sort { flex-direction: row-reverse; }

/* World map of materials by country */
.world { position: relative; margin: 0 0 2rem; }
.world-map { display: block; width: 100%; height: auto; border: 1px solid var(--line); cursor: grab; touch-action: pan-y; user-select: none; }
.world-map.dragging { cursor: grabbing; }
.world-map .lands path { fill: var(--surface); stroke: var(--line-strong); stroke-width: .4; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.world-map .lands path.has { fill: var(--line-strong); stroke: var(--bg); }
.world-map .pin circle { fill: var(--ink); stroke: var(--bg); stroke-width: 1; }
.map-zoom { position: absolute; top: .5rem; right: .5rem; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 2px; background: var(--bg); }
.map-zoom .icon-btn { border-radius: 0; }
.map-zoom .icon-btn:disabled { opacity: .35; cursor: default; }
.world-map a:hover .pin circle, .world-map a:focus-visible .pin circle { fill: var(--muted); }
.world-map a:focus-visible { outline: none; }
.world-map .pin text { fill: var(--on-ink); font-family: var(--sans); font-weight: 600; text-anchor: middle; pointer-events: none; }
.world figcaption { margin-top: .75rem; font-size: .85rem; }
.countries { max-width: 26rem; }

/* Group heading row inside a table (resources) */
.users .group th {
  padding: 1.75rem 0 .6rem;
  color: var(--text);
  font: 400 1.25rem/1.25 var(--serif);
  letter-spacing: 0;
  text-transform: none;
}

.toggle { display: inline-flex; align-items: center; gap: .5rem; margin: 0; }
/* One checkbox per site area (access settings), its name under it */
.areas { display: inline-flex; gap: .25rem; }
.area-toggle { flex-direction: column; gap: 0; }
.area-name { margin-top: -.35rem; color: var(--muted); font-size: .7rem; line-height: 1.2; }

.check { position: relative; display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-box {
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 2px;
  color: transparent;
  transition: background .12s, border-color .12s;
}
.check-box .icon { width: 1rem; height: 1rem; stroke-width: 2.25; }
.check:hover .check-box { border-color: var(--ink); }
.check input:checked + .check-box { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.check input:focus-visible + .check-box { outline: 2px solid var(--ink); outline-offset: 2px; }
.check input:disabled + .check-box { opacity: .5; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .15rem .5rem;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  color: var(--muted);
  font-size: .78rem;
  white-space: nowrap;
}
.tag .icon { width: 1rem; height: 1rem; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  margin: 0;
  padding: 3rem 1rem;
  border-block: 1px solid var(--line);
  color: var(--muted);
}
.empty .icon { width: 2rem; height: 2rem; stroke-width: 1.25; }

.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.5rem;
  margin-top: .75rem;
  font-size: .88rem;
}
.pager { display: flex; align-items: center; gap: .25rem; }
.pager-pos { min-width: 4.5rem; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Phones: settings menu becomes a tab strip, table rows become cards. */
/* Offer to add the site to the home screen */
.install {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: .75rem;
  width: min(100% - 2rem, 28rem);
  margin: 0 auto calc(1rem + env(safe-area-inset-bottom));
  padding: .6rem .6rem .6rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--bg);
  box-shadow: 0 6px 24px rgb(0 0 0 / .18);
  font-family: var(--sans);
  font-size: .9rem;
}
.install[hidden] { display: none; }
.install > .icon { flex: none; width: 1.5rem; height: 1.5rem; }
.install p { flex: 1; display: flex; flex-direction: column; min-width: 0; margin: 0; line-height: 1.35; }
.install p span { font-size: .82rem; }

@media (max-width: 44rem) {
  .who-name { max-width: 9rem; }

  .tiles { grid-template-columns: minmax(0, 1fr); gap: .75rem; }
  .tile { flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: 1rem; min-height: 0; padding: 1rem; }
  .tile-icon { margin: 0; }
  .tile-title { flex: 1; margin: 0; }
  .tile-sub { flex-basis: 100%; padding-left: 3rem; }
  .tile-video { display: block; grid-column: auto; padding: 0; }
  .tile-events { display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; grid-column: auto; padding: 0; }
  .shots { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; padding: 0 1rem 1rem; }
  .tile-events .status { margin: 0 1rem 1rem; }
  .tile-caption { padding: .75rem 1rem; }
  .tile-caption .tile-sub { flex: 1 1 auto; padding-left: 0; }

  .settings { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .settings-nav .eyebrow { display: none; }
  .settings-nav nav {
    flex-direction: row;
    gap: 0;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
  }
  .settings-nav a { border-left: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
  .settings-nav a[aria-current="page"] { border-bottom-color: var(--ink); background: none; }

  .filters .field { flex: 1 1 100%; }
  .filters .btn { flex: 1; }

  .users thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .users, .users tbody { display: block; }
  .users tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: .75rem;
    align-items: center;
    padding: .75rem 0;
    border-bottom: 1px solid var(--line);
  }
  .users tbody tr:first-child { border-top: 1px solid var(--line); }
  .users tbody tr.group { border-top: 0; padding: 1.25rem 0 .5rem; }
  .users .group th { padding: 0; border: 0; }
  .users td { padding: 0; border: 0; }
  .cell-user { grid-column: 1; grid-row: 1; }
  .cell-access { grid-column: 2; grid-row: 1 / span 3; }
  .cell-date { grid-column: 1; padding-left: 2.75rem !important; font-size: .8rem; white-space: normal; }
  .cell-date::before { content: attr(data-label) ": "; }
  .cell-user + .cell-date { margin-top: .35rem; }
  .works .cell-date { padding-left: 0 !important; }
  .works .cell-access { align-self: start; }
  .works .cell-num { text-align: left; }
  .works .cell-sub { display: inline; font-size: inherit; }
  .works .cell-sub::before { content: " · "; }
}

/* Personal schedule: one day at a time. */
.schedule-import { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-bottom: 1.25rem; font-size: .88rem; }
.schedule-note {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0 0 1.25rem;
  padding: .6rem .75rem;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--surface);
  font: .92rem/1.35 var(--sans);
}
.btn.is-busy { opacity: .85; cursor: progress; }
.btn.is-busy .icon { display: none; }
.btn.is-busy::before {
  content: "";
  width: 1rem;
  height: 1rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.day-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.day-pos { display: inline-flex; align-items: center; justify-content: center; gap: .6rem; min-width: 13rem; }
.lessons .cell-links { white-space: normal; }
.lessons .lesson-link { display: block; }
.lessons .lesson-link + .lesson-link { margin-top: .5rem; }
.lessons .cell-sub { margin-top: .25rem; }

@media (max-width: 44rem) {
  .day-pos { flex: 1; min-width: 0; }
  .lessons .cell-links { grid-column: 1 / -1; margin-top: .6rem; }
  .lessons .cell-sub { display: block; }
  .lessons .cell-sub::before { content: none; }
}

@media (max-width: 24rem) {
  .who-name { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Seminar */
.discipline-section { margin: 2.5rem 0 0; font-size: 1.15rem; }
.seminar-audio { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 2rem; padding: 1rem 1.25rem; border: 1px solid var(--line); border-radius: 2px; }
.seminar-audio h2 { flex-basis: 100%; margin: 0; font-size: 1rem; }
.seminar-audio audio { flex: 1 1 16rem; max-width: 100%; }
.seminar-sources { max-width: 38rem; margin-top: 2.5rem; }
.seminar-sources h2 { font-size: 1.15rem; }
.seminar-sources li + li { margin-top: .5rem; }
.seminar-plan { max-width: 42rem; padding-left: 1.5rem; }
.seminar-plan li + li { margin-top: 1.25rem; }
.seminar-question { display: block; line-height: 1.45; }
.seminar-talk { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin-top: .6rem; }
.seminar-talk audio { flex: 1 1 16rem; max-width: 100%; height: 2.25rem; }

/* IT unit structure (/work/structure): staff table grouped by department */
.staff .cell-position { color: var(--text); white-space: normal; }
.staff .col-num, .staff .cell-num { text-align: right; }
.staff .user-email { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; white-space: normal; }
.staff .group-sub { display: block; margin-top: .25rem; font: .8rem/1.3 var(--sans); }
.staff tr.part-time td { background: var(--part); }
.staff tr.part-time .cell-num { color: var(--part-ink); font-weight: 600; }
.staff tr.vacant .user-name { color: var(--muted); font-style: italic; }
.staff tr.vacant .avatar { border-style: dashed; }
.staff tr.removal td { opacity: .55; }
.staff tr.removal .user-name { text-decoration: line-through; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1rem; margin: 0 0 1rem; font-size: .85rem; }
.swatch { display: inline-block; width: .9rem; height: .9rem; margin-right: .35rem; border: 1px solid var(--line-strong); vertical-align: -.1rem; }
.swatch-part { background: var(--part); border-color: var(--part-ink); }
.swatch-vacant { border-style: dashed; }
:root { --part: #fff4d6; --part-ink: #8a5a00; }
@media (prefers-color-scheme: dark) { :root { --part: #3a2f12; --part-ink: #f0c060; } }
@media (max-width: 44rem) {
  .staff tr.part-time { background: var(--part); }
  .staff tr.part-time td { background: none; }
  .staff .cell-num { text-align: left; }
  .staff .group-sub { margin-top: .15rem; }
}
.staff tbody.tentative, .staff tbody.tentative .group th { color: var(--muted); }
.staff tbody.tentative .cell-position { color: var(--muted); }
.staff tbody.tentative .avatar { opacity: .5; }
.swatch-tentative { background: var(--line); }

/* Departments with their services (/work/departments) */
.dept { margin-bottom: 2.5rem; }
.dept-title { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0 0 .25rem; font: 400 1.35rem/1.25 var(--serif); }
.dept-sub { margin: 0 0 .75rem; font-size: .88rem; }
.dept-empty { margin: 0; padding: .9rem 0; border-block: 1px solid var(--line); font-size: .9rem; }
.dept.tentative, .dept.tentative .dept-title, .dept.tentative .user-name, .dept.tentative .person { color: var(--muted); }
.services .cell-sources { display: flex; flex-wrap: wrap; gap: .25rem; max-width: 16rem; }
.services .cell-sources .tag { white-space: normal; }
.services .person { display: block; color: var(--muted); }
.services .person.own { color: var(--text); font-weight: 500; }
.services .person + .person { margin-top: .35rem; }
.services .person .cell-sub { font-weight: 400; }
@media (max-width: 44rem) {
  .services .cell-sources { max-width: none; margin-top: .35rem; }
  .services .cell-date { padding-left: 0 !important; }
  .services .cell-people::before { display: block; }
}

/* Individual postgraduate plan (/study/plan) */
.plan-link { margin: .6rem 0 0; font-size: .9rem; }
.ipra-facts { margin-bottom: 2rem; }
.ipra { margin-bottom: 2rem; }
.ipra h2 { margin: 0 0 .5rem; font: 400 1.35rem/1.25 var(--serif); }
.ipra h3 { margin: 1rem 0 .25rem; font-size: 1rem; }
.ipra ul { margin: 0; padding-left: 1.25rem; }

/* Works whose access has to be obtained separately (/study/research/materials) */
.tag-locked { color: var(--muted); white-space: normal; }
.stats-list dt a { color: inherit; }

/* Page numbers and jump to a page (/study/research/materials) */
.table-foot { flex-wrap: wrap; gap: .75rem 1.25rem; }
.pager { flex-wrap: wrap; }
.pager-num, .pager-gap { display: inline-flex; align-items: center; justify-content: center; min-width: 2.25rem; height: 2.25rem; padding: 0 .4rem; font-size: .9rem; }
.pager-num { border: 1px solid transparent; color: inherit; text-decoration: none; }
a.pager-num:hover { border-color: var(--line-strong); }
.pager-num.current { border-color: var(--ink); font-weight: 600; }
.pager-gap { min-width: 1rem; color: var(--muted); }
.pager-jump { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .9rem; }
.pager-jump input[type=number] { width: 5rem; height: 2.25rem; padding: 0 .5rem; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); font: inherit; }

/* Relevance stars (/study/research/materials) */
.stars, .stars-view { display: inline-flex; white-space: nowrap; }
.stars-view { color: var(--accent); }
.stars-rest { color: var(--line-strong); }
.star { padding: 0 .05rem; border: 0; background: none; color: var(--line-strong); font-size: 1.15rem; line-height: 1; cursor: pointer; }
.star.on { color: var(--accent); }
.stars:has(.star:hover) .star { color: var(--accent); }
.star:hover ~ .star { color: var(--line-strong) !important; }
.star:focus-visible { outline: 2px solid var(--accent); }

/* The topic on /study/research links to the planned research page */
a.topic { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
a.topic:hover { text-decoration-thickness: 2px; }
.reader-text mark.draft { background: var(--surface); color: var(--muted); font-style: italic; padding: 0 .2em; }
.plan-docs { margin: 0 0 1.5rem; padding-left: 1.2rem; font-size: .95rem; }
.plan-docs li { margin: .2rem 0; }
.tile-highlight { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.tile-highlight .tile-icon, .tile-highlight .tile-title { color: var(--accent); }
.tile-highlight:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }

/* USB backup status on the «Дім» page */
.backups .status-ok { border-left-color: #2e7d4f; }
.backups .status-bad { border-left-color: #b3261e; }
.backup-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .75rem 1.5rem; margin: 1rem 0 1.25rem; font-size: .92rem; }
.backup-facts dt { color: var(--muted); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; }
.backup-facts dd { margin: .2rem 0 0; }
.backup-disk { grid-column: span 2; }
.meter { display: block; height: .35rem; margin-top: .4rem; background: var(--line); border-radius: 1rem; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--ink); }
.backup-state { display: inline-block; padding: .1rem .5rem; border-radius: 1rem; font-size: .8rem; white-space: nowrap; }
.backup-ok { background: color-mix(in srgb, #2e7d4f 14%, transparent); color: #2e7d4f; }
.backup-error, .backup-none { background: color-mix(in srgb, #b3261e 14%, transparent); color: #b3261e; }
.backup-running { background: var(--surface); color: var(--muted); }
@media (prefers-color-scheme: dark) {
  .backups .status-ok { border-left-color: #6fcf97; }
  .backups .status-bad { border-left-color: #f28b82; }
  .backup-ok { color: #6fcf97; }
  .backup-error, .backup-none { color: #f28b82; }
}
.backup-note { margin-top: .75rem; font-size: .85rem; }
@media (max-width: 44rem) {
  .backup-disk { grid-column: auto; }
  .backup-table th:nth-child(3), .backup-table td:nth-child(3), .backup-table th:nth-child(4), .backup-table td:nth-child(4) { display: none; }
}

/* USB backups: rows open into the list of files on the stick */
.backup-toggle { display: inline-flex; align-items: center; gap: .4rem; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.backup-toggle .icon { width: 1rem; height: 1rem; color: var(--muted); transition: transform .15s; }
.backup-toggle[aria-expanded="true"] .icon { transform: rotate(90deg); }
.backup-toggle:hover .user-name { text-decoration: underline; }
.backup-detail td { padding-top: 0; background: var(--surface); }
.backup-table .backup-detail td { padding: .75rem 1rem 1rem; }
.backup-dir { margin: 0 0 .5rem; font-size: .8rem; }
.backup-files { margin: 0; padding: 0; list-style: none; font-size: .85rem; }
.backup-files li { display: grid; grid-template-columns: 1rem minmax(0, 1fr) 7rem 5.5rem 6.5rem; gap: .6rem; align-items: center; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.backup-files li:last-child { border-bottom: 0; }
.backup-files .icon { width: 1rem; height: 1rem; color: var(--muted); }
.backup-file-name { overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; }
.backup-files .cell-date { text-align: right; }
.backup-log { margin-top: .75rem; font-size: .85rem; }
.backup-log summary { cursor: pointer; color: var(--muted); }
.backup-log pre { max-height: 20rem; margin: .5rem 0 0; padding: .75rem; overflow: auto; border: 1px solid var(--line); background: var(--bg); font-size: .75rem; line-height: 1.45; white-space: pre-wrap; }
@media (max-width: 44rem) {
  .backup-files li { grid-template-columns: 1rem minmax(0, 1fr) auto; }
  .backup-files li > .muted, .backup-files li > .cell-date:last-child { display: none; }
}
.prose h3.talk-section { font-size: 1.05rem; margin: 2rem 0 .5rem; color: var(--muted, #666); }
.prose h3.talk-section:first-child { margin-top: 0; }

/* Home page: the owner's profile. */
.profile { display: flex; gap: clamp(1.25rem, 4vw, 2.5rem); align-items: flex-start; padding-bottom: 2rem; border-bottom: 1px solid var(--line); }
.profile-photo { flex: none; width: 168px; height: 168px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); background: var(--surface); }
.profile-body { min-width: 0; max-width: 40rem; }
.profile-body h1 { font-size: clamp(1.9rem, 6vw, 2.6rem); }
.profile-lead { font: 400 1.2rem/1.45 var(--serif); }
.profile-links { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; }
.btn-ghost { background: none; color: var(--text); border-color: var(--line-strong); }
.section-lead { max-width: 44rem; margin: .75rem 0 0; color: var(--muted); }
.interests { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.interest { display: flex; flex-direction: column; gap: .25rem; padding: 1.25rem; border: 1px solid var(--line); border-radius: 2px; }
.interest .tile-icon { margin-bottom: .75rem; }
.interest h3 { margin: 0 0 .5rem; font: 400 1.25rem/1.25 var(--serif); }
.interest p { margin: 0 0 .6rem; }
.interest a { margin-top: auto; display: inline-flex; align-items: center; gap: .25rem; font-size: .9rem; }
.interest a .icon { width: 1rem; height: 1rem; }
@media (max-width: 36rem) {
  .profile { flex-direction: column; align-items: center; text-align: center; }
  .profile-photo { width: 136px; height: 136px; }
  .profile-links { justify-content: center; }
}
