/* =========================================================================
   ISR Dashboard — "Editorial academic" theme (2026-07)
   Override layer loaded AFTER style.css. Retunes the design tokens (fonts,
   colours, radius) — most of the app is variable-driven, so this restyles
   nearly everything — and adds the new left-sidebar shell, stats band,
   table, form, status and card treatments from the design handoff.

   Palette: Balgrist blue #1D4F91 accent on a cool paper (#FAFBFC).
   Fonts:   Source Serif 4 (display) + Instrument Sans (UI/body).
   Reversible: remove the <link> in ui.php to fall back to style.css.
   ========================================================================= */

/* ---- 1. Token retune -------------------------------------------------- */
:root {
  /* Surfaces */
  --bg: #FAFBFC;
  --paper: #FFFFFF;
  --paper-2: #F1F4F7;      /* sidebar / alt background */
  --active-bg: #F8FAFC;

  /* Ink + text scale */
  --ink: #1A2430;
  --ink-2: #333E49;
  --ink-3: #49545F;
  --muted: #5C6772;
  --muted-2: #78838E;
  --muted-3: #97A1AB;

  /* Hairlines */
  --rule: #E2E7EC;         /* section */
  --rule-2: #EAEEF2;       /* table rows */
  --rule-3: #EEF1F5;       /* card inner dividers */
  --input-border: #CFD8E0;

  /* Accent */
  --accent: #1D4F91;
  --accent-soft: #F0F6FC;  /* highlight card bg */
  --accent-border: #C9D8E8;
  --accent-tint: #E4ECF5;

  /* Status */
  --ok: #3E7C4F;
  --okbg: #EAF3ED;
  --err: #A33B32;
  --errbg: #F6ECEB;
  --inf: #1D4F91;
  --infbg: #F0F6FC;

  /* Compat aliases used directly by some pages */
  --text: var(--ink);
  --primary: var(--ink);
  --primary-h: var(--accent);
  --card: var(--paper);
  --card-2: var(--paper);
  --line: var(--rule);
  --shadow: 0 1px 2px rgba(26,36,48,0.05);
  --shadow-soft: 0 6px 24px rgba(26,36,48,0.06);

  --serif: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  --sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 10px;
  --radius-sm: 8px;

  color-scheme: light;
  font-family: var(--sans);
}

html, body { background: var(--bg); color: var(--ink); font-family: var(--sans); }

/* The hidden attribute only carries `display: none` from the UA stylesheet, so
   any component rule with a display of its own silently beats it. That is why
   the push banner stayed on screen after being switched on or dismissed:
   .push-prompt{display:flex} outranked it, and box.hidden = true did nothing
   visible. Anything marked hidden stays hidden. */
[hidden] { display: none !important; }

/* Tabular numerals for all data-ish text (dates, times, counts, IPs) */
table, .kpi-value, .slot-time, time, .mono, code, .tabnum { font-variant-numeric: tabular-nums; }

/* =========================================================================
   2. App shell — left sidebar + fluid main
   The existing markup is: .app-shell > .masthead + .app-body(.app-sidebar +
   .app-content). We turn the whole thing into a two-column grid: the sidebar
   column carries brand + nav + user footer; the masthead collapses away and
   its content is re-homed into the sidebar by ui.php.
   ========================================================================= */
.app-shell {
  display: grid;
  /* 270px: wide enough for the longest group label ("Colloquia & Journal
     Clubs") on one line next to its caret and for the wordmark, without the
     column starting to crowd the content. */
  grid-template-columns: 270px 1fr;
  min-height: 100vh;
  background: var(--bg);
}

/* The old top masthead is retired on desktop (brand now lives in sidebar). */
.app-shell > .masthead { display: none; }

.app-body { display: contents; }

.app-sidebar {
  grid-row: 1 / -1;
  background: var(--paper-2);
  /* style.css still pins the sidebar to 216px for the flex layout this grid
     replaced. As a grid item that fixed width wins over stretching, so the
     tinted bar stayed 216px however wide the column was — widening the column
     only widened the gap next to it. Let it fill its column again. */
  width: auto;
  flex: none;
  border-right: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 26px 0 22px;
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.app-content {
  min-width: 0;               /* let tables scroll instead of blowing out */
  display: flex;
  flex-direction: column;
  /* THE vertical line: style.css draws a border-left here, left over from the
     old flex layout. With the sidebar tinted it is one separator too many, and
     it ran right past the wordmark. */
  border-left: 0;
}

/* ---- Sidebar brand ---------------------------------------------------- */
.sidebar-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* Less padding on the right than on the left: the wordmark is the widest
     thing in this column and nothing else sits at that edge, so the room is
     better spent on the name than on symmetry. */
  padding: 0 14px 0 24px;
  text-decoration: none;
}
.sidebar-brand img {
  height: 30px;
  width: auto;
  align-self: flex-start;
  filter: brightness(0);
  margin-bottom: 4px;
}
.sidebar-brand { overflow: hidden; }   /* last-resort guard for the nowrap below */
.sidebar-brand .brand-title {
  font-family: var(--serif);
  /* 15px, not the original 17: at 17 the name needed ~250px and broke after
     "Spinal", leaving "Research" alone on a second line. With the column now at
     270px and the brand block trimmed on the right, 232px are left, so this
     sits on one line with air; nowrap keeps a font fallback from re-breaking it. */
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.012em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
  line-height: 1.25;
}
.sidebar-brand .brand-kicker {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

/* ---- Sidebar nav ------------------------------------------------------ */
.app-sidebar .primary-nav,
.app-sidebar .site-nav.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  overflow: visible;
}
.nav-group-label {
  padding: 0 24px 8px;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-3);
  font-weight: 600;
}
.app-sidebar .primary-nav a {
  display: flex;
  align-items: center;
  padding: 8px 24px 8px 21px;
  border-left: 3px solid transparent;
  border-bottom: 0;
  font-size: 13.5px;
  color: var(--ink-3);
  font-weight: 400;
  text-decoration: none;
  line-height: 1.25;
}
.app-sidebar .primary-nav a .nav-sublabel { display: none; } /* single-line nav */
.app-sidebar .primary-nav a:hover {
  color: var(--ink);
  background: rgba(29,79,145,0.05);
}
.app-sidebar .primary-nav a.is-active,
.app-sidebar .primary-nav a.active {
  border-left: 3px solid var(--accent);
  background: var(--active-bg);
  color: var(--ink);
  font-weight: 600;
}
.app-sidebar .nav-icon { display: none; }        /* typography-only nav */
.app-sidebar .nav-spacer { display: none; }

/* The "Menu" toggle exists only on phones; the media query below turns it on. */
.nav-toggle, .nav-toggle-input { display: none; }

/* Tools group (native <details>) as muted secondary items */
.app-sidebar .nav-group { width: 100%; }
.app-sidebar .nav-group > summary {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 24px;
  font-size: 13px;
  color: var(--muted-2);
  border-left: 3px solid transparent;
  cursor: pointer;
  list-style: none;
}
.app-sidebar .nav-group > summary .nav-label { white-space: nowrap; }
.app-sidebar .nav-group > summary::-webkit-details-marker { display: none; }
.app-sidebar .nav-group > summary .nav-icon { display: none; }
.app-sidebar .nav-group > summary:hover { color: var(--ink); }
/* Twice the old 9px: the caret is the only sign that an entry opens into
   sub-items, and at that size it read as a speck of dust. */
.app-sidebar .nav-caret { margin-left: auto; font-size: 18px; line-height: 1; opacity: 0.55; }
.app-sidebar .nav-group[open] > summary .nav-caret { transform: rotate(180deg); }
.app-sidebar .nav-group-items { display: flex; flex-direction: column; gap: 2px; }
.app-sidebar .nav-group-items a { padding-left: 34px !important; font-size: 12.5px; color: var(--muted-2); }

/* Group wrapper spacing */
.nav-section { display: flex; flex-direction: column; gap: 2px; }

/* ---- Sidebar user footer --------------------------------------------- */
.sidebar-foot {
  margin-top: auto;
  padding: 20px 24px 0;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sidebar-foot .who { font-size: 13px; font-weight: 600; color: var(--ink); }
.sidebar-foot .links { font-size: 12px; color: var(--muted-3); }
.sidebar-foot .links a { color: var(--muted-3); text-decoration: none; }
.sidebar-foot .links a:hover { color: var(--accent); }

/* =========================================================================
   3. Page header — kicker → serif title → subtitle
   ========================================================================= */
.app-content .topbar {
  display: block;
  padding: 40px 52px 0;
  border-bottom: 0;
}
/* The news strip already provides the top air — don't stack both paddings. */
.app-content .app-topstrip + .topbar { padding-top: 14px; }
.app-content .topbar .page-title h2 {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
  display: block;
}
.app-content .topbar .icon-chip { display: none; }        /* no emoji chips */
.page-kicker {
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 10px;
}
.app-content .topbar .page-title p.muted {
  font-size: 14.5px;
  color: var(--muted);
  margin: 8px 0 0;
}
/* the old "← Workspace" button is redundant with the sidebar */
.app-content .topbar .row { display: none; }

/* ---- One-time push offer on the workspace page ------------------------ */
.push-prompt {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  margin: 0 0 22px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 12px;
}
.push-prompt-icon { font-size: 20px; line-height: 1.3; flex: 0 0 auto; }
.push-prompt-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 auto; }
.push-prompt-text strong { font-size: 14.5px; color: var(--ink); }
.push-prompt-text .muted { font-size: 13px; line-height: 1.45; }
.push-prompt-note {
  display: block; margin-top: 8px;
  font-size: 12.5px; line-height: 1.45; color: var(--err);
}
.push-prompt-note.is-ok { color: var(--ok); }
.push-prompt-actions { display: flex; gap: 8px; flex: 0 0 auto; flex-wrap: wrap; }
.push-prompt-actions .btn { min-height: 38px; padding: 8px 16px; }
@media (max-width: 700px) {
  .push-prompt { flex-wrap: wrap; }
  .push-prompt-actions { width: 100%; }
  .push-prompt-actions .btn { flex: 1 1 auto; }
}

/* ---- News bell (short messages: upcoming colloquium / journal club) ----
   Sits in its own strip at the very top right of the content column. Native
   <details>, no JS — the panel is a positioned dropdown under the bell. */
.app-topstrip {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 18px 52px 0;
}
.news-bell { position: relative; }
.news-bell > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper);
  position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.news-bell > summary::-webkit-details-marker { display: none; }
.news-bell > summary:hover { border-color: var(--accent-border); box-shadow: 0 1px 6px rgba(20,22,26,0.07); }
.news-bell[open] > summary { border-color: var(--accent); }
.news-bell .bell-glyph { font-size: 16px; line-height: 1; }
.news-bell .bell-badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 19px; height: 19px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  border: 2px solid var(--bg);
  background: var(--accent); color: #FFFFFF;
  font-size: 11px; font-weight: 700; line-height: 1;
}

.news-panel {
  position: absolute; right: 0; top: calc(100% + 10px);
  width: min(400px, calc(100vw - 40px));
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(20,22,26,0.14);
  overflow: hidden;
  z-index: 60;
  text-align: left;
}
.news-panel .news-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--rule-3);
  background: var(--paper-2);
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-2); font-weight: 600;
}
.news-panel .news-head-note { letter-spacing: 0.04em; text-transform: none; font-size: 11.5px; color: var(--muted-2); font-weight: 400; }
.news-panel .news-empty { margin: 0; padding: 18px 16px; font-size: 13px; color: var(--muted); }

.news-panel .news-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; }
.news-panel .news-item + .news-item { border-top: 1px solid var(--rule-3); }
.news-panel .news-item > a {
  display: block;
  padding: 14px 16px;
  text-decoration: none;
  border-left: 3px solid var(--accent);
}
.news-panel .news-item > a:hover { background: var(--accent-soft); text-decoration: none; }
.news-panel .news-kind {
  display: flex; align-items: center; gap: 8px; margin-bottom: 5px;
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); font-weight: 600;
}
/* Addressed to this member only — not one of the group-wide reminders */
.news-panel .news-tag {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 9.5px; letter-spacing: 0.1em; font-weight: 700;
}
.news-panel .news-item.is-personal > a { border-left-color: var(--ok); }
.news-panel .news-item.is-personal .news-kind { color: var(--ok); }
.news-panel .news-item.is-personal .news-tag { background: var(--okbg); color: var(--ok); }

/* Running out shortly (an abstract deadline in its last week) — the only red
   in the panel, so it cannot be confused with the ordinary reminders. */
.news-panel .news-item.is-urgent > a { border-left-color: var(--err); background: var(--errbg); }
.news-panel .news-item.is-urgent > a:hover { background: color-mix(in srgb, var(--err) 12%, var(--paper)); }
.news-panel .news-item.is-urgent .news-kind { color: var(--err); }
.news-panel .news-item.is-urgent .news-headline { color: var(--err); }
.news-panel .news-item.is-urgent .news-cta { color: var(--err); }
.news-panel .news-tag.is-urgent { background: var(--err); color: #FFFFFF; }
.news-bell.has-urgent .bell-badge { background: var(--err); }
.news-panel .news-headline {
  display: block;
  font-family: var(--serif);
  font-size: 15px; font-weight: 600; line-height: 1.3;
  color: var(--ink);
}
.news-panel .news-detail { display: block; margin-top: 6px; font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.news-panel .news-meta { display: block; margin-top: 5px; font-size: 12px; line-height: 1.5; color: var(--muted-2); }
.news-panel .news-cta { display: inline-block; margin-top: 10px; font-size: 12.5px; font-weight: 600; color: var(--accent); }
.news-panel .news-state { display: inline-block; margin-top: 10px; font-size: 12.5px; color: var(--ok); }

/* Already handled — quieter, and no accent bar competing with the open items */
.news-panel .news-item.is-done > a { border-left-color: var(--rule); }

/* Registration QR inside a news item. 132 px is the smallest that still scans
   reliably off a laptop screen at arm's length; the white padding matters because
   a QR without a quiet zone is unreadable on a dark panel. */
.news-panel .news-qr {
  display: block; margin: 10px 0 2px; width: 132px; height: 132px;
  background: #fff; padding: 6px; border-radius: 6px;
}

.news-panel .news-item.is-done .news-kind { color: var(--muted-2); }
.news-panel .news-item.is-done .news-headline { color: var(--ink-3); font-weight: 500; }


/* ---- "I found an interesting study!" -----------------------------------
   The share button shares the top strip with the news bell, but it is not the
   bell's twin: the bell is a neutral pill you glance at, this is an invitation,
   so it carries the accent while the bell stays quiet. Same height and the same
   round ends keep them a pair; the gap between them is wide enough that they
   read as two controls rather than one smudge. */
.app-topstrip { gap: 18px; padding-top: 22px; }

.study-share-btn {
  display: inline-flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 18px 0 15px;
  border: 1px solid var(--accent-border); border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--sans); font-size: 13px; font-weight: 600;
  letter-spacing: 0.005em; line-height: 1; white-space: nowrap; text-decoration: none;
  box-shadow: 0 1px 2px rgba(29,79,145,0.06);
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.study-share-btn:hover {
  background: var(--accent-tint);
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(29,79,145,0.14);
}
.study-share-btn:active { transform: translateY(0); box-shadow: 0 1px 3px rgba(29,79,145,0.12); }
.study-share-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.study-share-icon { display: inline-flex; }
.study-share-icon svg { display: block; width: 18px; height: 18px; }
/* The spark is the one part that should catch the eye on hover. */
.study-share-btn:hover .study-share-icon svg { transform: scale(1.06); }
.study-share-icon svg { transition: transform 0.16s ease; }

/* ---- The share dialog --------------------------------------------------- */
.study-dialog {
  width: min(600px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 64px rgba(26,36,48,0.22), 0 2px 8px rgba(26,36,48,0.08);
  overflow: hidden;
}
.study-dialog::backdrop {
  background: rgba(20,28,38,0.42);
  backdrop-filter: blur(2px);
}
/* A short rise on open. Purely decorative, so it is skipped for anyone who has
   asked their system for less motion. */
.study-dialog[open] { animation: study-dialog-in 0.18s ease-out; }
@keyframes study-dialog-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .study-dialog[open] { animation: none; }
  .study-share-btn, .study-share-icon svg { transition: none; }
  .study-share-btn:hover { transform: none; }
}

.study-dialog-head {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 26px 28px 20px;
  background: linear-gradient(180deg, var(--accent-soft), var(--paper));
  border-bottom: 1px solid var(--rule-3);
}
.study-dialog-icon {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; width: 40px; height: 40px;
  border-radius: 11px;
  border: 1px solid var(--accent-border);
  background: var(--paper);
  color: var(--accent);
}
.study-dialog-icon svg { display: block; width: 21px; height: 21px; }
.study-dialog-titles { flex: 1 1 auto; min-width: 0; padding-top: 1px; }
.study-dialog-head h3 {
  margin: 0; font-family: var(--serif); font-size: 21px; line-height: 1.25; font-weight: 600;
}
.study-dialog-sub { margin: 5px 0 0; font-size: 13px; color: var(--muted); }
.study-dialog-x {
  flex: 0 0 auto; margin: -4px -6px 0 0;
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: 8px; background: none; cursor: pointer;
  color: var(--muted-2);
  transition: background 0.15s ease, color 0.15s ease;
}
.study-dialog-x svg { display: block; width: 17px; height: 17px; }
.study-dialog-x:hover { background: var(--rule-2); color: var(--ink); }
.study-dialog .study-form { padding: 24px 28px 26px; }

/* ---- The form, shared by the dialog and studies.php --------------------- */
.study-form { display: block; }
.study-form-lead {
  margin: 0 0 22px; padding: 12px 14px;
  border-left: 3px solid var(--accent-border);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
  font-size: 12.5px; line-height: 1.6; color: var(--ink-3);
}
.study-field {
  display: block; margin-bottom: 20px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted);
}
.study-field input, .study-field textarea {
  display: block; width: 100%; margin-top: 8px;
  padding: 11px 13px;
  border: 1px solid var(--input-border); border-radius: 9px;
  background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 14px; font-weight: 400; line-height: 1.55;
  letter-spacing: normal; text-transform: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.study-field input::placeholder, .study-field textarea::placeholder { color: var(--muted-3); }
.study-field input:focus, .study-field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint);
}
.study-field textarea { resize: vertical; min-height: 96px; }
.study-optional {
  display: block; margin-top: 3px;
  font-weight: 400; text-transform: none; letter-spacing: normal;
  color: var(--muted-2); font-size: 11.5px;
}
.study-form-actions {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 24px; padding-top: 20px;
  border-top: 1px solid var(--rule-3);
}
.study-form-link { margin-right: auto; font-size: 12.5px; color: var(--muted); }
.study-form-link:hover { color: var(--accent); }

/* ---- Team meetings: the attendance picker ------------------------------
   One row per ISR member with a three-way choice. Two columns from 720px so a
   fifteen-person roster does not push the rest of the form off the screen. */
.tm-attendance {
  margin: 4px 0 6px;
  border: 1px solid var(--rule); border-radius: 12px;
  background: var(--bg);
  padding: 16px 18px 14px;
}
.tm-attendance-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.tm-attendance-title {
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted);
}
.tm-attendance-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tm-attendance-note { margin: 12px 0 0; line-height: 1.5; }

/* Columns are chosen by the available width, not by a breakpoint: the panel is
   full width on a desktop and the whole card on a phone, and auto-fill lands on
   three, two or one accordingly. The 300px floor is what a long name plus the
   control needs before it has to wrap. */
.tm-roster {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 2px 28px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.tm-roster-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 5px 0; min-width: 0;
  border-bottom: 1px solid var(--rule-3);
}
/* min-width:0 on both sides, or the name's nowrap sets a floor the grid cannot
   go below and the whole box overflows its card instead of shrinking. */
.tm-roster-name {
  flex: 1 1 auto; min-width: 0;
  font-size: 13.5px; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* A segmented control, not three loose radio dots: the dot is hidden and the
   label itself is the target, so the whole word is clickable. */
.tm-roster-choice {
  display: inline-flex; flex: 0 0 auto;
  border: 1px solid var(--input-border); border-radius: 999px;
  background: var(--paper); overflow: hidden;
}
.tm-choice { display: inline-flex; margin: 0; cursor: pointer; }
.tm-choice input {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0; clip-path: inset(50%); overflow: hidden;
}
.tm-choice > span {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 3px 11px; min-width: 30px;
  font-family: var(--sans); font-size: 11.5px; font-weight: 600;
  color: var(--muted-2); white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}
.tm-choice + .tm-choice > span { border-left: 1px solid var(--rule-2); }
.tm-choice:hover > span { background: var(--rule-2); color: var(--ink-2); }
.tm-choice-present input:checked + span { background: var(--okbg); color: var(--ok); }
.tm-choice-absent  input:checked + span { background: var(--errbg); color: var(--err); }
.tm-choice-none    input:checked + span { background: var(--rule-2); color: var(--muted); }
.tm-choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }

/* The two stored text fields, folded away under the picker. */
.tm-text-fields { border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); }
.tm-text-fields > summary {
  list-style: none; cursor: pointer; padding: 9px 14px;
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  letter-spacing: 0.03em; color: var(--muted); user-select: none;
}
.tm-text-fields > summary::-webkit-details-marker { display: none; }
.tm-text-fields > summary::before { content: '▸ '; font-size: 10px; }
.tm-text-fields[open] > summary { border-bottom: 1px solid var(--rule-3); color: var(--ink-2); }
.tm-text-fields[open] > summary::before { content: '▾ '; }
.tm-text-fields-body { display: flex; flex-direction: column; gap: 12px; padding: 14px; }
.tm-text-fields-body label { display: block; }

/* ---- Team meetings: "fill in from last" ---------------------------------
   A quiet inline action on the label line of the two attendance fields, not a
   button in the form's action row: it belongs to its field, and it must not
   compete with Save. */
.tm-label-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tm-fill-btn {
  padding: 2px 9px;
  border: 1px solid var(--accent-border); border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  line-height: 1.7; cursor: pointer; white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.tm-fill-btn:hover { background: var(--accent-tint); border-color: var(--accent); }
.tm-fill-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tm-fill-btn:disabled {
  background: var(--rule-2); border-color: var(--rule); color: var(--muted-3);
  cursor: not-allowed;
}

/* ---- Tabs, no JavaScript -----------------------------------------------
   One radio per tab plus a sibling selector. Switching costs no request, and
   arrow keys move between the tabs because they really are radio buttons. The
   inputs are moved off screen rather than display:none so they stay keyboard
   reachable. Shared by the Knowledge Base card and the Team meetings page; each
   page adds only its own handful of :checked rules, since a selector has to
   name the ids it pairs. */
.ui-tabs .ui-tab-input {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
.ui-tablist {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin: -4px 0 20px;
  border-bottom: 1px solid var(--rule);
}
.ui-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 16px 12px;
  margin-bottom: -1px;
  border: 1px solid transparent; border-bottom: 2px solid transparent;
  border-radius: 8px 8px 0 0;
  cursor: pointer; user-select: none;
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  color: var(--muted);
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.ui-tab:hover { color: var(--ink); background: var(--accent-soft); }
.ui-tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px;
  background: var(--rule-2); color: var(--muted);
  font-size: 11px; font-weight: 700; line-height: 1;
}
.ui-tabpanel { display: none; }
/* The Knowledge Base card: Top ISR Knowledge Base / suggested by members. */
#kbtab-top:checked ~ .ui-tabpanel.kb-panel-top,
#kbtab-shared:checked ~ .ui-tabpanel.kb-panel-shared { display: block; }
#kbtab-top:checked ~ .ui-tablist label[for="kbtab-top"],
#kbtab-shared:checked ~ .ui-tablist label[for="kbtab-shared"],
#tmtab-minute:checked ~ .ui-tablist label[for="tmtab-minute"],
#tmtab-resp:checked ~ .ui-tablist label[for="tmtab-resp"],
#tmtab-archive:checked ~ .ui-tablist label[for="tmtab-archive"] {
  color: var(--accent); font-weight: 600;
  border-bottom-color: var(--accent);
  background: var(--paper);
}
#kbtab-top:checked ~ .ui-tablist label[for="kbtab-top"] .ui-tab-count,
#kbtab-shared:checked ~ .ui-tablist label[for="kbtab-shared"] .ui-tab-count,
#tmtab-archive:checked ~ .ui-tablist label[for="tmtab-archive"] .ui-tab-count {
  background: var(--accent-tint); color: var(--accent);
}
/* The focus ring is drawn on the label — the input it belongs to is off screen,
   so without this keyboard users would see nothing move. */
#kbtab-top:focus-visible ~ .ui-tablist label[for="kbtab-top"],
#kbtab-shared:focus-visible ~ .ui-tablist label[for="kbtab-shared"],
#tmtab-minute:focus-visible ~ .ui-tablist label[for="tmtab-minute"],
#tmtab-resp:focus-visible ~ .ui-tablist label[for="tmtab-resp"],
#tmtab-archive:focus-visible ~ .ui-tablist label[for="tmtab-archive"] {
  outline: 2px solid var(--accent); outline-offset: -2px;
}

/* The Team meetings page: minute / responsibilities / archive. */
#tmtab-minute:checked  ~ .ui-tabpanel.tm-panel-minute,
#tmtab-resp:checked    ~ .ui-tabpanel.tm-panel-resp,
#tmtab-archive:checked ~ .ui-tabpanel.tm-panel-archive { display: block; }
/* Panels hold cards of their own, so they must not add a second frame. */
.tm-panel-minute > .card:first-child,
.tm-panel-resp   > .card:first-child,
.tm-panel-archive > .card:first-child { margin-top: 0; }

.ui-tab-lead { margin: 0 0 16px; line-height: 1.55; max-width: 74ch; }

/* The share form sits under the list it feeds, set apart so the tab reads as
   "here is what the group shared, and here is how you add to it". */
.kb-share-box {
  margin-top: 26px; padding: 22px;
  border: 1px solid var(--rule); border-radius: 12px;
  background: var(--bg);
}
.kb-share-box h4 {
  margin: 0 0 14px;
  font-family: var(--serif); font-size: 17px; font-weight: 600;
}
.kb-share-box .study-form-lead { background: var(--paper); }
.study-form-spacer { margin-right: auto; }

/* ---- One shared study, as listed in the Knowledge Base tab -------------- */
.study-list { list-style: none; margin: 10px 0 0; padding: 0; }
.study-row {
  display: flex; align-items: flex-start; gap: 20px;
  padding: 20px 0 20px 16px;
  border-left: 3px solid var(--rule);
}
.study-row + .study-row { border-top: 1px solid var(--rule-3); }
/* Still on the bell — the accent bar is the same signal the news panel uses. */
.study-row.is-live { border-left-color: var(--accent); }
.study-main { flex: 1 1 auto; min-width: 0; }
.study-title {
  display: block;
  font-family: var(--serif); font-size: 16.5px; line-height: 1.35; font-weight: 600;
  color: var(--ink);
}
.study-title:hover { color: var(--accent); }
.study-meta { margin-top: 6px; font-size: 12.5px; color: var(--muted-2); }
.study-remark {
  margin: 12px 0 0; padding: 9px 0 9px 14px;
  border-left: 2px solid var(--accent-border);
  font-size: 13.5px; line-height: 1.55; color: var(--ink-2);
}
.study-foot { margin-top: 10px; }

/* The two scales a suggestion is judged on, inline under the row it belongs to.
   Kept quiet: it is a control, not the content, and the paper has to stay the
   loudest thing in the row. */
.study-vote {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed var(--rule-2);
}
.study-vote-field { display: inline-flex; flex-direction: column; gap: 4px; }
.study-vote-field > span {
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted-2);
}
.study-vote select {
  min-height: 32px; padding: 4px 8px;
  border: 1px solid var(--input-border); border-radius: 7px;
  background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 13px;
}
.study-vote select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint);
}
/* Cleared the threshold — same wording and the same green as the pipeline
   papers wear in the feed, because it means the same thing. */
.study-kb-pill, .study-kb-origin {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; line-height: 1.6;
}
.study-kb-pill { background: var(--okbg); color: var(--ok); }
.study-kb-origin { background: var(--accent-tint); color: var(--accent); margin-left: 6px; }

.study-flag { color: var(--accent); font-weight: 600; }

@media (max-width: 720px) {
  .study-share-text { display: none; }
  .study-share-btn { padding: 0; width: 38px; justify-content: center; gap: 0; }
  .app-topstrip { gap: 12px; }
  .study-dialog-head { padding: 20px 20px 16px; }
  .study-dialog .study-form { padding: 20px; }
  .study-row { flex-direction: column; gap: 12px; }
}

.app-content .main { padding: 32px 52px 72px; max-width: 1180px; }

/* =========================================================================
   4. Stats band — labels above serif numbers, on a hairline band
   ========================================================================= */
.kpi-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 56px;
  padding: 4px 0 28px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 32px;
  background: transparent;
}
.kpi-card {
  background: transparent;
  border: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.kpi-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 600;
}
.kpi-value {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.05;
}
.kpi-sub { font-size: 12px; color: var(--muted-2); }

/* Slim progress bar (occupancy etc.) */
.progress {
  height: 6px;
  border-radius: 999px;
  background: #E4E9EE;
  overflow: hidden;
  margin-top: 8px;
}
.progress > span, .progress > .bar, .progress-fill {
  display: block; height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

/* =========================================================================
   5. Cards
   ========================================================================= */
.card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 26px;
  margin-bottom: 20px;
  box-shadow: none;
}
.card h3 {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin: 0 0 4px;
}
.card .card-head { margin-bottom: 16px; }

/* Highlight card (next/upcoming) */
.card.highlight, .highlight-card {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}
/* Empty-state card */
.empty, .empty-state {
  border: 1px dashed var(--input-border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  padding: 22px 24px;
  font-size: 13.5px;
}

/* Small accent pill badge ("in 13 days") */
.pill-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  padding: 2px 10px;
}

/* =========================================================================
   6. Tables — hairlines, no zebra, uppercase headers
   ========================================================================= */
table { width: 100%; border-collapse: collapse; background: transparent; font-size: 14px; }
thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--muted-3);
  text-align: left;
  padding: 0 14px 10px;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
tbody td { padding: 14px; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
tbody tr:hover td { background: rgba(29,79,145,0.02); }
.table-wrap, .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Row title / secondary line pattern */
.row-title, td .title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}
.row-sub, td .sub {
  font-size: 12.5px;
  color: var(--muted-2);
  margin-top: 3px;
}
td .mono, .doi { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }

/* =========================================================================
   7. Status dots
   ========================================================================= */
.status, .status-tag, .badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--ink-2);
}
.status::before, .badge-booked::before, .badge-open::before, .badge-neutral::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 999px;
  flex: 0 0 auto;
}
.badge-booked { color: var(--ink); }
.badge-booked::before { background: var(--accent); }
.badge-open { color: var(--ok); }
.badge-open::before { background: transparent; box-shadow: inset 0 0 0 1px var(--ok); }
.badge-neutral { color: var(--muted-2); }
.badge-neutral::before { background: var(--muted-3); }

/* Status word colours where dots aren't used */
.status-published, .ok { color: var(--ok); }
.status-pending { color: var(--muted-2); }
.login_failed, .status-error { color: var(--err); }

/* =========================================================================
   8. Buttons
   ========================================================================= */
.btn {
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
  min-height: 40px;
  padding: 9px 18px;
  background: var(--ink);
  color: #fff;
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--input-border);
  color: var(--ink-2);
  border-radius: 999px;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); background: transparent; }

.btn-sm, .btn-small { min-height: 32px; padding: 6px 13px; font-size: 12.5px; }

/* Tertiary text-link actions in tables */
.action-link, .status-actions a, td a.link {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}
.action-link:hover { text-decoration: underline; }
.action-danger, a.delete { color: var(--muted-3); }
.action-danger:hover { color: var(--err); }

/* =========================================================================
   9. Forms
   ========================================================================= */
.form-grid label, .form-grid > label, .field label, form label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--muted-2);
}
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], input[type=date], input[type=time], input[type=search],
select, textarea {
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29,79,145,0.12);
}
input[type=file] {
  border: 1px dashed var(--input-border);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: transparent;
  width: 100%;
}

/* Segmented control (FS/HS semester switch) */
.segmented, .sem-tabs {
  display: inline-flex;
  border: 1px solid var(--input-border);
  border-radius: 999px;
  overflow: hidden;
}
.segmented a, .sem-tabs a {
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  text-decoration: none;
  border: 0;
}
.segmented a.active, .sem-tabs a.active { background: var(--ink); color: #fff; }

/* =========================================================================
   10. Alerts
   ========================================================================= */
.alert { border-radius: var(--radius-sm); border: 1px solid var(--rule); padding: 12px 16px; font-size: 13.5px; }
.alert.success { background: var(--okbg); border-color: #CDE6D5; color: var(--ok); }
.alert.error   { background: var(--errbg); border-color: #E8CFCC; color: var(--err); }
.alert.info    { background: var(--infbg); border-color: var(--accent-border); color: var(--inf); }

/* =========================================================================
   11. Auth (login / signup) — centred card on alt background
   ========================================================================= */
.auth-body { background: var(--paper-2); }
.auth-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  max-width: 380px;
  padding: 32px;
}
.auth-card .brand-mark { filter: brightness(0); }
.auth-card h1 { font-family: var(--serif); font-weight: 700; }

/* =========================================================================
   12. Attendee display — person pictograms (read-only) + name chips (mgmt)
   ========================================================================= */
.attendee-chip, .feedback-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.attendee-chip .remove-x { color: var(--muted-3); text-decoration: none; }
.attendee-chip .remove-x:hover { color: var(--err); }

/* An ISR member on the BoF list is there through their account, not through a
   sign-up on the shared UA login — tinted so the two kinds of name are told
   apart at a glance, and it carries no remove button. */
.attendee-chip-member {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}


.person-pip {
  display: inline-block;
  width: 9px; height: 10px;
  position: relative;
  color: var(--muted-2);
  margin-right: 3px;
}
.person-pip::before { /* head */
  content: ""; position: absolute; top: 0; left: 2px;
  width: 5px; height: 5px; border-radius: 999px; background: currentColor;
}
.person-pip::after {  /* shoulders */
  content: ""; position: absolute; bottom: 0; left: 0;
  width: 9px; height: 5px; border-radius: 4px 4px 0 0; background: currentColor;
}

/* =========================================================================
   13. Role chip / misc
   ========================================================================= */
.role-chip {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  font-weight: 600; color: var(--accent);
}
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }

/* =========================================================================
   14. Responsive — sidebar collapses to a top bar below 900px
   ========================================================================= */
@media (max-width: 900px) {
  /* iOS Safari zooms the whole page as soon as a focused field is under 16px,
     and body text here is 15px — so every tap into a form jerked the layout.
     Nearly all mobile traffic on this dashboard is iPhone, so this is the one
     mobile fix that everybody feels. Desktop is untouched. */
  input, select, textarea { font-size: 16px; }

  /* Thumb-sized hit areas for the small icon controls in tables (edit, delete,
     download, and the × on an attendee chip) — 28px is a mouse target. */
  .icon-link { min-width: 40px; height: 40px; }
  .remove-x { min-width: 32px; min-height: 32px; padding: 0 8px; }
  .attendee-chip { margin: 2px 0; }

  /* Wide content must scroll inside its own box, never the page body. */
  .table-wrap, .table-wrapper { max-width: 100%; }
  body { overflow-x: hidden; }

  .app-shell { grid-template-columns: 1fr; }

  /* Header bar: brand on the left, "Menu" on the right, nothing else until
     somebody asks for it. */
  .app-sidebar {
    position: static; height: auto; min-height: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0;
    padding: 12px 16px;
    border-right: 0; border-bottom: 1px solid var(--rule);
    overflow: visible;
  }
  .sidebar-brand { padding: 0; gap: 2px; }
  .sidebar-brand img { height: 24px; margin-bottom: 2px; }
  /* Narrower here (header bar shares the row with the Menu button); the
     ellipsis above catches the smallest phones instead of clipping a letter. */
  .sidebar-brand .brand-title { font-size: 14px; }
  .sidebar-brand .brand-kicker { font-size: 9px; letter-spacing: 0.12em; }

  /* Off screen rather than display:none, so it stays keyboard-reachable and
     the :checked selectors below keep working. */
  .nav-toggle-input {
    display: block;
    position: absolute; width: 1px; height: 1px;
    opacity: 0; pointer-events: none;
  }
  .nav-toggle-input:focus-visible ~ .nav-toggle { outline: 2px solid var(--accent); outline-offset: 2px; }

  .nav-toggle {
    grid-column: 2; grid-row: 1;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 14px;
    border: 1px solid var(--rule); border-radius: 999px;
    background: var(--paper); color: var(--ink-2);
    font-size: 13px; font-weight: 500;
    cursor: pointer; user-select: none;
  }
  .nav-toggle-bars { display: inline-flex; flex-direction: column; gap: 3px; }
  .nav-toggle-bars span { display: block; width: 15px; height: 2px; border-radius: 2px; background: currentColor; }
  .nav-toggle-input:checked ~ .nav-toggle { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }

  /* The nav and the user footer live in the collapsed panel — the footer holds
     Settings and Logout, which used to be display:none on phones and therefore
     simply unreachable. */
  .app-sidebar .primary-nav, .app-sidebar .site-nav.nav, .sidebar-foot { display: none; }
  .nav-toggle-input:checked ~ .primary-nav,
  .nav-toggle-input:checked ~ .site-nav.nav,
  .nav-toggle-input:checked ~ .sidebar-foot {
    display: flex; flex-direction: column;
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 12px;
    border-top: 1px solid var(--rule-soft, var(--rule));
  }

  /* One straight left edge for every row — links, group headers and the items
     inside a group — instead of the ragged mix of paddings a wrapped flex row
     produced. */
  .app-sidebar .primary-nav a,
  .app-sidebar .nav-group > summary {
    display: flex; align-items: center;
    width: 100%; min-height: 46px;
    padding: 10px 4px; margin: 0;
    border: 0; border-bottom: 1px solid var(--rule-soft, var(--rule));
    border-radius: 0;
    font-size: 15px;
  }
  .app-sidebar .nav-group > summary { color: var(--ink-2); font-weight: 600; }
  .app-sidebar .primary-nav a.is-active, .app-sidebar .primary-nav a.active {
    border-left: 0; border-bottom: 1px solid var(--rule-soft, var(--rule));
    background: var(--accent-soft); color: var(--accent); font-weight: 600;
  }
  .app-sidebar .nav-group-items a { padding-left: 20px !important; font-size: 14.5px; }
  .app-sidebar .nav-group-items a::before {
    content: "—"; margin-right: 8px; color: var(--muted-3); font-size: 11px;
  }
  .app-sidebar .nav-caret { margin-left: auto; font-size: 22px; line-height: 1; opacity: 0.7; }
  /* The sublabels are the only way to tell two similar entries apart on a phone,
     where there is room for them. */
  .app-sidebar .primary-nav a .nav-sublabel {
    display: block; font-size: 11px; color: var(--muted-2); margin-top: 2px;
  }
  .app-sidebar .primary-nav a { flex-wrap: wrap; }
  .app-sidebar .nav-text-stack { display: flex; flex-direction: column; }

  .nav-group-label {
    display: block; padding: 14px 4px 6px;
    font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--muted-3); font-weight: 700;
  }
  .sidebar-foot { padding: 14px 4px 4px; margin-top: 0; }
  .sidebar-foot .links { font-size: 14px; }
  .sidebar-foot .links a { padding: 6px 0; display: inline-block; }
  .sidebar-brand { padding: 0; }
  .app-content .topbar { padding: 24px 24px 0; }
  .app-topstrip { padding: 14px 24px 0; }
  .app-content .app-topstrip + .topbar { padding-top: 10px; }
  .app-content .main { padding: 20px 24px 56px; }
  .app-content .topbar .page-title h2 { font-size: 27px; }
}
