/* Joint Venture Team Hub: modern SPA-feel */
:root {
  --bg-base: 165 14% 97%;
  --bg-surface: 0 0% 100%;
  --bg-muted: 160 12% 95%;
  --accent: 158 48% 34%;
  --accent-hover: 158 55% 27%;
  --accent-light: 158 40% 94%;
  --accent-glow: 158 48% 34%;
  --mist: 200 28% 62%;
  --text: 220 30% 15%;
  --text-secondary: 215 15% 40%;
  --text-muted: 215 15% 55%;
  --border: 160 12% 88%;
  --border-light: 160 14% 93%;
  --radius: 0.75rem;
  --radius-sm: 0.5rem;
  --radius-md: 0.65rem;
  --radius-lg: 1rem;
  --bg-elevated: var(--bg-surface);
  --surface-elevated: var(--bg-surface);
  --shadow: 0 4px 24px -6px rgba(20, 40, 35, .07);
  --shadow-lg: 0 14px 42px -14px rgba(20, 40, 35, .12);
  --font: Inter, system-ui, sans-serif;
  --font-head: Outfit, system-ui, sans-serif;
  --header-h: 52px;
  --content-max: min(100%, calc(100vw - 2 * var(--page-padding)));
  --content-max-wide: var(--content-max);
  --page-padding: clamp(0.75rem, 2vw, 1.75rem);
  --space-xs: 0.35rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.25rem;
  --space-xl: 1.5rem;
  --gap: var(--space-md);
  --section-gap: var(--space-lg);
  --transition: 0.2s cubic-bezier(.4,0,.2,1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-soft: cubic-bezier(.4, 0, .2, 1);
  --study-accent: var(--study-color, hsl(var(--accent)));
  --shadow-glow: 0 12px 32px -16px color-mix(in srgb, var(--study-accent) 28%, transparent);
  --touch-min: 44px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: clip;
  /* Prevent scrollbar flash from shifting the whole page on hover */
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font);
  background-color: hsl(var(--bg-base));
  color: hsl(var(--text));
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  position: relative;
  isolation: isolate;
}

/* Atmospheric mesh: soft aurora washes (green + cool mist), behind all UI */
body::before,
body::after {
  content: "";
  position: fixed;
  /* Oversized so gentle drift never shows a hard viewport edge */
  inset: -14%;
  pointer-events: none;
  z-index: -1;
}

body::before {
  background:
    radial-gradient(ellipse 58% 42% at 12% 8%, hsla(var(--accent), .12), transparent 68%),
    radial-gradient(ellipse 48% 38% at 88% 12%, hsla(var(--mist), .1), transparent 64%),
    radial-gradient(ellipse 42% 36% at 72% 78%, hsla(var(--accent), .08), transparent 66%),
    radial-gradient(ellipse 50% 40% at 18% 88%, hsla(185 35% 55% / .06), transparent 62%);
  animation: meshDriftA 28s ease-in-out infinite alternate;
}

body::after {
  background:
    radial-gradient(ellipse 36% 28% at 40% 30%, hsla(var(--accent), .07), transparent 74%),
    radial-gradient(ellipse 30% 26% at 65% 55%, hsla(var(--mist), .06), transparent 72%);
  mix-blend-mode: multiply;
  opacity: .5;
  animation: meshDriftB 36s ease-in-out infinite alternate;
}

a { color: hsl(var(--accent)); text-decoration: none; transition: color var(--transition); }
a:hover { color: hsl(var(--accent-hover)); }

h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; line-height: 1.2; letter-spacing: -.02em; }

/* Header */
.app-header {
  position: sticky; top: 0; z-index: 200;
  width: 100%;
  padding-top: env(safe-area-inset-top, 0);
  background: hsla(var(--bg-surface), .82);
  backdrop-filter: blur(16px) saturate(1.25);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  border-bottom: 1px solid color-mix(in srgb, hsl(var(--accent)) 10%, hsl(var(--border)));
  box-shadow: 0 1px 0 hsla(0 0% 100% / .55) inset;
}
.app-header::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, hsla(var(--accent), .28), transparent);
  background-size: 200% 100%;
  animation: chromeSheen 8s ease-in-out infinite;
  pointer-events: none;
}

.page-shell,
.content-shell {
  display: flex; flex-direction: column; min-height: 100vh; width: 100%;
}

.page-shell > .main,
.content-shell > .main { flex: 1; }

/* Einheitliche Content-Breite */
.content-shell .app-header__inner,
.content-shell > .main {
  max-width: var(--content-max);
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.app-header__inner {
  display: flex; align-items: center; gap: 0.75rem;
  max-width: var(--content-max); margin: 0 auto;
  padding: 0 var(--page-padding); min-height: var(--header-h);
  width: 100%;
}

.app-header__left {
  display: flex; align-items: center; gap: .7rem;
  flex: 1; min-width: 0;
}

.app-header__brand {
  display: flex; align-items: center; gap: .6rem;
  color: hsl(var(--text)); flex-shrink: 0;
  padding: .15rem .2rem .15rem 0;
  border-radius: var(--radius-sm);
  transition: opacity .2s ease;
}
.app-header__brand:hover { color: hsl(var(--text)); opacity: .88; }

.app-header__logo {
  width: 32px; height: 32px; object-fit: contain; flex-shrink: 0;
  filter: drop-shadow(0 1px 2px hsla(158, 30%, 25%, .12));
}

.app-header__brand-text {
  display: flex; flex-direction: column; gap: .05rem; line-height: 1.1;
}
.app-header__title {
  font-family: var(--font-head); font-weight: 600; font-size: .92rem;
  letter-spacing: -.02em; color: hsl(158 42% 22%);
}
.app-header__subtitle {
  font-size: .62rem; font-weight: 500; letter-spacing: .04em;
  text-transform: uppercase; color: hsl(158 22% 42%);
}

.app-header__divider {
  width: 1px; height: 1.55rem; flex-shrink: 0;
  background: linear-gradient(
    180deg,
    transparent,
    color-mix(in srgb, hsl(var(--accent)) 35%, hsl(var(--border))),
    transparent
  );
}

.top-nav {
  display: flex; align-items: center; gap: .2rem;
  flex: 1; min-width: 0; justify-content: flex-start;
}

.top-nav__link {
  display: inline-flex; align-items: center; gap: .35rem;
  min-height: 2.25rem;
  padding: .35rem .7rem; border-radius: 999px;
  font-size: .8rem; font-weight: 500; color: hsl(var(--text-secondary));
  transition: background var(--transition), color var(--transition),
    border-color var(--transition), box-shadow var(--transition), transform .25s var(--ease-out);
}
.top-nav__link:hover { background: hsla(var(--accent), .06); color: hsl(var(--text)); }
.top-nav__link:active { transform: scale(.97); }
.top-nav__link.active {
  background: hsla(var(--accent), .1); color: hsl(var(--accent)); font-weight: 600;
}
.top-nav__link--studies {
  border: 1px solid hsla(158, 30%, 40%, .12);
  background:
    linear-gradient(160deg, hsl(0 0% 100%) 0%, hsl(158 35% 97%) 100%);
  color: hsl(158 40% 28%);
  font-weight: 600;
  box-shadow: 0 1px 2px hsla(160, 25%, 20%, .04), inset 0 1px 0 hsla(0, 0%, 100%, .8);
}
.top-nav__link--studies:hover {
  color: hsl(var(--accent));
  border-color: hsla(var(--accent), .3);
  background: linear-gradient(160deg, hsl(158 45% 98%) 0%, hsl(158 40% 94%) 100%);
  box-shadow: 0 0 0 3px hsla(var(--accent), .1), 0 3px 10px hsla(var(--accent), .12);
}
.top-nav__link--studies.active {
  color: hsl(var(--accent));
  border-color: hsla(var(--accent), .38);
  background: linear-gradient(160deg, hsl(158 45% 96%) 0%, hsl(158 40% 91%) 100%);
  box-shadow: 0 0 0 3px hsla(var(--accent), .1), inset 0 1px 0 hsla(0, 0%, 100%, .85);
}
.top-nav__icon { flex-shrink: 0; opacity: .85; }
.top-nav__crumb {
  flex-shrink: 0;
  padding: 0 .15rem;
  font-size: .95rem; font-weight: 400; line-height: 1;
  color: hsl(158 18% 58%);
  user-select: none;
}
.top-nav__link--study {
  max-width: min(16rem, 36vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: hsl(var(--text));
}

.app-header__user { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; position: relative; z-index: 2; margin-left: auto; }
.header-users-btn { position: relative; z-index: 3; }
.top-nav__link--mobile-only { display: none; }
.user-pill {
  font-size: .78rem; padding: .25rem .65rem; border-radius: 999px;
  background: hsla(var(--accent), .1); color: hsl(var(--accent)); font-weight: 500;
}

.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  background: none; border: none; cursor: pointer;
  min-width: var(--touch-min); min-height: var(--touch-min);
  padding: .5rem; border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.nav-toggle:hover { background: hsla(var(--accent), .06); }
.nav-toggle span {
  display: block; width: 22px; height: 2px;
  background: hsl(var(--text)); border-radius: 2px; transition: var(--transition);
}

/* Main */
.main { max-width: var(--content-max); margin: 0 auto; padding: var(--section-gap) var(--page-padding) var(--space-xl); width: 100%; }
.page-stack { display: flex; flex-direction: column; gap: var(--section-gap); }
.stack-gap { display: flex; flex-direction: column; gap: var(--section-gap); }
.stack-gap--sm { gap: var(--space-md); }

/* Legacy-Modifier */
.page-shell--wide .app-header__inner,
.main.main--wide {
  max-width: var(--content-max);
  width: 100%;
}

.input-full { width: 100%; max-width: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  font-size: .8rem; color: hsl(var(--text-muted)); margin-bottom: 0.75rem;
}
.breadcrumbs a { color: hsl(var(--text-secondary)); }
.breadcrumbs span::before { content: '/'; margin-right: .4rem; opacity: .4; }

/* Typography helpers */
.eyebrow {
  font-size: .72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; color: hsl(var(--accent)); margin-bottom: .35rem;
}
.lead { color: hsl(var(--text-secondary)); font-size: 1rem; margin-top: .35rem; }
.muted { color: hsl(var(--text-muted)); font-size: .9rem; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-md); flex-wrap: wrap; margin-bottom: var(--section-gap);
}
.page-head h1 { font-size: 1.75rem; margin: 0; }
.page-head .lead { margin-top: 0.25rem; margin-bottom: 0; }
.page-head .toolbar { align-items: center; }

/* Hero */
.hero {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-md); flex-wrap: wrap; margin-bottom: var(--section-gap);
  padding: 0;
}
.hero h1 { font-size: 1.75rem; }
.hero__stats { display: flex; gap: .65rem; flex-wrap: wrap; }
.stat-chip {
  padding: .5rem 1rem; border-radius: 999px; font-size: .85rem;
  background: hsl(var(--bg-surface)); border: 1px solid hsl(var(--border));
  box-shadow: var(--shadow);
}
.stat-chip strong { color: hsl(var(--accent)); }

/* Module tiles */
.module-grid {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-md); margin-bottom: var(--section-gap);
}
.module-tile {
  display: flex; align-items: center; gap: 1rem;
  padding: 1.25rem; border-radius: var(--radius);
  background:
    linear-gradient(160deg, color-mix(in srgb, hsl(var(--accent)) 7%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-surface)) 55%),
    hsl(var(--bg-surface));
  border: 1px solid hsl(var(--border-light));
  border-top: 2px solid hsla(var(--accent), .28);
  box-shadow: var(--shadow); color: hsl(var(--text));
  transition:
    transform .4s var(--ease-out),
    box-shadow .35s ease,
    border-color .3s ease,
    background .35s ease;
  position: relative; overflow: hidden; isolation: isolate;
}
.module-tile::before {
  content: ''; position: absolute; top: -18%; right: -12%; width: 62%; height: 78%; z-index: 0;
  background: radial-gradient(circle at 40% 40%, hsla(var(--accent), .14), transparent 72%);
  opacity: .55; filter: blur(18px);
  pointer-events: none;
  animation: blobFloat 16s ease-in-out infinite;
}
.module-tile::after {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(105deg, transparent 38%, hsla(0 0% 100% / .45) 50%, transparent 62%);
  transform: translateX(-130%) skewX(-14deg); opacity: 0;
}
.module-tile > * { position: relative; z-index: 2; }
.module-tile:hover {
  box-shadow: var(--shadow-lg), 0 14px 28px -18px hsla(var(--accent), .35);
  border-color: hsla(var(--accent), .28);
  border-top-color: hsla(var(--accent), .55);
}
.module-tile:hover::before { opacity: .85; }
.module-tile:hover::after {
  opacity: 1;
  animation: surfaceSheen .95s var(--ease-out) both;
}
.module-tile:active { transform: scale(.99); }
.module-tile__icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; flex-shrink: 0;
  background:
    linear-gradient(145deg, hsla(var(--accent), .18), hsla(var(--accent), .08));
  color: hsl(var(--accent));
  box-shadow: 0 1px 0 hsla(0 0% 100% / .5) inset;
  transition: transform .35s var(--ease-out), box-shadow .3s ease;
}
.module-tile:hover .module-tile__icon {
  transform: scale(1.06);
  box-shadow: 0 6px 14px -8px hsla(var(--accent), .45);
}
.module-tile__icon svg { width: 22px; height: 22px; }
.module-tile__body h3 { font-size: 1rem; margin-bottom: .15rem; }
.module-tile__body p { font-size: .8rem; color: hsl(var(--text-muted)); }
.module-tile__arrow {
  margin-left: auto; font-size: 1.1rem; opacity: 0;
  transition: opacity .3s ease, transform .35s var(--ease-out); color: hsl(var(--accent));
}
.module-tile:hover .module-tile__arrow { opacity: 1; transform: translateX(5px); }

/* Dashboard split */
.dashboard-split {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem;
}
.panel {
  background:
    linear-gradient(168deg, hsl(var(--bg-surface)) 0%, color-mix(in srgb, hsl(var(--accent)) 3.5%, hsl(var(--bg-surface))) 100%);
  border: 1px solid hsl(var(--border-light));
  border-top: 2px solid color-mix(in srgb, hsl(var(--accent)) 22%, hsl(var(--border-light)));
  border-radius: var(--radius); padding: var(--section-gap); box-shadow: var(--shadow);
  transition: box-shadow .35s ease, border-color .3s ease, transform .35s var(--ease-out);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.panel::before {
  content: "";
  position: absolute; top: -12%; right: -8%; width: 52%; height: 62%;
  background: radial-gradient(circle at 70% 20%, hsla(var(--accent), .11), transparent 74%);
  pointer-events: none; opacity: .7;
  border-radius: inherit;
  filter: blur(10px);
  z-index: 0;
  animation: blobFloat 20s ease-in-out infinite;
}
.panel > * { position: relative; z-index: 1; }
.panel + .panel,
.panel + .module-grid {
  margin-top: var(--section-gap);
}
.panel__head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--space-sm); min-height: 1.75rem;
}
.panel__body { margin: 0; }
.panel__head h2 { font-size: 1rem; }
.link-subtle { font-size: .8rem; color: hsl(var(--text-muted)); }
.link-subtle:hover { color: hsl(var(--accent)); }

.activity-list { list-style: none; }
.activity-item {
  display: flex; flex-direction: column; gap: .15rem;
  padding: .6rem 0; border-bottom: 1px solid hsl(var(--border-light));
  color: hsl(var(--text)); transition: color var(--transition);
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover .activity-item__title { color: hsl(var(--accent)); }
.activity-item__title { font-weight: 500; font-size: .9rem; transition: color var(--transition); }
.activity-item__meta { font-size: .75rem; color: hsl(var(--text-muted)); }

.kpi-strip {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1rem;
}
.kpi-card {
  text-align: center; padding: 1rem; border-radius: var(--radius-sm);
  background: hsl(var(--bg-surface)); border: 1px solid hsl(var(--border-light));
}
.kpi-card__num {
  display: block; font-family: var(--font-head); font-size: 1.5rem;
  font-weight: 700; color: hsl(var(--accent));
}
.kpi-card__label { font-size: .72rem; color: hsl(var(--text-muted)); }

/* Forms */
.card {
  background: hsl(var(--bg-surface)); border: 1px solid hsl(var(--border-light));
  border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow);
}
.form-stack { display: flex; flex-direction: column; gap: .85rem; }
.form-stack label { font-size: .82rem; font-weight: 500; color: hsl(var(--text-secondary)); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-panel {
  display: flex; flex-direction: column; gap: .75rem;
  max-width: 36rem; padding: 1.25rem;
  background: hsl(var(--bg-surface)); border: 1px solid hsl(var(--border-light));
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.form-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .85rem 1rem;
}
.form-grid > .form-actions--span,
.form-grid > .form-check--span { grid-column: 1 / -1; }
.form-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: .65rem;
  margin-top: .15rem;
}
.form-check {
  display: flex; align-items: flex-start; gap: .5rem;
  font-size: .88rem; font-weight: 400; color: hsl(var(--text-secondary));
  cursor: pointer;
}
.form-check input { margin-top: .2rem; }
.form-inline-grid {
  display: grid; grid-template-columns: auto 1fr;
  gap: .65rem 1rem; align-items: center;
}
.form-inline-grid .form-actions { grid-column: 1 / -1; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.table-wrap { overflow-x: auto; margin: 0 -0.25rem; }
.data-table {
  width: 100%; border-collapse: collapse; font-size: .88rem;
}
.data-table th,
.data-table td {
  padding: .65rem .75rem; text-align: left;
  border-bottom: 1px solid hsl(var(--border-light));
  vertical-align: middle;
}
.data-table th {
  font-size: .72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: hsl(var(--text-muted));
}
.data-table tbody tr:last-child td { border-bottom: none; }
.actions-cell { white-space: nowrap; }
.actions-cell .btn { margin: .1rem 0; }

.flash {
  padding: .75rem 1rem; border-radius: var(--radius-sm);
  margin-bottom: 1rem; font-size: .9rem;
}
.flash--error {
  background: #fef2f2; color: #991b1b; border: 1px solid #fecaca;
}
.flash--warn {
  background: #fffbeb; color: #92400e; border: 1px solid #fde68a;
}
.flash--success {
  background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0;
}

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-inline-grid { grid-template-columns: 1fr; }
}

.input, .select, textarea.input {
  width: 100%; padding: .6rem .85rem; border-radius: var(--radius-sm);
  border: 1px solid hsl(var(--border)); background: hsl(var(--bg-surface));
  font-family: var(--font); font-size: .9rem; color: hsl(var(--text));
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: hsl(var(--accent));
  box-shadow: 0 0 0 3px hsla(var(--accent), .15);
}
.input-sm { padding: .45rem .65rem; font-size: .82rem; }
.input-mono { font-family: ui-monospace, monospace; font-size: .82rem; line-height: 1.5; }
.select { cursor: pointer; }
.select-sm { width: auto; min-width: 100px; }

button, input[type="submit"], input[type="button"] {
  font-family: var(--font);
  -webkit-appearance: none;
  appearance: none;
}

/* Unified button size system: same height across variants */
.btn, a.btn {
  --btn-h: 40px;
  --btn-px: 1.05rem;
  --btn-fs: .85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  box-sizing: border-box;
  min-height: var(--btn-h);
  height: var(--btn-h);
  padding: 0 var(--btn-px);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font);
  font-size: var(--btn-fs);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  text-decoration: none;
  vertical-align: middle;
}
.btn:hover, a.btn:hover { transform: none; }
a.btn:hover { text-decoration: none; }
.btn > .muted,
.btn .muted { font-size: inherit; line-height: inherit; opacity: .75; }
.btn-primary {
  background: hsl(var(--accent));
  color: #fff !important;
  border-color: hsl(var(--accent-hover));
  box-shadow: 0 2px 10px hsla(var(--accent), .35);
}
.btn-primary:hover {
  background: hsl(var(--accent-hover));
  color: #fff !important;
  box-shadow: 0 4px 14px hsla(var(--accent), .42);
}
.btn-primary:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn-ghost {
  background: hsl(var(--bg-surface));
  color: hsl(var(--text-secondary));
  border-color: hsl(var(--border));
  box-shadow: none;
}
.btn-ghost:hover {
  background: hsla(var(--accent), .08);
  color: hsl(var(--accent));
  border-color: hsla(var(--accent), .35);
}
/* Shared secondary/toolbar control — same radius, border, muted fill for adjacent pairs */
.btn-secondary {
  background: hsl(var(--bg-muted));
  color: hsl(var(--text-secondary));
  border-color: hsl(var(--border));
  box-shadow: none;
}
.btn-secondary:hover {
  background: hsla(var(--accent), .1);
  color: hsl(var(--accent));
  border-color: hsla(var(--accent), .3);
}
.btn-secondary:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.btn-secondary.active,
.btn-secondary.is-active,
.btn-secondary[aria-pressed="true"],
.btn-secondary[aria-expanded="true"] {
  background: color-mix(in srgb, hsl(var(--accent)) 14%, hsl(var(--bg-muted)));
  color: color-mix(in srgb, hsl(var(--accent)) 72%, hsl(var(--text)));
  border-color: color-mix(in srgb, hsl(var(--accent)) 32%, hsl(var(--border)));
}
.btn-danger {
  background: hsl(0, 72%, 96%);
  color: hsl(0, 65%, 38%) !important;
  border-color: hsla(0, 65%, 50%, .35);
  box-shadow: none;
}
.btn-danger:hover {
  background: hsl(0, 72%, 92%);
  color: hsl(0, 65%, 32%) !important;
  border-color: hsla(0, 65%, 50%, .55);
}
.btn-sm {
  --btn-h: 36px;
  --btn-px: .85rem;
  --btn-fs: .8rem;
}
.btn-xs {
  --btn-h: 32px;
  --btn-px: .65rem;
  --btn-fs: .75rem;
}
.btn-pill { border-radius: 999px; }
.btn-block { width: 100%; }
.btn-icon {
  display: inline-grid; place-items: center;
  width: var(--touch-min); height: var(--touch-min);
  min-height: var(--touch-min);
  border: 1px solid transparent; background: transparent; border-radius: var(--radius-sm);
  color: hsl(var(--text-muted)); cursor: pointer; transition: background var(--transition), color var(--transition);
  padding: 0;
}
.btn-icon:hover { background: hsla(var(--accent), .1); color: hsl(var(--accent)); }
.btn-icon svg { width: 16px; height: 16px; }
.btn-icon--danger { color: #dc2626; opacity: .7; }
.btn-icon--danger:hover { opacity: 1; background: rgba(220, 38, 38, .08); color: #b91c1c; }
.admin-action { flex-shrink: 0; }
.study-page__actions .btn {
  --btn-h: 36px;
  --btn-px: .85rem;
  --btn-fs: .8rem;
}

.toolbar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.inline-form { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }

/* Pills & badges */
.filter-pills {
  display: flex; gap: var(--space-xs); flex-wrap: wrap; align-items: center;
  margin-bottom: var(--section-gap);
}
.pill, button.pill {
  padding: .35rem .75rem; border-radius: 999px; font-size: .78rem; font-weight: 600;
  color: hsl(var(--text-secondary)); background: hsl(var(--bg-surface));
  border: 1px solid hsl(var(--border)); transition: all var(--transition);
  cursor: pointer; font-family: var(--font);
}
button.pill { -webkit-appearance: none; appearance: none; }
.pill:hover { border-color: hsla(var(--accent), .3); color: hsl(var(--accent)); }
.pill.active { background: hsl(var(--accent)); color: #fff; border-color: hsl(var(--accent)); }

.badge {
  display: inline-block; padding: .2rem .55rem; border-radius: 999px;
  font-size: .7rem; font-weight: 600; background: hsla(var(--accent), .1); color: hsl(var(--accent));
}
.badge--ok { background: hsl(158 30% 92%); color: hsl(158 40% 30%); }
.badge-priority-0 { background: hsl(210 20% 94%); color: hsl(210 15% 45%); }
.badge-priority-1 { background: hsla(var(--accent), .12); color: hsl(var(--accent)); }
.badge-priority-2 { background: hsl(0 70% 95%); color: hsl(0 60% 45%); }
.badge-priority-rm-0 { background: hsl(210 20% 94%); color: hsl(210 15% 45%); }
.badge-priority-rm-1 { background: hsl(45 80% 92%); color: hsl(35 60% 35%); }
.badge-priority-rm-2 { background: hsla(var(--accent), .12); color: hsl(var(--accent)); }
.badge-priority-rm-3 { background: hsl(0 70% 95%); color: hsl(0 60% 45%); }
.badge-status-idee { background: hsl(210 30% 94%); color: hsl(210 25% 40%); }
.badge-status-pruefung { background: hsl(45 80% 92%); color: hsl(35 60% 35%); }
.badge-status-geplant { background: hsla(var(--accent), .12); color: hsl(var(--accent)); }
.badge-status-laufend { background: hsl(200 60% 92%); color: hsl(200 50% 35%); }
.badge-status-abgeschlossen { background: hsl(158 30% 92%); color: hsl(158 40% 30%); }

/* Toast */
.toast {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem;
  font-size: .85rem; animation: slideDown .3s ease;
}
.toast-error { background: hsl(0 70% 96%); color: hsl(0 60% 40%); border: 1px solid hsl(0 50% 88%); }
.toast-success { background: hsla(var(--accent), .1); color: hsl(var(--accent)); border: 1px solid hsla(var(--accent), .2); }
.toast button { background: none; border: none; font-size: 1.2rem; cursor: pointer; opacity: .6; }

/* Empty state */
.empty-state {
  text-align: center; padding: 2.5rem 1.5rem; color: hsl(var(--text-muted));
}
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 1rem; opacity: .35; }
.empty-state.inline { padding: 1.5rem; list-style: none; }

/* Forum: JV-Expertenforum-Patterns */
.forum-hero {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1.25rem; flex-wrap: wrap; margin-bottom: 1.25rem;
  padding: clamp(1.25rem, 3vw, 2rem) clamp(1.1rem, 3vw, 1.75rem);
  border-radius: var(--radius);
  border: 1px solid hsla(var(--accent), .12);
  background:
    radial-gradient(ellipse 90% 70% at 100% 0%, hsla(var(--accent), .1), transparent 55%),
    linear-gradient(168deg, hsl(var(--bg-surface)) 0%, hsla(var(--accent), .04) 100%);
  box-shadow: var(--shadow);
}
.forum-hero h1 { font-size: clamp(1.5rem, 4vw, 2rem); margin-top: .15rem; }
.forum-hero__cta { flex-shrink: 0; }

.forum-toolbar { margin-bottom: 1rem; padding: 1rem 1.15rem; }
.forum-toolbar__row {
  display: flex; flex-wrap: wrap; gap: 1rem 1.5rem;
  align-items: flex-end; justify-content: space-between;
}
.forum-toolbar__block { display: flex; flex-direction: column; gap: .45rem; min-width: 0; }
.forum-toolbar__search { flex: 1 1 320px; max-width: none; min-width: min(100%, 480px); }
.forum-search-row { display: flex; gap: .5rem; align-items: stretch; width: 100%; }
.forum-search-row .input { flex: 1; min-width: 0; }
.forum-thread-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.forum-form-actions { margin-top: .25rem; }
.forum-toolbar__label {
  font-size: .68rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: hsl(var(--text-muted));
}
.forum-toolbar .pill { cursor: pointer; font-family: var(--font); }

.forum-category-tabs {
  display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.25rem;
}
.forum-pill-tab {
  padding: .4rem .85rem; border-radius: 999px; font-size: .8rem; font-weight: 500;
  color: hsl(var(--text-secondary)); background: hsl(var(--bg-surface));
  border: 1px solid hsl(var(--border)); transition: all var(--transition);
}
.forum-pill-tab:hover { border-color: hsla(var(--accent), .3); color: hsl(var(--accent)); }
.forum-pill-tab.active {
  background: hsl(var(--accent)); color: #fff; border-color: hsl(var(--accent));
}

.forum-thread-list-head {
  display: flex; flex-wrap: wrap; align-items: baseline;
  justify-content: space-between; gap: .5rem 1rem;
  margin-bottom: .85rem; padding: 0 .1rem;
}
.forum-thread-list-head__title {
  margin: 0; font-size: .78rem; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; color: hsl(var(--text-muted));
}
.forum-thread-list-head__meta { margin: 0; font-size: .82rem; color: hsl(var(--text-secondary)); }

.forum-topic-list { list-style: none; display: flex; flex-direction: column; gap: .85rem; }
.forum-topic-list__item { display: flex; align-items: stretch; gap: .5rem; }
.forum-topic-list__item .forum-topic-row { flex: 1; min-width: 0; }
.forum-topic-row {
  position: relative;
  isolation: isolate;
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 1.15rem 1.25rem; border-radius: var(--radius);
  background: linear-gradient(168deg, hsl(var(--bg-surface)) 0%, hsla(var(--bg-base), .92) 100%);
  /* Inset ring (not border-width) — stable hover, no layout/scrollbar flicker */
  border: 0;
  box-shadow: inset 0 0 0 1px hsl(var(--border-light)), var(--shadow);
  color: hsl(var(--text));
  /* No background swap on hover (gradients don't interpolate → flash) */
  transition: box-shadow .22s ease, color .22s ease;
  -webkit-tap-highlight-color: transparent;
}
/* Soft accent wash via opacity — smooth, no gradient snap */
.forum-topic-row::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(168deg, hsla(var(--accent), .08) 0%, transparent 72%);
  opacity: 0;
  transition: opacity .22s ease;
}
.forum-topic-row > * { position: relative; z-index: 1; }
/* Hover on list item so sibling delete button doesn't kill the highlight */
@media (hover: hover) and (pointer: fine) {
  .forum-topic-list__item:hover > .forum-topic-row::before,
  .forum-topic-list__item:focus-within > .forum-topic-row::before {
    opacity: 1;
  }
  .forum-topic-list__item:hover > .forum-topic-row,
  .forum-topic-list__item:focus-within > .forum-topic-row {
    /* Keep same shadow layers (incl. drop shadow) — only tint the ring */
    box-shadow:
      inset 0 0 0 1px hsla(var(--accent), .34),
      0 1px 0 hsla(0 0% 100% / .55) inset,
      var(--shadow);
  }
  .forum-topic-list__item:hover > .forum-topic-row .forum-topic-row__title,
  .forum-topic-list__item:focus-within > .forum-topic-row .forum-topic-row__title {
    color: hsl(var(--accent-hover));
  }
  .forum-topic-list__item:hover > .forum-topic-row .forum-topic-row__chevron,
  .forum-topic-list__item:focus-within > .forum-topic-row .forum-topic-row__chevron {
    color: hsl(var(--accent));
    opacity: 1;
    transform: translateX(2px);
  }
}
.forum-topic-row:focus-visible {
  outline: none;
  box-shadow:
    inset 0 0 0 1px hsla(var(--accent), .4),
    0 1px 0 hsla(0 0% 100% / .55) inset,
    var(--shadow);
}
.forum-topic-row:focus-visible::before { opacity: 1; }
.forum-topic-row__main { flex: 1; min-width: 0; }
.forum-topic-row__head {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .4rem;
}
.forum-topic-row__title {
  font-family: var(--font-head); font-size: 1.05rem; font-weight: 600;
  letter-spacing: -.02em; margin: 0; line-height: 1.35;
  transition: color .18s ease;
}
.forum-topic-preview {
  font-size: .85rem; color: hsl(var(--text-muted)); margin: 0 0 .45rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.forum-topic-row__meta {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  font-size: .78rem; color: hsl(var(--text-muted));
}
.forum-topic-row__aside {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: .35rem; flex-shrink: 0; text-align: right;
}
.forum-topic-row__time { font-size: .72rem; color: hsl(var(--text-muted)); }
.forum-topic-row__chevron {
  color: hsl(var(--text-muted)); opacity: .6;
  transition: color .18s ease, opacity .18s ease, transform .18s ease;
}

.forum-category-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .7rem; font-weight: 600; letter-spacing: .02em;
  color: hsl(var(--accent)); background: hsla(var(--accent), .1);
  padding: .22rem .55rem; border-radius: 999px;
  border: 1px solid hsla(var(--accent), .2); line-height: 1.2;
}
.forum-pin-badge {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .68rem; font-weight: 600; color: hsl(var(--accent));
}
.forum-stat {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .78rem; font-weight: 600; color: hsl(var(--text-secondary));
  line-height: 1;
}
.forum-stat svg { flex-shrink: 0; }
.forum-stat__count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.2rem; height: 1.2rem; padding: 0 .3rem;
  border-radius: 999px;
  font-size: .68rem; font-weight: 700; letter-spacing: .01em;
  color: hsl(var(--text-secondary));
  background: hsl(var(--bg-muted));
  border: 1px solid hsl(var(--border-light));
}

.forum-avatar {
  flex-shrink: 0; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-head); font-weight: 600; color: hsl(var(--accent));
  background: hsla(var(--accent), .12); border: 2px solid hsla(var(--accent), .28);
  width: 40px; height: 40px; font-size: .75rem;
}
.forum-avatar--lg { width: 52px; height: 52px; font-size: .82rem; }

.forum-topic-header { margin-bottom: 1.5rem; }
.forum-topic-header__tags {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem;
}
.forum-topic-title {
  font-family: var(--font-head); font-size: clamp(1.5rem, 4vw, 2.1rem);
  font-weight: 700; letter-spacing: -.03em; line-height: 1.15; margin: 0;
}
.forum-topic-header__meta { margin-top: .5rem; font-size: .85rem; color: hsl(var(--text-muted)); }

.forum-post-card, .forum-reply-card {
  padding: clamp(1rem, 2.5vw, 1.35rem); border-radius: var(--radius);
  border: 1px solid hsl(var(--border-light)); box-shadow: var(--shadow);
  margin-bottom: 1rem; width: 100%; max-width: none;
}
.forum-reply-box { width: 100%; max-width: none; }
.forum-reply-box .input { width: 100%; }
.forum-post-card--op {
  background: linear-gradient(145deg, hsl(var(--bg-surface)) 0%, hsla(var(--accent), .04) 100%);
  border-color: hsla(var(--accent), .15);
}
.forum-reply-card {
  background: linear-gradient(145deg, hsl(var(--bg-surface)) 0%, hsla(var(--bg-base), .5) 100%);
  margin-left: 0;
  width: 100%;
}
.forum-post-card__head {
  display: flex; align-items: center; gap: .75rem; margin-bottom: .85rem; flex-wrap: wrap;
}
.forum-post-card__author { flex: 1; min-width: 0; }
.forum-post-card__name { display: block; font-weight: 600; font-size: .95rem; }
.forum-post-card__author time { font-size: .78rem; color: hsl(var(--text-muted)); }
.forum-post-card__body { font-size: .92rem; line-height: 1.65; }
.prose--forum { white-space: normal; }
.prose--forum img, .prose img {
  max-width: 100%; height: auto; border-radius: var(--radius-sm);
  margin: .75rem 0; border: 1px solid hsl(var(--border-light));
}
.forum-op-badge {
  font-size: .68rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: hsl(var(--accent));
  background: hsla(var(--accent), .1); padding: .2rem .5rem; border-radius: 999px;
}

.forum-reply-box { margin-top: .5rem; }
.forum-reply-box__head {
  display: flex; align-items: center; gap: .65rem; margin-bottom: .65rem;
}
.forum-reply-box__head label { font-size: .9rem; font-weight: 600; margin: 0; }
.forum-reply-box__actions { margin-top: .75rem; }

.forum-new-form { max-width: none; width: 100%; }
.form-wide { width: 100%; max-width: none; }
.input-tall { min-height: 8rem; }

/* Wiki */
.wiki-layout { display: grid; grid-template-columns: 240px 1fr; gap: 1.25rem; min-height: 60vh; }
.wiki-sidebar {
  background: hsl(var(--bg-surface)); border: 1px solid hsl(var(--border-light));
  border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow);
  position: sticky; top: calc(var(--header-h) + 1rem); align-self: start;
  max-height: calc(100vh - var(--header-h) - 2rem); overflow-y: auto;
}
.wiki-sidebar__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .75rem; }
.wiki-sidebar__head h2 { font-size: .9rem; }
.wiki-nav { list-style: none; }
.wiki-nav a {
  display: block; padding: .45rem .6rem; border-radius: var(--radius-sm);
  font-size: .85rem; color: hsl(var(--text-secondary)); transition: all var(--transition);
}
.wiki-nav a:hover, .wiki-nav a.active {
  background: hsla(var(--accent), .1); color: hsl(var(--accent)); font-weight: 500;
}
.wiki-main { min-width: 0; }
.wiki-content__head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap;
}
.wiki-content__head h1 { font-size: 1.5rem; }

.wiki-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.wiki-editor__form textarea.input { min-height: 22rem; resize: vertical; }
.wiki-editor__preview-head {
  font-size: .78rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: hsl(var(--text-muted)); margin-bottom: 1rem;
  padding-bottom: .5rem; border-bottom: 1px solid hsl(var(--border-light));
}

.prose { line-height: 1.7; font-size: .92rem; }
.prose h1, .prose h2, .prose h3 { margin: 1.25rem 0 .5rem; }
.prose p { margin-bottom: .75rem; }
.prose ul, .prose ol { margin: .5rem 0 .75rem 1.25rem; }
.prose code { background: hsl(var(--border-light)); padding: .15rem .4rem; border-radius: 4px; font-size: .85em; }
.prose pre { background: hsl(220 20% 96%); padding: 1rem; border-radius: var(--radius-sm); overflow-x: auto; margin: .75rem 0; }
.prose pre code { background: none; padding: 0; }

.editor-toolbar {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  margin-bottom: .5rem; width: 100%;
}
.editor-toolbar__hint { font-size: .78rem; }

.wiki-folder-tree { list-style: none; margin: 0; padding: 0; }
.wiki-folder-tree--nested { margin-left: .65rem; padding-left: .5rem; border-left: 1px solid hsl(var(--border-light)); }
.wiki-folder-tree__item { margin-bottom: .25rem; }
.wiki-folder-tree__link {
  display: flex; align-items: center; gap: .35rem;
  padding: .35rem .5rem; border-radius: var(--radius-sm);
  font-size: .82rem; color: hsl(var(--text-secondary));
}
.wiki-folder-tree__link:hover, .wiki-folder-tree__link.active {
  background: hsla(var(--accent), .1); color: hsl(var(--accent)); font-weight: 500;
}
.wiki-folder-tree__label { display: block; font-size: .72rem; padding: .25rem .5rem; }
.wiki-nav--nested { margin: .15rem 0 .35rem .5rem; }
.wiki-new-folder {
  display: flex; gap: .35rem; margin-bottom: .65rem; align-items: center;
}
.wiki-new-folder .input-xs { flex: 1; min-width: 0; font-size: .78rem; padding: .3rem .45rem; }
.wiki-sidebar__footer { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid hsl(var(--border-light)); }
.btn-block { display: block; width: 100%; text-align: center; }
.wiki-page-list { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.wiki-page-list__item {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .85rem 1rem; border-radius: var(--radius-sm);
  background: hsl(var(--bg-surface)); border: 1px solid hsl(var(--border-light));
  color: hsl(var(--text)); transition: all var(--transition);
}
.wiki-page-list__item:hover { border-color: hsla(var(--accent), .25); box-shadow: var(--shadow); }
.wiki-page-list__title { font-weight: 600; }

.media-layout { display: flex; flex-direction: column; gap: var(--section-gap); }
.media-layout__body { display: grid; grid-template-columns: 260px 1fr; gap: var(--section-gap); }
.media-tabs {
  display: flex; gap: .65rem; flex-wrap: wrap;
  padding: .35rem; border-radius: var(--radius);
  background: hsl(var(--bg-surface)); border: 1px solid hsl(var(--border-light));
  box-shadow: var(--shadow);
}
.media-tabs__btn {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .75rem 1.25rem; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent;
  font-size: .95rem; font-weight: 600; cursor: pointer;
  color: hsl(var(--text-secondary)); transition: all var(--transition);
}
.media-tabs__btn:hover { background: hsla(var(--accent), .06); color: hsl(var(--accent)); }
.media-tabs__btn.active {
  background: hsl(var(--accent)); color: #fff;
  border-color: hsl(var(--accent)); box-shadow: var(--shadow);
}
.media-tabs__icon { font-size: 1.15rem; line-height: 1; }
.media-main { padding: 1.5rem; }
.media-main--full { grid-column: 1 / -1; }
.media-section-head {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem;
}
.media-dropzone {
  border: 2px dashed hsl(var(--border)); border-radius: var(--radius); padding: 1.25rem;
  margin-bottom: 1.25rem; text-align: center; transition: border-color .15s, background .15s;
}
.media-dropzone--active { border-color: hsl(var(--accent)); background: hsla(var(--accent), .04); }
.media-dropzone--busy { opacity: .7; pointer-events: none; }
.media-dropzone__title { font-weight: 600; margin-bottom: .25rem; }
.media-dropzone__hint { font-size: .8rem; margin-bottom: .75rem; }
.media-upload-zone { display: flex; align-items: center; justify-content: center; gap: .75rem; flex-wrap: wrap; }
.media-file-grid { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem; }
.media-file-card {
  border: 1px solid hsl(var(--border-light)); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  background: hsl(var(--bg-surface)); box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.media-file-card:hover { box-shadow: var(--shadow-lg); border-color: hsla(var(--accent), .28); }
.media-file-card__preview { background: var(--bg-muted, #f3f4f6); min-height: 140px; display: flex; align-items: center; justify-content: center; }
.media-file-card__body { padding: .65rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.media-file-card__title { font-size: .8rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: .35rem; }
.media-file-card__meta { font-size: .7rem; }
.media-file-card__actions { display: flex; flex-wrap: wrap; gap: .2rem; margin-top: auto; }
.media-file-card--master {
  border-color: var(--study-color, #2F6F5E);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--study-color, #2F6F5E) 30%, transparent);
}
.master-file-badge {
  display: inline-block;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--study-color, #2F6F5E);
  border: 1px solid color-mix(in srgb, var(--study-color, #2F6F5E) 45%, transparent);
  border-radius: .25rem;
  padding: .05rem .3rem;
  flex-shrink: 0;
}
.master-file-banner {
  margin: 0 0 1.25rem;
  padding: .85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid hsl(var(--border-light));
  background: hsla(var(--bg-base), .55);
  font-size: .9rem;
}
.master-file-banner--ok {
  border-color: color-mix(in srgb, var(--study-color, #2F6F5E) 40%, transparent);
  background: color-mix(in srgb, var(--study-color, #2F6F5E) 10%, transparent);
}
.master-file-banner p { margin: 0; }
.media-file-icon { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: 1.5rem; text-decoration: none; color: inherit; font-size: 2rem; }
.media-file-icon__ext { font-size: .7rem; font-weight: 600; color: hsl(var(--text-muted)); }
.media-grid { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.media-grid__item { display: flex; flex-direction: column; gap: .35rem; }
.media-grid__meta { font-size: .75rem; }
.media-thumb {
  width: 100%; max-width: 120px; height: auto; aspect-ratio: 1;
  object-fit: cover; border-radius: var(--radius-sm); border: 1px solid hsl(var(--border-light));
}
.media-thumb--lg { max-width: 100%; max-height: 160px; width: auto; }
.media-markdown-snippet {
  display: block; font-size: .65rem; word-break: break-all;
  background: hsl(var(--border-light)); padding: .2rem .35rem; border-radius: 4px; margin-top: .25rem;
}
.media-section-title { font-size: .9rem; margin-bottom: .75rem; }
.media-thumb-list { list-style: none; margin: .35rem 0 0 .5rem; display: flex; flex-direction: column; gap: .5rem; }
.wiki-folder-tree__btn { background: none; border: none; cursor: pointer; text-align: left; width: 100%; padding: .2rem 0; font: inherit; color: inherit; }
.wiki-folder-tree__btn.active { color: hsl(var(--accent)); font-weight: 600; }
.media-snippet-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.media-snippet-card {
  border: 1px solid hsl(var(--border-light)); border-radius: var(--radius);
  padding: 1rem; background: hsl(var(--bg-surface)); box-shadow: var(--shadow);
}
.media-snippet-card__head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: .65rem; }
.media-snippet-card__head h3 { font-size: 1rem; margin: 0; }
.media-snippet-card__body { font-size: .85rem; white-space: pre-wrap; background: hsl(var(--bg-muted)); padding: .85rem; border-radius: var(--radius-sm); margin-bottom: .65rem; max-height: 240px; overflow: auto; }
.media-snippet-editor { font-family: ui-monospace, monospace; resize: vertical; min-height: 280px; }
.media-snippet-toolbar { margin-bottom: 1rem; }
.gen-progress { margin-top: .65rem; display: flex; flex-direction: column; gap: .35rem; }
.gen-progress__meta {
  display: flex; justify-content: space-between; gap: .75rem;
  font-size: .8rem; color: hsl(var(--text-muted));
}
.gen-progress__error { color: hsl(var(--danger, 0 70% 45%)); font-size: .8rem; }
.wiki-versions {
  margin-top: 2rem; padding-top: 1.25rem;
  border-top: 1px solid hsl(var(--border-light));
}
.wiki-versions__title { margin: 0 0 .35rem; font-size: 1.05rem; }
.wiki-versions__hint { margin: 0 0 .85rem; font-size: .8rem; }
.wiki-versions__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .65rem; }
.wiki-versions__item {
  padding: .75rem .9rem; border-radius: var(--radius-sm);
  border: 1px solid hsl(var(--border-light));
  background: hsla(var(--bg-base), .45);
}
.wiki-versions__item--current { border-color: hsla(var(--accent), .45); }
.wiki-versions__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .85rem; }
.wiki-versions__badge {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: hsl(var(--accent));
}
.wiki-versions__annotation { margin: .35rem 0 .5rem; font-size: .9rem; }
.study-export-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.25rem; }
.study-export-card {
  border: 1px solid hsl(var(--border-light)); border-radius: var(--radius);
  padding: 1.35rem; display: flex; flex-direction: column; gap: .75rem;
  background: linear-gradient(168deg, hsl(var(--bg-surface)) 0%, hsla(var(--bg-base), .92) 100%);
  box-shadow: var(--shadow);
}
.study-export-card--featured { min-height: 280px; }
.study-export-card__header { display: flex; gap: 1rem; align-items: flex-start; }
.study-export-card__header h3 { margin: 0 0 .25rem; font-size: 1.1rem; }
.study-export-card__icon { font-size: 2.25rem; line-height: 1; flex-shrink: 0; }
.study-export-card__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; margin-top: auto; }
.study-export-card__size { font-size: .75rem; }
.study-export-card__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; font-size: .85rem; margin: .35rem 0; padding: .75rem; border-radius: var(--radius-sm); background: hsla(var(--bg-base), .5); }
.study-export-card__stats dt { color: hsl(var(--text-muted)); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.study-export-card__stats dd { font-weight: 700; margin: .15rem 0 0; font-size: 1.05rem; }
.study-export-card__studies { list-style: none; font-size: .8rem; margin-top: .35rem; }
.media-sync-list { list-style: none; display: flex; flex-direction: column; gap: .65rem; margin-top: 1rem; }
.media-sync-card {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.15rem; border-radius: var(--radius-sm);
  border: 1px solid hsl(var(--border-light)); background: hsl(var(--bg-surface));
}
.media-sync-card__info { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.media-sync-card__info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-sync-hint { font-size: .75rem; margin-top: .75rem; }
.assignee-readonly { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.assignee-readonly__hint { font-size: .75rem; width: 100%; }
.modal--wide { max-width: 640px; width: 100%; }
.text-danger { color: #dc2626; }
/* btn-xs size defined in unified button system above */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 300;
  background: hsla(220, 30%, 15%, .45); display: grid; place-items: center; padding: 1rem;
}
/* Author `display` must not defeat the hidden attribute (UA [hidden] loses to .modal-backdrop). */
.modal-backdrop[hidden],
.dm-compose-backdrop[hidden],
.dm-thread[hidden],
.dm-empty[hidden],
.dm-sidebar__empty[hidden],
.dm-conv-list[hidden],
.dm-status[hidden],
.dm-picker-empty[hidden],
.header-bell__panel[hidden],
.header-user-menu__panel[hidden] {
  display: none !important;
}
.modal { width: min(100%, 420px); padding: 1.25rem; display: flex; flex-direction: column; gap: .75rem; }
[x-cloak] { display: none !important; }

/* Todos */
.todo-panel { background: hsl(var(--bg-surface)); border: 1px solid hsl(var(--border-light)); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.todo-quick-add { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.todo-quick-add .input { flex: 1; min-width: 200px; }
.todo-list { list-style: none; display: flex; flex-direction: column; gap: .35rem; }
.todo-item {
  display: flex; flex-direction: column; align-items: stretch; gap: 0;
  padding: .65rem .85rem; border-radius: var(--radius-sm);
  background: hsl(var(--bg-base)); border: 1px solid transparent;
  transition: all var(--transition);
}
.todo-item:hover { border-color: hsl(var(--border)); background: hsl(var(--bg-surface)); }
.todo-item--done .todo-text { text-decoration: line-through; color: hsl(var(--text-muted)); }
.todo-check {
  width: 22px; height: 22px; border-radius: 6px; border: 2px solid hsl(var(--border));
  background: hsl(var(--bg-surface)); cursor: pointer; display: grid; place-items: center;
  flex-shrink: 0; transition: all var(--transition); color: transparent;
}
.todo-item--done .todo-check {
  background: hsl(var(--accent)); border-color: hsl(var(--accent)); color: #fff;
}
.todo-check svg { width: 14px; height: 14px; }
.todo-text { flex: 1; font-size: .9rem; }
.todo-item__row { display: flex; align-items: center; gap: .75rem; width: 100%; }
.todo-item__main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  background: none; border: none; padding: 0; text-align: left; cursor: pointer; font: inherit; color: inherit;
}
.todo-item__meta { display: flex; align-items: center; gap: .4rem; flex-shrink: 0; flex-wrap: wrap; }
.todo-item__detail {
  margin: .5rem 0 0 2.5rem; padding: .75rem; border-radius: var(--radius-sm);
  background: hsl(var(--bg-base)); border: 1px solid hsl(var(--border-light));
}
.todo-item--expanded { border-color: hsla(var(--accent), .25); background: hsl(var(--bg-surface)); }
.select-xs { font-size: .72rem; padding: .2rem .35rem; max-width: 7rem; }
.assignee-select { min-width: 5.5rem; }
.icon-rotated { transform: rotate(180deg); }
.btn-icon--sm { width: 26px; height: 26px; }

.progress-mini { display: flex; align-items: center; gap: .35rem; min-width: 4.5rem; }
.progress-mini--card { margin: .35rem 0; }
.progress-mini--lg { margin-bottom: .75rem; }
.progress-mini__bar {
  flex: 1; height: 5px; border-radius: 999px; background: hsl(var(--border-light)); overflow: hidden; min-width: 2.5rem;
}
.progress-mini__fill {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, hsl(var(--accent)) 88%, #1a3d34),
    hsl(var(--accent)),
    color-mix(in srgb, hsl(var(--accent)) 70%, #8ecbb8)
  );
  box-shadow: 0 0 8px hsla(var(--accent), .25);
  transform-origin: left center;
  transition: width .45s var(--ease-out);
}
.progress-mini__label { font-size: .68rem; font-weight: 600; color: hsl(var(--text-muted)); white-space: nowrap; }
.progress-badge {
  font-size: .68rem; font-weight: 600; padding: .1rem .35rem; border-radius: 4px;
  background: hsl(var(--border-light)); color: hsl(var(--text-muted));
}
.progress-badge--empty { min-width: 1.2rem; text-align: center; }

.subtask-list { list-style: none; display: flex; flex-direction: column; gap: .25rem; margin-bottom: .5rem; }
.subtask-item {
  display: flex; align-items: center; gap: .5rem; padding: .35rem .5rem; border-radius: var(--radius-sm);
  background: hsl(var(--bg-surface));
}
.subtask-item--done .subtask-title { text-decoration: line-through; color: hsl(var(--text-muted)); }
.subtask-check {
  width: 18px; height: 18px; border-radius: 4px; border: 2px solid hsl(var(--border));
  background: hsl(var(--bg-base)); cursor: pointer; display: grid; place-items: center;
  flex-shrink: 0; color: transparent; transition: all var(--transition);
}
.subtask-item--done .subtask-check {
  background: hsl(var(--accent)); border-color: hsl(var(--accent)); color: #fff;
}
.subtask-check svg { width: 11px; height: 11px; }
.subtask-title { flex: 1; font-size: .82rem; }
.subtask-add { display: flex; gap: .35rem; }

.wiki-author-meta {
  display: inline-flex; align-items: center; gap: .4rem;
}
.assignee-avatar {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: color-mix(in srgb, var(--profile-color, hsl(var(--accent))) 18%, transparent);
  color: var(--profile-color, hsl(var(--accent))); font-size: .68rem; font-weight: 700;
  flex-shrink: 0; overflow: hidden;
}
.assignee-avatar--sm { width: 22px; height: 22px; font-size: .6rem; }
.assignee-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.profile-avatar {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: color-mix(in srgb, var(--profile-color, #9CA3AF) 18%, transparent);
  color: var(--profile-color, #9CA3AF); font-size: .68rem; font-weight: 700;
  flex-shrink: 0; overflow: hidden;
}
.profile-avatar--xs { width: 20px; height: 20px; font-size: .55rem; }
.profile-avatar--sm { width: 22px; height: 22px; font-size: .6rem; }
.profile-avatar--lg { width: 72px; height: 72px; font-size: 1.25rem; }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-avatar--img { background: hsl(var(--bg-surface)); padding: 0; }
.profile-avatar--img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.user-pill--profile {
  display: inline-flex; align-items: center; gap: .4rem;
  text-decoration: none; color: inherit;
}
.user-pill--profile:hover { background: hsla(var(--accent), .16); }

.profile-settings__layout {
  display: grid;
  grid-template-columns: minmax(10rem, 14rem) minmax(0, 1fr);
  gap: 1.75rem 2rem;
  align-items: start;
}
.profile-settings__preview {
  display: flex; flex-direction: column; align-items: center;
  gap: .4rem; text-align: center;
}
.profile-settings__avatar-wrap { position: relative; }
.profile-settings__avatar-btn {
  appearance: none; border: 0; background: transparent; padding: 0;
  cursor: pointer; position: relative; border-radius: 999px;
}
.profile-settings__avatar-btn:disabled { cursor: default; }
.profile-settings__avatar-btn:not(:disabled):hover .profile-avatar,
.profile-settings__avatar-btn:not(:disabled):focus-visible .profile-avatar {
  box-shadow: 0 0 0 3px hsl(var(--bg)), 0 0 0 5px hsl(var(--accent));
}
.profile-settings__name { font-size: 1.05rem; font-weight: 600; margin: 0; }
.profile-settings__bio { margin: 0; max-width: 14rem; }
.profile-settings__photo-actions {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem;
  margin-top: .25rem;
}
.profile-settings__photo-hint { margin: .15rem 0 0; font-size: .75rem; }
.profile-settings__form { min-width: 0; }
.profile-settings__field-hint { margin: .35rem 0 0; font-size: .75rem; line-height: 1.35; }
.profile-username-field {
  display: flex;
  align-items: center;
  gap: .15rem;
}
.profile-username-field__at {
  color: var(--muted, #6b7280);
  font-weight: 600;
  padding-left: .15rem;
  user-select: none;
}
.profile-username-field .input { flex: 1; min-width: 0; }
.profile-settings__notify {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid hsl(var(--border));
}
.profile-settings__notify-title {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 600;
}
.profile-settings__notify-cats {
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.profile-color-field { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.input--color { width: 3rem; height: 2.5rem; padding: .15rem; cursor: pointer; }
.input--color-text { width: 7rem; font-family: ui-monospace, monospace; }
.study-color-picker { margin: .35rem 0 1rem; }
.study-color-picker__hint { margin: .2rem 0 .65rem; font-size: .82rem; }
.study-color-swatches {
  display: flex; flex-wrap: wrap; gap: .4rem;
  margin-top: .65rem;
}
.study-color-swatch {
  width: 1.55rem; height: 1.55rem; border-radius: 999px;
  border: 2px solid transparent;
  background: var(--swatch, #2F6F5E);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--swatch, #2F6F5E) 35%, transparent);
  cursor: pointer; padding: 0;
  transition: transform .15s var(--ease-out), border-color .15s ease, box-shadow .15s ease;
}
.study-color-swatch:hover { transform: scale(1.08); }
.study-color-swatch.is-active {
  border-color: hsl(var(--text));
  box-shadow: 0 0 0 2px hsl(var(--bg-surface)), 0 0 0 4px var(--swatch, #2F6F5E);
}

@media (max-width: 720px) {
  .profile-settings__layout { grid-template-columns: 1fr; justify-items: center; }
  .profile-settings__form { width: 100%; }
}

/* Study members */
.members-count {
  font-size: .85rem; font-weight: 600; color: hsl(var(--text-muted));
  padding: .35rem .7rem; border-radius: 999px;
  background: hsl(var(--bg-muted, 220 14% 96%));
  border: 1px solid hsl(var(--border-light));
}
.members-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(16rem, 0.85fr);
  gap: 1.25rem;
  align-items: start;
}
.members-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: .15rem;
}
.members-list__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(12rem, 16rem) auto;
  gap: .75rem 1rem;
  align-items: center;
  padding: .75rem 0;
  border-bottom: 1px solid hsl(var(--border-light));
}
.members-list__item:last-child { border-bottom: none; }
.members-list__identity {
  display: flex; align-items: center; gap: .65rem; min-width: 0;
}
.members-list__meta {
  display: flex; flex-direction: column; gap: .1rem; min-width: 0;
}
.members-list__meta strong {
  font-size: .92rem; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.members-list__meta .muted {
  font-size: .78rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.members-list__edit {
  display: flex; align-items: center; gap: .35rem; min-width: 0;
}
.members-list__edit .input { flex: 1; min-width: 0; }
.members-list__empty { margin: 0; padding: .25rem 0; }
.members-sidebar { display: flex; flex-direction: column; gap: 1rem; }
.members-sidebar__hint { margin: 0 0 .85rem; font-size: .85rem; }

.invite-link-panel {
  margin-bottom: var(--section-gap);
  border-color: hsla(var(--accent), .35);
  background: linear-gradient(180deg, hsla(var(--accent), .06), hsl(var(--bg-surface)));
}
.invite-link-panel__hint { margin: 0 0 .75rem; }
.invite-link-panel__row {
  display: flex; gap: .5rem; flex-wrap: wrap; align-items: center;
}
.invite-link-panel__row .input { flex: 1; min-width: 14rem; }

/* Admin users */
.admin-hub-callout { margin-bottom: var(--section-gap); }
.admin-hub-callout__text { margin: 0 0 .85rem; max-width: 42rem; }
.admin-users { display: flex; flex-direction: column; gap: var(--section-gap); }
.admin-users__stack { display: flex; flex-direction: column; gap: var(--section-gap); }
.admin-tabs__link {
  text-decoration: none; display: inline-flex; align-items: center;
  color: hsl(var(--text-secondary));
}
.admin-tabs__link:hover { color: hsl(var(--accent)); }
.admin-rights-hint {
  padding: .85rem 1.1rem; margin-bottom: var(--section-gap);
  background: hsla(var(--accent), .05);
  border-color: hsla(var(--accent), .2);
}
.admin-rights-hint__pill {
  display: inline-block; margin: 0 .15rem;
  padding: .1rem .4rem; border-radius: 999px;
  background: hsl(var(--bg-surface)); border: 1px solid hsl(var(--border-light));
  font-size: .78rem; font-weight: 600; color: hsl(var(--text));
}

.membership-matrix-panel { padding: 1rem 1.1rem 1.15rem; }
.membership-matrix__toolbar {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  margin-bottom: .85rem;
}
.membership-matrix__search { max-width: 16rem; }
.membership-matrix__status { margin: 0; font-size: .8rem; min-height: 1.2em; }
.membership-matrix-wrap { overflow: auto; max-height: min(70vh, 720px); border: 1px solid hsl(var(--border-light)); border-radius: var(--radius-sm); }
.membership-matrix {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: .85rem; min-width: 640px;
}
.membership-matrix th,
.membership-matrix td {
  padding: .55rem .65rem; border-bottom: 1px solid hsl(var(--border-light));
  vertical-align: middle;
}
.membership-matrix thead th {
  position: sticky; top: 0; z-index: 2;
  background: hsl(var(--bg-surface)); font-size: .72rem;
  text-align: center; font-weight: 700;
}
.membership-matrix__user-col {
  position: sticky; left: 0; z-index: 1;
  background: hsl(var(--bg-surface)); text-align: left !important;
  min-width: 12rem; border-right: 1px solid hsl(var(--border-light));
}
.membership-matrix thead .membership-matrix__user-col { z-index: 3; }
.membership-matrix__study-col { min-width: 6.5rem; max-width: 8.5rem; }
.membership-matrix__study-link {
  display: flex; flex-direction: column; align-items: center; gap: .25rem;
  color: inherit; text-decoration: none;
}
.membership-matrix__study-link:hover { color: hsl(var(--accent)); }
.membership-matrix__study-title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.25; max-width: 7.5rem;
}
.membership-matrix__study-count {
  font-size: .68rem; font-weight: 700; color: hsl(var(--text-muted));
  min-width: 1.2rem; height: 1.2rem; padding: 0 .3rem;
  display: inline-grid; place-items: center; border-radius: 999px;
  background: hsl(var(--bg-muted));
}
.membership-matrix__user {
  display: flex; align-items: center; gap: .5rem; min-width: 0;
}
.membership-matrix__user-meta {
  display: flex; flex-direction: column; gap: .05rem; min-width: 0;
}
.membership-matrix__user-meta strong {
  font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.membership-matrix__user-meta .muted { font-size: .72rem; }
.membership-matrix__cell { text-align: center; }
.membership-check {
  display: inline-grid; place-items: center; width: 2rem; height: 2rem;
  border-radius: 8px; cursor: pointer;
}
.membership-check:hover { background: hsla(var(--accent), .08); }
.membership-check input {
  width: 1.05rem; height: 1.05rem; accent-color: hsl(var(--accent)); cursor: pointer;
}

.members-add-list {
  list-style: none; margin: 0 0 .75rem; padding: 0;
  display: flex; flex-direction: column; gap: .25rem;
  max-height: 16rem; overflow: auto;
}
.members-add-list__item { margin: 0; }
.members-add-list__label {
  display: flex; align-items: center; gap: .55rem;
  padding: .45rem .5rem; border-radius: var(--radius-sm);
  cursor: pointer; border: 1px solid transparent;
}
.members-add-list__label:hover { background: hsl(var(--bg-muted)); }
.members-add-list__label span {
  display: flex; flex-direction: column; gap: .05rem; min-width: 0;
}
.members-add-list__label strong { font-size: .88rem; }
.members-add-list__label .muted { font-size: .72rem; }

.study-hub__team-link {
  display: block; color: inherit; text-decoration: none; text-align: right;
}
.study-hub__team-link:hover .muted { color: hsl(var(--accent)); }
.admin-tabs {
  display: flex; gap: .35rem; flex-wrap: wrap;
  padding: .25rem; width: fit-content;
  background: hsl(var(--bg-muted, 220 14% 96%));
  border-radius: var(--radius-sm);
  border: 1px solid hsl(var(--border-light));
}
.admin-tabs__btn {
  appearance: none; border: 0; background: transparent;
  padding: .45rem .9rem; border-radius: calc(var(--radius-sm) - 2px);
  font-family: var(--font); font-size: .85rem; font-weight: 600;
  color: hsl(var(--text-secondary)); cursor: pointer;
}
.admin-tabs__btn.is-active {
  background: hsl(var(--bg-surface)); color: hsl(var(--text));
  box-shadow: var(--shadow);
}
.admin-feedback { margin: .75rem 0 0; }
.admin-password-row td {
  background: hsl(var(--bg-muted, 220 14% 96%));
  padding: .85rem 1rem !important;
}
.admin-password-form__row {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  margin-top: .35rem;
}
.admin-password-form__row .input { max-width: 18rem; }

@media (max-width: 960px) {
  .members-layout { grid-template-columns: 1fr; }
  .members-list__item {
    grid-template-columns: 1fr;
    gap: .5rem;
  }
  .members-list__remove { justify-self: start; }
}

[x-cloak] { display: none !important; }

/* Kanban */
#kanban-root {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
}
.kanban-wrap {
  position: relative;
  display: flex; flex-direction: column; gap: var(--space-xl);
}
.kanban-page__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .75rem;
  justify-content: flex-end;
}
.kanban-columns-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.kanban-page__actions .btn-secondary.is-active,
.kanban-page__actions .btn-secondary[aria-expanded="true"] {
  background: color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 14%, hsl(var(--bg-muted)));
  color: color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 72%, hsl(var(--text)));
  border-color: color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 32%, hsl(var(--border)));
}
.kanban-columns-panel {
  background: color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 5%, hsl(var(--bg-surface)));
  border: 1px solid color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 16%, hsl(var(--border-light)));
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.1rem;
  margin-bottom: .15rem;
}
.kanban-columns-panel__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: .85rem;
}
.kanban-columns-panel__head h2 {
  margin: 0 0 .2rem;
  font-size: 1rem;
  font-weight: 700;
  color: hsl(var(--text-primary));
}
.kanban-columns-panel__head .muted {
  margin: 0;
  font-size: .82rem;
  max-width: 36rem;
}
.kanban-columns-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.kanban-columns-list__item {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .4rem .5rem;
  background: hsl(var(--bg-base));
  border: 1px solid hsl(var(--border-light));
  border-radius: var(--radius-sm);
}
.kanban-columns-list__grip {
  color: hsl(var(--text-muted));
  font-size: .7rem;
  letter-spacing: -.08em;
  user-select: none;
  opacity: .55;
}
.kanban-columns-list__name {
  flex: 1 1 auto;
  min-width: 0;
}
.kanban-columns-list__role {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .15rem .4rem;
  border-radius: 999px;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 14%, transparent);
  color: color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 75%, hsl(var(--text-primary)));
}
.kanban-columns-list__role--done {
  background: hsla(158, 40%, 36%, .12);
  color: hsl(158 38% 28%);
}
.kanban-columns-list__count {
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
  min-width: 1.5rem;
  text-align: right;
}
.kanban-columns-list__actions {
  display: flex;
  align-items: center;
  gap: .1rem;
  flex-shrink: 0;
}
.kanban-columns-add {
  display: flex;
  gap: .5rem;
  margin-top: .75rem;
  align-items: center;
}
.kanban-columns-add .input { flex: 1 1 auto; }
.kanban-board {
  display: flex;
  gap: var(--space-md);
  align-items: start;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: .15rem;
}
.kanban-col {
  background: hsl(var(--bg-base)); border: 1px solid hsl(var(--border-light));
  border-radius: var(--radius); padding: .75rem; min-height: 240px;
  flex: 1 1 0;
  min-width: min(260px, 100%);
}
.kanban-col__head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .65rem; padding: 0 .15rem .55rem;
  border-bottom: 1px solid hsl(var(--border-light));
}
.kanban-col__head h3 {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: hsl(var(--text-muted)); font-weight: 700; margin: 0;
}
.kanban-col__count {
  font-size: .68rem; font-weight: 700; min-width: 1.4rem; height: 1.4rem;
  display: inline-grid; place-items: center; border-radius: 999px;
  background: hsl(var(--bg-surface)); color: hsl(var(--text-secondary));
  border: 1px solid hsl(var(--border-light));
}
.kanban-col__cards { min-height: 48px; display: flex; flex-direction: column; gap: .45rem; }
.kanban-card {
  position: relative; padding: .7rem .75rem .65rem;
  border-radius: var(--radius-sm);
  overflow: hidden; isolation: isolate;
  --assignee-color: #9CA3AF;
  --priority-color: #D97706;
  /* Multi-assignee: equal stops on the left; single-assignee fallback matches prior look */
  --assignee-wash: color-mix(in srgb, var(--assignee-color) 32%, transparent) 0%,
    color-mix(in srgb, var(--assignee-color) 10%, transparent) 42%;
  background-color: hsl(var(--bg-surface));
  background-image:
    linear-gradient(
      118deg,
      var(--assignee-wash),
      color-mix(in srgb, var(--priority-color) 12%, transparent) 68%,
      color-mix(in srgb, var(--priority-color) 26%, transparent) 100%
    ),
    radial-gradient(
      ellipse 95% 80% at 0% 0%,
      color-mix(in srgb, var(--assignee-color) 22%, transparent),
      transparent 58%
    ),
    radial-gradient(
      ellipse 75% 65% at 100% 110%,
      color-mix(in srgb, var(--priority-color) 18%, transparent),
      transparent 52%
    ),
    linear-gradient(
      180deg,
      hsl(var(--bg-surface)) 0%,
      color-mix(in srgb, var(--assignee-color) 5%, hsl(var(--bg-surface))) 100%
    );
  background-size: 140% 140%, 120% 120%, 120% 120%, 100% 100%;
  background-position: 0% 50%, 0% 0%, 100% 100%, 0 0;
  border: 1px solid color-mix(in srgb, var(--assignee-color) 14%, hsl(var(--border-light)));
  border-left: 3px solid color-mix(in srgb, var(--assignee-color) 82%, var(--priority-color));
  box-shadow: 0 1px 0 hsla(0 0% 100% / .55) inset;
  cursor: pointer;
  transition:
    border-color .3s ease,
    box-shadow .35s ease,
    transform .35s var(--ease-out),
    background-position 1.2s var(--ease-soft);
}
.kanban-card::after {
  content: '';
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(105deg, transparent 36%, hsla(0 0% 100% / .42) 50%, transparent 64%);
  transform: translateX(-130%) skewX(-14deg); opacity: 0;
}
.kanban-card > * { position: relative; z-index: 2; }
.kanban-card:hover {
  border-color: color-mix(in srgb, var(--assignee-color) 32%, hsl(var(--border-light)));
  box-shadow:
    0 8px 22px -12px color-mix(in srgb, var(--assignee-color) 40%, transparent),
    0 1px 0 hsla(0 0% 100% / .6) inset;
  background-position: 100% 40%, 8% 4%, 92% 96%, 0 0;
}
.kanban-card:hover::after {
  opacity: 1;
  animation: surfaceSheen .9s var(--ease-out) both;
}
.kanban-card:active { cursor: grabbing; }
.kanban-card__title {
  font-size: .88rem; font-weight: 600; line-height: 1.3; margin: 0;
  padding-right: 1.4rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.kanban-card__meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: .35rem .45rem;
  margin-top: .45rem; min-height: 1.1rem;
}
.kanban-card__due {
  font-size: .68rem; font-weight: 600; color: hsl(var(--text-muted));
  font-variant-numeric: tabular-nums;
}
.kanban-card__due--overdue { color: hsl(0 60% 45%); }
.kanban-card__check,
.kanban-card__comments {
  font-size: .68rem; font-weight: 600; color: hsl(var(--text-muted));
  background: hsl(var(--bg-muted)); padding: .08rem .35rem; border-radius: 999px;
}
.kanban-card__prio {
  font-size: .65rem; font-weight: 700;
  color: hsl(0 60% 42%); background: hsl(0 70% 95%);
  padding: .08rem .35rem; border-radius: 999px;
}
.kanban-card__trash {
  position: absolute; top: .3rem; right: .28rem; z-index: 2;
  width: 1.5rem; height: 1.5rem; padding: 0; border: 0; border-radius: 6px;
  display: grid; place-items: center; cursor: pointer;
  color: hsl(var(--text-muted)); background: transparent;
  opacity: 0; transition: opacity var(--transition), background var(--transition), color var(--transition);
}
.kanban-card:hover .kanban-card__trash,
.kanban-card:focus-within .kanban-card__trash { opacity: 1; }
.kanban-card__trash:hover { color: #b91c1c; background: rgba(220, 38, 38, .1); }
@media (hover: none) {
  .kanban-card__trash { opacity: .55; }
}
.progress-mini--card { margin: .4rem 0 0; gap: 0; min-width: 0; }
.progress-mini--card .progress-mini__bar {
  width: 100%; height: 3px; border-radius: 99px; background: hsl(var(--border-light));
}
.progress-mini--card .progress-mini__fill {
  height: 100%; border-radius: inherit; display: block;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--assignee-color, hsl(var(--accent))) 75%, hsl(var(--accent))),
    color-mix(in srgb, var(--priority-color, hsl(var(--accent))) 55%, hsl(var(--accent)))
  );
  box-shadow: 0 0 6px color-mix(in srgb, var(--assignee-color, hsl(var(--accent))) 30%, transparent);
}
.progress-mini--card .progress-mini__label { display: none; }
.kanban-add { display: flex; gap: .35rem; margin-top: .55rem; align-items: center; }
.kanban-add .input { flex: 1; min-width: 0; background: hsl(var(--bg-surface)); }
.kanban-card--ghost { opacity: .35; }
.kanban-card--drag { box-shadow: var(--shadow-lg); }
.kanban-card--done { opacity: .55; }
.kanban-card--done .kanban-card__title { text-decoration: line-through; color: hsl(var(--text-muted)); }
.kanban-card--done .kanban-card__due--overdue { color: hsl(var(--text-muted)); font-weight: 400; }
.kanban-card--highlight {
  animation: kanbanHighlight 1.8s ease 2;
  border-color: hsl(var(--accent));
  box-shadow: 0 0 0 3px hsla(var(--accent), .25);
}
.assignee-card.kanban-card--highlight {
  border-color: hsl(var(--accent));
  box-shadow: 0 0 0 3px hsla(var(--accent), .25);
}
@keyframes kanbanHighlight {
  0%, 100% { box-shadow: 0 0 0 3px hsla(var(--accent), .25); }
  50% { box-shadow: 0 0 0 6px hsla(var(--accent), .12); }
}

.assignee-picker { display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem; }
.assignee-picker .assignee-select { flex: 1; }
.assignee-picker--multi {
  flex-direction: column; align-items: stretch; gap: .45rem;
}
.assignee-chips {
  display: flex; flex-wrap: wrap; gap: .35rem;
}
.assignee-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .15rem .45rem .15rem .2rem;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  background: hsl(var(--bg-surface));
  color: hsl(var(--text));
  font-size: .78rem; font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.assignee-chip:hover {
  border-color: hsl(var(--accent));
  background: hsla(var(--accent), .08);
}
.assignee-chip__name {
  max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.assignee-chip__x {
  color: hsl(var(--text-muted)); font-size: .95rem; line-height: 1; margin-left: .05rem;
}
.assignee-picker__hint { font-size: .72rem; margin: 0; }
.avatar-stack {
  --avatar-stack-ring: hsl(var(--bg-surface));
  --avatar-stack-glow: color-mix(in srgb, var(--study-accent, #2F6F5E) 28%, transparent);
  --avatar-stack-overlap: -9px;
  display: inline-flex;
  align-items: center;
  flex-direction: row;
  isolation: isolate;
}
.avatar-stack .profile-avatar,
.avatar-stack .assignee-avatar {
  position: relative;
  margin-left: var(--avatar-stack-overlap);
  box-shadow:
    0 0 0 2px var(--avatar-stack-ring),
    0 0 0 3px var(--avatar-stack-glow);
  transition: transform .22s ease, filter .22s ease, z-index 0s;
  filter: saturate(1.02);
}
.avatar-stack .profile-avatar:first-child,
.avatar-stack .assignee-avatar:first-child {
  margin-left: 0;
  z-index: 5;
}
.avatar-stack .profile-avatar:nth-child(2),
.avatar-stack .assignee-avatar:nth-child(2) { z-index: 4; }
.avatar-stack .profile-avatar:nth-child(3),
.avatar-stack .assignee-avatar:nth-child(3) { z-index: 3; }
.avatar-stack .profile-avatar:nth-child(4),
.avatar-stack .assignee-avatar:nth-child(4) { z-index: 2; }
.avatar-stack .profile-avatar:nth-child(n+5),
.avatar-stack .assignee-avatar:nth-child(n+5) { z-index: 1; }
/* Crescent cut so overlaps read as a soft fusion, not a hard pile. */
.avatar-stack .profile-avatar:not(:first-child),
.avatar-stack .assignee-avatar:not(:first-child) {
  -webkit-mask-image: radial-gradient(
    circle at -18% 50%,
    transparent 0 54%,
    #000 62% 100%
  );
  mask-image: radial-gradient(
    circle at -18% 50%,
    transparent 0 54%,
    #000 62% 100%
  );
}
.avatar-stack:hover .profile-avatar,
.avatar-stack:hover .assignee-avatar {
  filter: saturate(1.06);
}
.avatar-stack .profile-avatar:hover,
.avatar-stack .assignee-avatar:hover {
  z-index: 8;
  transform: scale(1.1) translateY(-1px);
  -webkit-mask-image: none;
  mask-image: none;
  filter: saturate(1.1);
}
.avatar-stack__more {
  position: relative;
  z-index: 0;
  margin-left: calc(var(--avatar-stack-overlap) + 2px);
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 .28rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  font-size: .62rem;
  font-weight: 750;
  letter-spacing: .02em;
  color: color-mix(in srgb, var(--study-accent, #2F6F5E) 72%, hsl(var(--text)));
  background:
    linear-gradient(
      145deg,
      color-mix(in srgb, var(--study-accent, #2F6F5E) 16%, hsl(var(--bg-surface))),
      color-mix(in srgb, var(--study-accent, #2F6F5E) 6%, hsl(var(--bg-muted)))
    );
  box-shadow:
    0 0 0 2px var(--avatar-stack-ring),
    0 0 0 3px var(--avatar-stack-glow);
  -webkit-mask-image: radial-gradient(
    circle at -18% 50%,
    transparent 0 54%,
    #000 62% 100%
  );
  mask-image: radial-gradient(
    circle at -18% 50%,
    transparent 0 54%,
    #000 62% 100%
  );
}
.avatar-stack--sm {
  --avatar-stack-overlap: -7px;
}
.avatar-stack--sm .avatar-stack__more {
  min-width: 1.1rem; height: 1.1rem; font-size: .58rem;
}
.kanban-detail-panel__description { width: 100%; resize: vertical; min-height: 5rem; font-size: .88rem; margin-bottom: .25rem; }
.kanban-detail-panel__save-hint { font-size: .72rem; margin: 0 0 .75rem; min-height: 1rem; }
.kanban-detail-panel__assignee-hint { font-size: .75rem; margin: 0 0 1rem; }
.kanban-detail-panel__comment-count { font-weight: 500; text-transform: none; letter-spacing: 0; }
.card-comments { list-style: none; margin: 0 0 .75rem; padding: 0; display: flex; flex-direction: column; gap: .75rem; }
.card-comment { display: flex; gap: .55rem; align-items: flex-start; }
.card-comment--empty { padding: .5rem 0; font-size: .82rem; }
.card-comment__body { flex: 1; min-width: 0; }
.card-comment__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem; margin-bottom: .2rem; font-size: .78rem; }
.card-comment__head strong { font-weight: 600; }
.card-comment__text { margin: 0; font-size: .85rem; line-height: 1.45; white-space: pre-wrap; }
.card-comment__edited { font-size: .72rem; }
.card-comment__actions { display: flex; gap: .25rem; margin-top: .35rem; }
.card-comment-form { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.card-comment-form textarea { resize: vertical; min-height: 3.5rem; }
/* Portal is fixed to the visual viewport (teleported to body) so no ancestor
   transform/filter/overflow can create a wrong containing block. */
.kanban-detail-portal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  z-index: 400;
  pointer-events: none;
  transform: none;
  filter: none;
  contain: none;
}
.kanban-detail-backdrop {
  position: absolute;
  inset: 0;
  background: hsla(220 20% 10% / .35);
  z-index: 0;
  pointer-events: auto;
}
.kanban-detail-panel {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(420px, 100%);
  height: 100%;
  max-height: 100%;
  background: hsl(var(--bg-surface));
  border-left: 1px solid hsl(var(--border-light));
  box-shadow: var(--shadow-lg);
  z-index: 1;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: contain;
  pointer-events: auto;
  padding-top: env(safe-area-inset-top, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
  transform: none !important; /* never let Alpine/animations create a CB */
}
.kanban-detail-panel__inner {
  display: flex; flex-direction: column;
  min-height: 0; flex: 1 1 auto;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}
.kanban-detail-panel__head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem;
  flex-shrink: 0;
  padding: 1rem 1.25rem .75rem;
  border-bottom: 1px solid hsl(var(--border-light));
  background: hsl(var(--bg-surface));
}
.kanban-detail-panel__scroll {
  flex: 1 1 auto; min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 1rem 1.25rem 1.25rem;
}
.kanban-detail-panel__footer {
  flex-shrink: 0;
  margin-top: 0;
  padding: .85rem 1.25rem;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--bg-surface));
}
body.kanban-detail-open {
  overflow: hidden;
  touch-action: none;
}
/* Fallback when panel is not wrapped in a portal (should not happen) */
body > .kanban-detail-backdrop {
  position: fixed; inset: 0; z-index: 400; pointer-events: auto;
}
body > .kanban-detail-panel {
  position: fixed; inset: 0 0 0 auto; z-index: 401;
  width: min(420px, 100vw); height: 100dvh; max-height: 100dvh;
}
@media (max-width: 640px) {
  .kanban-detail-panel,
  body > .kanban-detail-panel {
    inset: auto 0 0 0;
    width: 100%;
    height: min(92dvh, 100%);
    max-height: min(92dvh, 100%);
    border-left: none;
    border-top: 1px solid hsl(var(--border-light));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -12px 40px -16px rgba(20, 40, 35, .22);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .kanban-detail-panel__head {
    position: relative;
    padding-top: 1.2rem;
  }
  .kanban-detail-panel__head::before {
    content: "";
    position: absolute;
    top: .45rem; left: 50%;
    transform: translateX(-50%);
    width: 2.5rem; height: .28rem;
    border-radius: 999px;
    background: hsl(var(--border));
    pointer-events: none;
  }
  .kanban-detail-panel__title,
  .kanban-detail-panel__head .btn-icon {
    min-height: var(--touch-min);
  }
}
.kanban-detail-panel__head h2 { font-size: 1.1rem; margin: 0; }
.kanban-detail-panel__title {
  flex: 1; font-family: var(--font-head); font-size: 1.1rem; font-weight: 600;
  padding: .4rem .55rem;
}
.kanban-detail-panel__meta-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: .75rem;
  margin: .85rem 0 1rem;
}
.kanban-detail-panel__checklist-head {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  margin-top: .5rem;
}
.kanban-detail-panel__checklist-head .kanban-detail-panel__subhead { margin: 0; }
.subtask-title-input {
  flex: 1; min-width: 0; border: none !important; background: transparent !important;
  box-shadow: none !important; padding: .2rem .35rem !important;
}
.subtask-title-input:focus {
  background: hsl(var(--bg-surface)) !important;
  border: 1px solid hsl(var(--border)) !important;
}
.kanban-detail-panel__desc { margin-bottom: 1rem; font-size: .88rem; }
.kanban-detail-panel__subhead {
  font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: hsl(var(--text-muted)); margin: 1rem 0 .5rem;
}
.form-label { display: block; font-size: .78rem; font-weight: 600; color: hsl(var(--text-secondary)); margin-bottom: .35rem; }

.study-color-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: var(--study-color, hsl(var(--accent)));
  box-shadow: 0 0 0 2px hsla(0 0% 100% / .8);
  flex-shrink: 0;
}
.study-color-dot--lg { width: 14px; height: 14px; }
.study-color-badge {
  display: inline-block; max-width: 7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: .65rem; font-weight: 600; padding: .12rem .4rem; border-radius: 999px;
  background: color-mix(in srgb, var(--study-color, hsl(var(--accent))) 16%, transparent);
  color: var(--study-color, hsl(var(--accent)));
  border: 1px solid color-mix(in srgb, var(--study-color, hsl(var(--accent))) 35%, transparent);
}
.select--study { min-width: 12rem; }

.assignee-board-section {
  margin-top: 0; padding-top: var(--section-gap);
  border-top: 1px solid hsl(var(--border-light));
}
.assignee-board-section__head { margin-bottom: var(--space-sm); }
.assignee-board-section__head h2 { font-size: .95rem; margin: 0 0 .15rem; }
.assignee-board-section__head .muted { margin: 0; font-size: .8rem; }
.assignee-board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 1fr);
  gap: var(--space-md); overflow-x: auto; padding-bottom: .35rem; align-items: start;
}
.assignee-col {
  background: hsl(var(--bg-base)); border: 1px solid hsl(var(--border-light));
  border-radius: var(--radius); padding: .75rem; min-height: 120px;
}
.assignee-col__head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .5rem; padding-bottom: .4rem;
  border-bottom: 2px solid color-mix(in srgb, var(--assignee-color, #9CA3AF) 35%, transparent);
}
.assignee-col__identity { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.assignee-col__identity h3 {
  font-size: .78rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.assignee-col__count {
  font-size: .65rem; font-weight: 700; min-width: 1.25rem; height: 1.25rem;
  display: inline-grid; place-items: center; border-radius: 999px;
  background: hsl(var(--bg-surface)); color: hsl(var(--text-secondary));
  border: 1px solid hsl(var(--border-light)); flex-shrink: 0;
}
.assignee-col__cards { min-height: 36px; display: flex; flex-direction: column; gap: .35rem; }
.assignee-col__empty { font-size: .75rem; margin: 0; padding: .2rem 0; }
.assignee-col--unassigned {
  min-width: 220px;
}
.assignee-card--invite {
  --assignee-color: #0F766E;
  --priority-color: #0F766E;
  cursor: default;
  border-left-color: #0F766E;
}
.assignee-card--invite:hover {
  transform: none;
}
.assignee-card__invite-label {
  display: inline-block;
  font-weight: 700;
  color: #0F766E;
  margin-right: .15rem;
}
.assignee-card__invite-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-top: .4rem;
}
.assignee-card {
  position: relative; overflow: hidden; isolation: isolate;
  padding: .45rem .55rem; border-radius: var(--radius-sm);
  --assignee-color: #9CA3AF;
  --priority-color: #D97706;
  --assignee-wash: color-mix(in srgb, var(--assignee-color) 30%, transparent) 0%,
    color-mix(in srgb, var(--assignee-color) 8%, transparent) 42%;
  background-color: hsl(var(--bg-surface));
  background-image:
    linear-gradient(
      118deg,
      var(--assignee-wash),
      color-mix(in srgb, var(--priority-color) 22%, transparent) 100%
    ),
    radial-gradient(
      ellipse 90% 70% at 0% 0%,
      color-mix(in srgb, var(--assignee-color) 18%, transparent),
      transparent 55%
    ),
    hsl(var(--bg-surface));
  background-size: 135% 135%, 120% 120%, 100% 100%;
  background-position: 0% 50%, 0% 0%, 0 0;
  border: 1px solid color-mix(in srgb, var(--assignee-color) 12%, hsl(var(--border-light)));
  border-left: 3px solid color-mix(in srgb, var(--assignee-color) 82%, var(--priority-color));
  box-shadow: 0 1px 0 hsla(0 0% 100% / .5) inset;
  cursor: pointer;
  transition:
    border-color .3s ease,
    box-shadow .35s ease,
    transform .35s var(--ease-out),
    background-position 1s var(--ease-soft);
}
.assignee-card::after {
  content: '';
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(105deg, transparent 38%, hsla(0 0% 100% / .4) 50%, transparent 62%);
  transform: translateX(-130%) skewX(-14deg); opacity: 0;
}
.assignee-card > * { position: relative; z-index: 2; }
.assignee-card:hover {
  border-color: color-mix(in srgb, var(--assignee-color) 30%, hsl(var(--border-light)));
  box-shadow: 0 6px 16px -10px color-mix(in srgb, var(--assignee-color) 38%, transparent);
  background-position: 100% 45%, 6% 4%, 0 0;
}
.assignee-card:hover::after {
  opacity: 1;
  animation: surfaceSheen .85s var(--ease-out) both;
}
.assignee-card__title {
  display: block; font-size: .8rem; font-weight: 600; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.assignee-card__status {
  display: block; font-size: .68rem; color: hsl(var(--text-muted)); margin-top: .15rem;
}
.assignee-card--done { opacity: .55; }
.assignee-card--done .assignee-card__title { text-decoration: line-through; color: hsl(var(--text-muted)); }

/* Roadmap timeline */
.roadmap-timeline { position: relative; padding-left: 1.5rem; }
.roadmap-timeline::before {
  content: ''; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(to bottom, hsl(var(--accent)), hsla(var(--accent), .2));
}
.roadmap-card { display: flex; gap: 1rem; margin-bottom: 1.25rem; position: relative; }
.roadmap-card__rail { flex-shrink: 0; width: 14px; }
.roadmap-dot {
  display: block; width: 14px; height: 14px; border-radius: 50%;
  background: hsl(var(--accent)); border: 3px solid hsl(var(--bg-base));
  box-shadow: 0 0 0 2px hsla(var(--accent), .3);
  position: relative; left: -1.5rem; top: 1.25rem;
}
.roadmap-card__body { flex: 1; }
.roadmap-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; margin-bottom: .5rem; }
.roadmap-card__head h3 { font-size: 1rem; }
.roadmap-card__head a { color: hsl(var(--text)); }
.roadmap-card__head a:hover { color: hsl(var(--accent)); }
.roadmap-card__foot { display: flex; align-items: center; gap: .75rem; margin-top: .75rem; flex-wrap: wrap; }

/* Roadmap board: Kanban-light */
.roadmap-controls {
  display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1.25rem;
}
.roadmap-controls__label {
  font-size: .68rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: hsl(var(--text-muted)); margin-right: .25rem;
}
.roadmap-board {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .85rem; align-items: start;
}
.roadmap-col {
  background: hsl(var(--bg-surface)); border: 1px solid hsl(var(--border-light));
  border-radius: var(--radius); padding: .85rem; min-height: 320px; box-shadow: var(--shadow);
}
.roadmap-col__head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .65rem; padding-bottom: .45rem;
  border-bottom: 2px solid hsla(var(--accent), .2);
}
.roadmap-col__head h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: hsl(var(--text-secondary)); }
.roadmap-col__count {
  font-size: .7rem; font-weight: 700; padding: .15rem .45rem; border-radius: 999px;
  background: hsla(var(--accent), .12); color: hsl(var(--accent));
}
.roadmap-col__cards { min-height: 80px; display: flex; flex-direction: column; gap: .5rem; }
.roadmap-item-card {
  padding: .75rem .85rem; border-radius: var(--radius-sm);
  background: hsl(var(--bg-base)); border: 1px solid hsl(var(--border-light));
  cursor: pointer; transition: all var(--transition);
}
.roadmap-item-card:hover {
  border-color: hsla(var(--accent), .35); box-shadow: var(--shadow);
}
.roadmap-item-card__head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; margin-bottom: .35rem;
}
.roadmap-item-card__head h4 { font-size: .88rem; line-height: 1.3; }
.roadmap-item-card__preview { font-size: .78rem; margin: 0 0 .4rem; }
.roadmap-item-card__meta {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
}
.roadmap-item-card--ghost { opacity: .45; background: hsla(var(--accent), .12); }
.roadmap-item-card--drag { transform: rotate(1deg); box-shadow: var(--shadow-lg); }

.roadmap-progress {
  flex: 1; min-width: 60px; max-width: 100px; height: 6px; border-radius: 999px;
  background: hsl(var(--border-light)); overflow: hidden;
}
.roadmap-progress--lg { max-width: none; height: 8px; }
.roadmap-progress__bar {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, hsl(var(--accent)), hsl(158 42% 42%));
  transition: width var(--transition);
}
.roadmap-progress__label { font-size: .72rem; color: hsl(var(--text-muted)); }
.roadmap-link-chip {
  display: inline-flex; align-items: center; gap: .2rem;
  font-size: .7rem; font-weight: 600; padding: .18rem .5rem; border-radius: 999px;
  background: hsla(var(--accent), .1); color: hsl(var(--accent));
  border: 1px solid hsla(var(--accent), .2);
}
.roadmap-link-chip:hover { background: hsla(var(--accent), .18); color: hsl(var(--accent-hover)); }

.roadmap-detail-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(15, 23, 42, .35); backdrop-filter: blur(4px);
  display: flex; justify-content: flex-end; padding: 1rem;
}
.roadmap-detail-panel {
  width: min(440px, 100%); max-height: calc(100vh - 2rem); overflow-y: auto;
  padding: 1.25rem; align-self: stretch;
}
.roadmap-detail-panel__head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; margin-bottom: .75rem;
}
.roadmap-detail-panel__head h2 { font-size: 1.15rem; }
.roadmap-detail-panel__badges {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: .75rem 0;
}
.roadmap-detail-panel__progress { margin: .75rem 0; }
.roadmap-detail-panel__actions { margin: 1rem 0; }
.roadmap-detail-section { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid hsl(var(--border-light)); }
.roadmap-detail-section h3, .roadmap-detail-section__title { font-size: .85rem; margin-bottom: .5rem; }
.publication-list { list-style: none; padding: 0; margin: .75rem 0; display: flex; flex-direction: column; gap: .5rem; }
.publication-item {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .5rem .65rem; border-radius: 8px; background: hsl(var(--surface-elevated, var(--bg)));
  border: 1px solid hsl(var(--border-light));
}
.publication-item__title { flex: 1; font-weight: 600; font-size: .88rem; min-width: 8rem; }
.publication-quick-add { display: flex; gap: .5rem; align-items: center; margin-top: .75rem; }
.publication-quick-add .input { flex: 1; }

.study-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .65rem; }
.study-list__item {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .85rem 1rem; border-radius: var(--radius-md);
  background: hsl(var(--bg-surface)); border: 1px solid hsla(var(--border), .6);
}
.study-list__main { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; min-width: 0; }
.study-list__title { font-weight: 600; color: hsl(var(--text)); text-decoration: none; }
.study-list__title:hover { color: hsl(var(--accent)); }
.study-list__actions { flex-shrink: 0; }
.form-label--sm { font-size: .75rem; margin-bottom: .25rem; }
.roadmap-link-list { list-style: none; display: flex; flex-direction: column; gap: .35rem; }
.roadmap-link-list li {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  font-size: .85rem; padding: .35rem 0;
}
.roadmap-notes { list-style: none; margin-bottom: .75rem; }
.roadmap-notes li {
  padding: .5rem 0; border-bottom: 1px solid hsl(var(--border-light)); font-size: .85rem;
}
.roadmap-notes p { margin: .25rem 0 0; white-space: pre-wrap; }
[x-cloak] { display: none !important; }

/* Login */
.login-page { min-height: 100vh; display: flex; flex-direction: column; }
.login-page__main {
  flex: 1; display: grid; place-items: center; padding: 1.5rem var(--page-padding) 2rem;
}
.login-box { width: 100%; max-width: 400px; }
.login-box h2 { margin: 0 0 .35rem; }
.login-box .muted { margin-bottom: var(--space-md); }
.login-box .form-stack { gap: var(--space-md); }

/* Studies landing — photograph band + milky glass composition */
.shell--landing .app-header {
  background: hsla(var(--bg-surface), .78);
  border-bottom-color: color-mix(in srgb, hsl(var(--accent)) 12%, hsl(var(--border)));
  box-shadow: 0 1px 0 hsla(0 0% 100% / .55) inset;
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
}
.shell--landing .app-header::after { opacity: .28; }
.main--landing,
.content-shell > .main.main--landing {
  padding: 0;
  max-width: none;
}
.landing-hub {
  --landing-pad-x: clamp(1.25rem, 4vw, 3rem);
  --landing-pad-y: clamp(1.1rem, 2.8vh, 1.75rem);
  --landing-sage: var(--accent);
  --landing-glass-edge: color-mix(in srgb, hsl(var(--accent)) 18%, hsla(0 0% 100% / .88));
  --landing-glass-shadow:
    0 1px 0 hsla(0 0% 100% / .92) inset,
    0 0 0 1px hsla(0 0% 100% / .28) inset,
    0 20px 48px -22px rgba(14, 36, 28, .32),
    0 6px 16px -8px rgba(14, 36, 28, .14);
  --landing-max: 78rem;
  font-family: var(--font);
  color: hsl(var(--text));
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: clamp(1.75rem, 3.5vw, 2.75rem);
  width: calc(100% + 2 * var(--page-padding));
  margin-left: calc(-1 * var(--page-padding));
  margin-right: calc(-1 * var(--page-padding));
  padding:
    var(--landing-pad-y)
    var(--landing-pad-x)
    clamp(2.75rem, 6vw, 4.5rem);
  min-height: calc(100dvh - var(--header-h) - env(safe-area-inset-top, 0px));
  overflow-x: clip;
}

/* ── Hero: Bern photo band (native sharpness) + overlapping glass ── */
.landing-hero {
  position: relative;
  width: 100%;
  max-width: var(--landing-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  animation: landingRise .9s var(--ease-out) both;
}
.landing-hero__band {
  position: relative;
  width: 100%;
  aspect-ratio: 1024 / 473;
  overflow: hidden;
  border-radius: calc(var(--radius) + 8px);
  /* Soft page tone only — never letterbox black beside the photo */
  background: hsl(var(--bg-base));
  box-shadow:
    0 1px 0 hsla(0 0% 100% / .35) inset,
    0 28px 56px -32px rgba(10, 24, 18, .28);
  animation: landingBandIn 1.1s var(--ease-out) .05s both;
}
.landing-hero__photo {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  line-height: 0;
}
.landing-hero__photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  image-rendering: auto;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.landing-hero__band-edge {
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* Soft bottom only — no dark side rails */
  background:
    linear-gradient(180deg, transparent 0%, transparent 62%, rgba(14, 36, 28, .22) 100%);
  border-radius: inherit;
}
/* Glass + posse sit under the Bern band; glass still overlaps the photo */
.landing-hero__stage {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: clamp(0.75rem, 2.5vw, 2rem);
  width: 100%;
  margin: clamp(-5.5rem, -8vw, -3.75rem) 0 0;
  padding-inline: clamp(0px, 2vw, 1.25rem);
}
.landing-hero__glass {
  position: relative;
  z-index: 2;
  isolation: isolate;
  overflow: hidden;
  flex: 0 1 34rem;
  width: min(100%, 34rem);
  margin: 0;
  padding: clamp(1.4rem, 3vw, 1.95rem) clamp(1.3rem, 2.8vw, 1.85rem) clamp(1.35rem, 2.8vw, 1.75rem);
  border-radius: calc(var(--radius) + 6px);
  /* Strong milky glass — Bern peeks faintly; type stays crisp */
  background:
    linear-gradient(
      155deg,
      hsla(0 0% 100% / .985) 0%,
      color-mix(in srgb, hsl(var(--accent)) 3%, hsla(var(--bg-surface), .97)) 48%,
      hsla(165 28% 99% / .96) 100%
    );
  backdrop-filter: blur(44px) saturate(1.2);
  -webkit-backdrop-filter: blur(44px) saturate(1.2);
  border: 1px solid var(--landing-glass-edge);
  box-shadow: var(--landing-glass-shadow);
  animation: landingGlassIn 1s var(--ease-out) .18s both;
}
.landing-hero__glass::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 58% at 8% 0%, hsla(0 0% 100% / .9), transparent 58%),
    linear-gradient(180deg, hsla(0 0% 100% / .55), hsla(165 20% 99% / .35) 52%, hsla(0 0% 100% / .18) 100%);
  z-index: 0;
}
.landing-hero__glass::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(118deg, transparent 36%, hsla(0 0% 100% / .42) 50%, transparent 64%);
  mix-blend-mode: soft-light;
  animation: landingGlassSheen 14s ease-in-out infinite;
  z-index: 0;
}
.landing-hero__glass > * { position: relative; z-index: 1; }
.landing-hero__mark {
  margin: 0 0 .4rem;
  font-family: var(--font);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  /* Darker than accent — pale sage washed out on frosted glass */
  color: color-mix(in srgb, hsl(var(--accent-hover)) 68%, hsl(var(--text)));
}
.landing-hero__brand {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(2.4rem, 6vw, 3.35rem);
  line-height: 1.05;
  letter-spacing: -.038em;
  text-wrap: balance;
  /* Brand green, darker + slight lift for crisp edges on glass */
  color: hsl(158 55% 26%);
  -webkit-font-smoothing: antialiased;
  text-shadow: 0 1px 0 hsla(0 0% 100% / .6);
}
.landing-hero__motto {
  margin: .8rem 0 0;
  max-width: 26rem;
  font-family: var(--font);
  font-weight: 600;
  font-size: clamp(1.02rem, 2vw, 1.14rem);
  line-height: 1.5;
  letter-spacing: -.01em;
  color: hsl(var(--text));
}
.landing-hero__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.35rem;
  margin-top: 1.4rem;
}
.landing-cta {
  min-height: 2.7rem;
  padding: .68rem 1.3rem;
  font-size: .9rem;
  transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out);
}
.landing-cta:hover { transform: translateY(-2px); }
.landing-cta:active { transform: translateY(0); }
.landing-cta--quiet { box-shadow: none; }

/* Active this week — stacked avatars in the hero glass */
.landing-active {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem .75rem;
  min-width: 0;
}
.landing-active__label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: hsl(var(--text-muted));
  width: 100%;
  margin: 0;
}
.landing-active__stack {
  --landing-chip-size: 2.45rem;
  --landing-chip-overlap: -0.92rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  width: max-content;
  max-width: 100%;
  isolation: isolate;
}
.landing-active__chip {
  display: block;
  position: relative;
  box-sizing: border-box;
  width: var(--landing-chip-size);
  height: var(--landing-chip-size);
  margin: 0;
  padding: 0;
  border-radius: 50%;
  text-decoration: none;
  color: inherit;
  line-height: 0;
  flex: 0 0 auto;
  z-index: 1;
  transition: transform .28s var(--ease-out), z-index 0s;
}
.landing-active__chip + .landing-active__chip {
  margin-left: var(--landing-chip-overlap);
}
.landing-active__chip:nth-of-type(1) { z-index: 8; }
.landing-active__chip:nth-of-type(2) { z-index: 7; }
.landing-active__chip:nth-of-type(3) { z-index: 6; }
.landing-active__chip:nth-of-type(4) { z-index: 5; }
.landing-active__chip:nth-of-type(5) { z-index: 4; }
.landing-active__chip:nth-of-type(6) { z-index: 3; }
.landing-active__chip:nth-of-type(n+7) { z-index: 2; }
.landing-active__chip .profile-avatar,
.landing-active__chip .profile-avatar--sm {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: .78rem;
  box-shadow:
    0 0 0 2.5px hsla(0 0% 100% / .96),
    0 0 0 3.5px color-mix(in srgb, hsl(var(--landing-sage)) 30%, transparent),
    0 8px 18px -10px rgba(12, 32, 24, .48);
}
.landing-active__chip + .landing-active__chip .profile-avatar {
  -webkit-mask-image: radial-gradient(circle at -22% 50%, transparent 0 52%, #000 60% 100%);
  mask-image: radial-gradient(circle at -22% 50%, transparent 0 52%, #000 60% 100%);
}
.landing-active__chip:hover,
.landing-active__chip:focus-visible {
  z-index: 12;
  transform: translateY(-3px) scale(1.1);
  outline: none;
}
.landing-active__chip:hover .profile-avatar,
.landing-active__chip:focus-visible .profile-avatar {
  -webkit-mask-image: none;
  mask-image: none;
}
.landing-active__when {
  font-family: var(--font);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: -.005em;
  color: hsl(var(--text-secondary));
  padding: .26rem .6rem;
  border-radius: 999px;
  background: hsla(var(--bg-muted), .85);
  border: 1px solid hsl(var(--border-light));
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.landing-active__empty {
  margin: 0;
  font-size: .86rem;
}

/* Wanted-poster posse — wide fanned deck beside the glass */
.landing-posse {
  flex: 1 1 22rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0 0 .15rem;
  animation: landingGlassIn 1.05s var(--ease-out) .28s both;
}
.landing-posse__deck {
  --posse-card-w: clamp(5.6rem, 9.2vw, 7.8rem);
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  width: min(100%, calc(var(--posse-card-w) * 6.35));
  height: calc(var(--posse-card-w) * 1.5);
  isolation: isolate;
}
.landing-posse__card {
  --posse-x: 0rem;
  --posse-y: 0rem;
  --posse-rot: 0deg;
  position: absolute;
  left: 50%;
  bottom: 0;
  width: var(--posse-card-w);
  margin: 0;
  padding: 0;
  transform-origin: 50% 92%;
  transform:
    translateX(calc(-50% + var(--posse-x)))
    translateY(var(--posse-y))
    rotate(var(--posse-rot));
  transition:
    transform .38s var(--ease-out),
    filter .38s var(--ease-out);
  filter: drop-shadow(0 14px 20px rgba(12, 28, 20, .28));
  will-change: transform;
}
.landing-posse__card:nth-child(1) {
  --posse-x: -11.4rem;
  --posse-y: .85rem;
  --posse-rot: -22deg;
  z-index: 1;
}
.landing-posse__card:nth-child(2) {
  --posse-x: -6.85rem;
  --posse-y: .45rem;
  --posse-rot: -13deg;
  z-index: 2;
}
.landing-posse__card:nth-child(3) {
  --posse-x: -2.3rem;
  --posse-y: .12rem;
  --posse-rot: -4.5deg;
  z-index: 3;
}
.landing-posse__card:nth-child(4) {
  --posse-x: 2.3rem;
  --posse-y: .12rem;
  --posse-rot: 4.5deg;
  z-index: 4;
}
.landing-posse__card:nth-child(5) {
  --posse-x: 6.85rem;
  --posse-y: .45rem;
  --posse-rot: 13deg;
  z-index: 5;
}
.landing-posse__card:nth-child(6) {
  --posse-x: 11.4rem;
  --posse-y: .85rem;
  --posse-rot: 22deg;
  z-index: 6;
}
.landing-posse__open {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  border-radius: 2px;
  line-height: 0;
}
.landing-posse__open:focus-visible {
  outline: 2px solid color-mix(in srgb, hsl(var(--accent)) 55%, transparent);
  outline-offset: 3px;
}
.landing-posse__card picture,
.landing-posse__card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
/* Only the card under the pointer lifts — never the whole deck / top card */
.landing-posse__card:has(> .landing-posse__open:hover),
.landing-posse__card:has(> .landing-posse__open:focus-visible) {
  z-index: 8;
  transform:
    translateX(calc(-50% + var(--posse-x)))
    translateY(calc(var(--posse-y) - .7rem))
    rotate(var(--posse-rot))
    scale(1.05);
  filter: drop-shadow(0 22px 28px rgba(12, 28, 20, .36));
}

/* Posse lightbox */
.landing-posse-lightbox {
  z-index: 400;
  background: hsla(160 18% 6% / .78);
  backdrop-filter: blur(10px) saturate(1.05);
  -webkit-backdrop-filter: blur(10px) saturate(1.05);
  cursor: zoom-out;
  padding: clamp(1rem, 4vw, 2.25rem);
  animation: landingGlassIn .28s var(--ease-out) both;
}
.landing-posse-lightbox__figure {
  margin: 0;
  max-width: min(92vw, 30rem);
  cursor: default;
  line-height: 0;
}
.landing-posse-lightbox__img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(88dvh, 42rem);
  object-fit: contain;
  border-radius: 3px;
  filter: drop-shadow(0 28px 48px rgba(0, 0, 0, .5));
}
.landing-posse-lightbox__close {
  position: absolute;
  top: max(.75rem, env(safe-area-inset-top, 0px));
  right: max(.75rem, env(safe-area-inset-right, 0px));
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 999px;
  background: hsla(0 0% 100% / .14);
  color: #fff;
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .2s var(--ease-out);
}
.landing-posse-lightbox__close:hover,
.landing-posse-lightbox__close:focus-visible {
  background: hsla(0 0% 100% / .28);
  outline: none;
}

/* Shared milky glass panels */
.landing-panel {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin: 0;
  padding: clamp(1.15rem, 2.4vw, 1.45rem) clamp(1.15rem, 2.4vw, 1.5rem) clamp(1.2rem, 2.5vw, 1.55rem);
  background:
    linear-gradient(
      150deg,
      hsla(0 0% 100% / .88) 0%,
      color-mix(in srgb, hsl(var(--accent)) 5%, hsla(var(--bg-surface), .82)) 52%,
      hsla(var(--bg-surface), .74) 100%
    );
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--landing-glass-edge);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--landing-glass-shadow);
}
.landing-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 65% 50% at 8% 0%, hsla(0 0% 100% / .55), transparent 55%),
    linear-gradient(180deg, hsla(0 0% 100% / .2), transparent 40%);
  z-index: 0;
}
.landing-panel > * { position: relative; z-index: 1; }
.landing-panel__head {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-bottom: 1.1rem;
}
.landing-panel__head h2 {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1.2;
  letter-spacing: -.02em;
  color: hsl(var(--text));
}
.landing-panel__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: hsl(var(--text-muted));
  padding: .12rem .5rem;
  border-radius: 999px;
  background: hsla(var(--bg-muted), .75);
  border: 1px solid hsl(var(--border-light));
}

/* Studies — photo tiles */
.landing-studies {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  padding: 0;
  max-width: var(--landing-max);
  width: 100%;
  margin: 0 auto;
  animation: landingRise .85s var(--ease-out) .12s both;
}
.landing-studies__empty {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.25rem;
  padding: .35rem 0 .15rem;
  color: hsl(var(--text-secondary));
}
.landing-studies__empty p { margin: 0; font-size: .95rem; }

.study-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 1.15rem 1.25rem;
  margin: 0;
  align-items: stretch;
}

/* Tasks */
.landing-tasks {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  max-width: var(--landing-max);
  width: 100%;
  margin: 0 auto;
  padding-bottom: .25rem;
  animation: landingRise .85s var(--ease-out) .2s both;
}
.landing-tasks--with-team {
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
}
.landing-tasks__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: .65rem;
}
.landing-tasks__head h2 {
  margin: 0;
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -.015em;
  color: hsl(var(--text));
}
.landing-tasks__filters {
  display: flex;
  align-items: baseline;
  gap: .85rem;
}
.landing-tasks__filter {
  appearance: none;
  border: 0;
  background: none;
  padding: 0 0 1px;
  font: inherit;
  font-size: .8rem;
  font-weight: 500;
  line-height: 1.2;
  color: hsl(var(--text-muted));
  cursor: pointer;
  text-decoration: none;
  box-shadow: inset 0 -1px 0 transparent;
  transition: color .2s ease, box-shadow .2s ease;
}
.landing-tasks__filter:hover { color: hsl(var(--text)); }
.landing-tasks__filter.is-active {
  color: hsl(var(--accent));
  box-shadow: inset 0 -1px 0 color-mix(in srgb, hsl(var(--accent)) 55%, transparent);
}
.landing-tasks__open-meta {
  display: inline-flex;
  align-items: baseline;
  gap: .3em;
  font-size: .8rem;
  font-weight: 500;
  line-height: 1.2;
  color: hsl(var(--text-muted));
}
.landing-tasks__open-meta-num {
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  font-variant-numeric: tabular-nums;
}
.landing-tasks__empty {
  margin: 0;
  padding: .35rem 0 0;
  font-size: .9rem;
}

@keyframes landingRise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
@keyframes landingBandIn {
  from { opacity: 0; transform: translateY(10px) scale(.995); }
  to { opacity: 1; transform: none; }
}
@keyframes landingGlassIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
@keyframes landingGlassSheen {
  0%, 100% { opacity: .18; transform: translateX(-7%); }
  50% { opacity: .45; transform: translateX(7%); }
}
.my-tasks-list { list-style: none; margin: 0; padding: 0; }
.my-task-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .65rem 0;
  border-radius: var(--radius-sm);
  text-decoration: none; color: inherit;
  border-bottom: 1px solid hsl(var(--border-light));
  transition: background var(--transition);
}
.my-task-item:last-child { border-bottom: none; }
.my-task-item:hover { background: hsla(var(--accent), .06); }
.my-task-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.my-task-item__title {
  font-weight: 600; font-size: .9rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.my-task-item__meta {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  font-size: .75rem; color: hsl(var(--text-muted));
}
.my-task-item__study { font-weight: 500; }
.my-task-item__status {
  flex-shrink: 0; font-size: .7rem; padding: .15rem .45rem;
}
.my-task-item__status--backlog {
  background: hsl(210 30% 94%); color: hsl(210 25% 40%);
}
.my-task-item__status--active {
  background: hsla(var(--accent), .12); color: hsl(var(--accent));
}
.my-task-item__arrow {
  flex-shrink: 0; opacity: 0; color: hsl(var(--accent));
  transition: opacity var(--transition), transform var(--transition);
}
.my-task-item:hover .my-task-item__arrow { opacity: 1; transform: translateX(2px); }
.my-tasks-empty { margin: 0; padding: .5rem 0; font-size: .9rem; }
.team-tasks-summary { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .1rem; }
.my-tasks-panel__tools {
  display: flex; align-items: center; gap: .35rem; flex-wrap: wrap;
}
.my-tasks-panel--enhanced .panel__head {
  flex-wrap: wrap; gap: .5rem;
}
.quick-task-form {
  display: flex; flex-wrap: wrap; gap: .4rem; align-items: center;
  padding: 0 0 .85rem; margin-bottom: .65rem;
  border-bottom: 1px solid hsl(var(--border-light));
}
.quick-task-form .input { flex: 1 1 140px; min-width: 0; }
.quick-task-form__date { flex: 0 1 auto; max-width: 11rem; }
.my-task-item--interactive {
  display: flex; align-items: stretch; gap: 0;
  padding: 0; margin: 0 -.5rem;
  border-bottom: 1px solid hsl(var(--border-light));
}
.my-task-item--interactive:last-child { border-bottom: none; }
.my-task-item__check {
  flex-shrink: 0; align-self: center; margin-left: .35rem;
}
.my-task-item__link {
  flex: 1; display: flex; align-items: center; gap: .65rem;
  padding: .55rem .5rem; text-decoration: none; color: inherit;
  border: none; background: transparent; cursor: pointer; text-align: left;
  border-radius: var(--radius-sm); font: inherit; width: 100%;
  transition: background var(--transition);
}
.my-task-item__link:hover { background: hsla(var(--accent), .06); }
.my-task-item__link:hover .my-task-item__title { color: hsl(var(--accent)); }
.my-task-item__edit {
  flex-shrink: 0; align-self: center; margin-right: .35rem; font-weight: 600;
}
.my-tasks-list > li {
  border-bottom: 1px solid hsl(var(--border-light));
}
.my-tasks-list > li:last-child { border-bottom: none; }
.my-task-item--open { background: hsla(var(--accent), .04); border-radius: var(--radius-sm); }
.my-task-item--interactive { border-bottom: none; margin: 0; }
.progress-mini--inline { min-width: 3.5rem; }
.progress-mini--inline .progress-mini__bar { width: 2.5rem; }
.my-task-editor {
  padding: 0 .5rem .85rem 2.5rem;
}
.my-task-editor__inner {
  display: flex; flex-direction: column; gap: 1rem;
  padding: .85rem 1rem;
  background:
    linear-gradient(160deg, hsla(var(--accent), .04), transparent 50%),
    hsl(var(--bg-muted));
  border: 1px solid hsl(var(--border-light));
  border-radius: var(--radius-sm);
}
.my-task-editor__row {
  display: grid; grid-template-columns: 1fr 1fr; gap: .75rem;
}
.my-task-editor__footer {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
}
@media (max-width: 720px) {
  .kanban-detail-panel__meta-grid,
  .my-task-editor__row { grid-template-columns: 1fr; }
  .my-task-editor { padding-left: .5rem; }
}
.team-tasks-summary__btn {
  display: flex; align-items: center; gap: .55rem; width: 100%;
  padding: .55rem .35rem; border: none; background: none; cursor: pointer;
  font: inherit; text-align: left; color: inherit;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid hsl(var(--border-light));
  transition: background var(--transition), color var(--transition);
}
.team-tasks-summary__btn:hover {
  background: hsla(var(--accent), .06);
  color: hsl(var(--accent));
}
.team-tasks-summary__row:last-child .team-tasks-summary__btn { border-bottom: none; }
.team-tasks-summary__name {
  flex: 1; min-width: 0; font-size: .88rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.team-tasks-summary__count {
  font-family: var(--font-head); font-weight: 700; font-size: .95rem;
  color: hsl(var(--accent)); min-width: 1.5rem; text-align: right;
  font-variant-numeric: tabular-nums;
}

.study-card {
  --study-accent: var(--study-color, hsl(var(--accent)));
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 0;
  padding: 0;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(160deg, hsla(0 0% 100% / .78) 0%, hsla(165 30% 99% / .86) 52%, hsla(158 24% 97% / .72) 100%);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  border: 1px solid color-mix(in srgb, var(--study-accent) 20%, hsla(0 0% 100% / .55));
  border-radius: .95rem;
  text-decoration: none;
  color: inherit;
  box-shadow:
    0 1px 0 hsla(0 0% 100% / .7) inset,
    0 16px 36px -24px rgba(18, 42, 34, .32);
  transition:
    border-color .3s ease,
    box-shadow .35s var(--ease-out),
    transform .35s var(--ease-out);
}
.study-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(125deg, transparent 40%, hsla(0 0% 100% / .28) 50%, transparent 60%);
  opacity: 0;
  transition: opacity .45s var(--ease-out);
}
.study-card__media {
  position: relative;
  z-index: 1;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background:
    linear-gradient(
      155deg,
      color-mix(in srgb, var(--study-accent) 32%, hsl(165 18% 92%)) 0%,
      color-mix(in srgb, var(--study-accent) 10%, hsl(165 14% 96%)) 100%
    );
}
.study-card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 62%, hsla(158 20% 10% / .12) 100%);
  opacity: .4;
}
.study-card--has-photo .study-card__media::after { opacity: .55; }
.study-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transform: scale(1.02);
  transition: transform .7s var(--ease-out);
}
.study-card:hover .study-card__media img { transform: scale(1.07); }
.study-card__body {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: .95rem 1.05rem 1.1rem;
  position: relative;
  z-index: 1;
  border-top: 2px solid color-mix(in srgb, var(--study-accent) 55%, transparent);
  background: linear-gradient(180deg, hsla(0 0% 100% / .35), hsla(165 30% 99% / .55));
}
.study-card:hover {
  border-color: color-mix(in srgb, var(--study-accent) 34%, hsla(158 16% 40% / .14));
  box-shadow:
    0 1px 0 hsla(0 0% 100% / .78) inset,
    0 18px 40px -20px hsla(158 30% 18% / .38);
  color: inherit;
  transform: translateY(-3px);
}
.study-card:hover::after { opacity: 1; }
.study-card:active { transform: translateY(0); }
.study-card__status {
  font-size: .68rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: color-mix(in srgb, var(--study-accent) 70%, hsl(158 12% 42%));
}
.study-card__title {
  margin: 0;
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.25;
  color: hsl(var(--text));
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.study-card__meta { font-size: .82rem; color: hsl(var(--text-muted)); margin: 0; }
.study-card__desc {
  font-size: .82rem; margin: 0; line-height: 1.45; color: hsl(var(--text-secondary));
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.study-card__desc--placeholder { color: hsl(var(--text-muted)); font-style: italic; }
.study-card__cta { display: none; }
.study-card--jv {
  border-color: hsla(215, 70%, 45%, .28);
}
.badge--jv {
  background: hsla(215, 70%, 45%, .12);
  color: hsl(215, 65%, 32%);
  border: 1px solid hsla(215, 70%, 45%, .25);
  font-weight: 600;
}
/* Shared study page chrome (nav + modules) */
.study-page {
  display: flex; flex-direction: column; gap: var(--section-gap);
  --study-accent: var(--study-color, hsl(var(--accent)));
}
.study-nav {
  display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .65rem;
  margin: 0; padding: .45rem .55rem;
  border-radius: var(--radius);
  position: relative; overflow: hidden;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 8%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-surface)) 72%);
  border: 1px solid color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 12%, hsl(var(--border-light)));
  box-shadow: 0 1px 0 hsla(0 0% 100% / .55) inset, var(--shadow);
}
.study-nav::before {
  content: "";
  position: absolute; top: -40%; left: -4%; bottom: -40%; width: 36%;
  background: radial-gradient(circle, color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 11%, transparent), transparent 74%);
  filter: blur(24px); opacity: .55; pointer-events: none;
  animation: blobFloat 20s ease-in-out infinite;
}
.study-nav__tabs,
.study-nav__actions { position: relative; z-index: 1; }
.study-nav__tabs {
  display: flex; flex-wrap: wrap; gap: .2rem; flex: 1; min-width: 0;
}
.study-nav__label-short { display: none; }
.study-nav__tab {
  display: inline-flex; align-items: center;
  min-height: 2.25rem;
  padding: .35rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 500;
  color: hsl(var(--text-muted)); text-decoration: none;
  border: 1px solid transparent;
  transition: color var(--transition), background var(--transition), border-color var(--transition), transform .25s var(--ease-out);
}
.study-nav__tab:hover {
  color: hsl(var(--text));
  background: color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 8%, transparent);
}
.study-nav__tab:active { transform: scale(.97); }
.study-nav__tab.active {
  color: color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 85%, hsl(var(--text)));
  background: color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 14%, hsl(var(--bg-surface)));
  border-color: color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 28%, transparent);
  font-weight: 650;
  box-shadow: 0 1px 0 hsla(0 0% 100% / .4) inset;
}
.study-nav__actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-left: auto;
}
.study-nav__edit { margin-left: 0; }
.hero--compact { margin-bottom: var(--section-gap); }
.hero--compact h1 { font-size: 1.45rem; }

.study-page__head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: .85rem 1.25rem;
  padding: 1.25rem 1.35rem;
  border-radius: calc(var(--radius) + 2px);
  position: relative; overflow: hidden; isolation: isolate;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--study-accent) 9%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-surface)) 60%),
    hsl(var(--bg-surface));
  border: 1px solid color-mix(in srgb, var(--study-accent) 14%, hsl(var(--border-light)));
  border-left: 3px solid var(--study-accent);
  box-shadow: var(--shadow), 0 1px 0 hsla(0 0% 100% / .55) inset;
}
.study-page__head::before,
.study-page__head::after {
  content: '';
  position: absolute; pointer-events: none; z-index: 0;
  border-radius: 50%; filter: blur(32px);
}
.study-page__head::before {
  top: -16%; right: -6%; width: 48%; height: 95%;
  background: radial-gradient(circle at 40% 40%, color-mix(in srgb, var(--study-accent) 14%, transparent), transparent 74%);
  animation: blobFloat 16s ease-in-out infinite;
}
.study-page__head::after {
  bottom: -24%; left: -4%; width: 38%; height: 75%;
  background: radial-gradient(circle at 50% 50%, hsla(var(--accent), .08), transparent 76%);
  animation: blobFloat 20s ease-in-out infinite reverse;
}
.study-page__head > * { position: relative; z-index: 1; }
.study-page__brand {
  display: flex; align-items: flex-start; gap: .7rem; min-width: 0;
}
.study-page__eyebrow {
  margin: 0 0 .15rem; font-size: .7rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--study-accent) 50%, hsl(var(--text-muted)));
}
.study-page__head h1 {
  margin: 0; font-size: clamp(1.35rem, 2.6vw, 1.75rem); letter-spacing: -.03em;
  background: linear-gradient(180deg, hsl(var(--text)) 40%, color-mix(in srgb, var(--study-accent) 28%, hsl(var(--text))) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .study-page__head h1 { color: hsl(var(--text)); background: none; }
}
.study-page__lead {
  margin: .45rem 0 0; color: hsl(var(--text-secondary)); font-size: .92rem; max-width: 40rem;
}
.study-page__meta {
  margin: .35rem 0 0; font-size: .8rem; font-weight: 600;
  color: color-mix(in srgb, var(--study-accent) 70%, hsl(var(--text-muted)));
}
.study-page__actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem;
}
.study-page__actions .btn.is-active,
.study-page__actions .btn[aria-expanded="true"] {
  background: color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 12%, hsl(var(--bg-surface)));
  color: color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 85%, hsl(var(--text)));
  border-color: color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 42%, hsl(var(--border)));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 10%, transparent);
}
.study-page__body {
  display: flex; flex-direction: column; gap: var(--section-gap);
}
.study-page .study-hub-panel,
.study-page .panel.study-hub-panel,
.study-page > .panel,
.study-page > .card,
.study-page .study-page__body > .panel,
.study-page .study-page__body > .card {
  background:
    linear-gradient(168deg, hsl(var(--bg-surface)) 0%, color-mix(in srgb, var(--study-accent) 5%, hsl(var(--bg-surface))) 100%);
  border: 1px solid color-mix(in srgb, var(--study-accent) 12%, hsl(var(--border-light)));
  border-top: 2px solid color-mix(in srgb, var(--study-accent) 36%, hsl(var(--border-light)));
  box-shadow: var(--shadow), 0 1px 0 hsla(0 0% 100% / .5) inset;
  transition: transform .35s var(--ease-out), box-shadow .35s ease, border-color .3s ease;
}
.study-page .study-hub-panel:hover,
.study-page .panel.study-hub-panel:hover {
  border-color: color-mix(in srgb, var(--study-accent) 24%, hsl(var(--border-light)));
  box-shadow: var(--shadow-lg), 0 1px 0 hsla(0 0% 100% / .55) inset;
}
.study-page .panel + .panel { margin-top: 0; }
.study-page .filter-pills {
  margin-bottom: 0;
  padding: .3rem; border-radius: 999px;
  background: hsl(var(--bg-surface));
  border: 1px solid hsl(var(--border-light));
  box-shadow: var(--shadow);
  width: fit-content;
}
.study-page .filter-pills .pill.active {
  background: color-mix(in srgb, var(--study-accent) 14%, hsl(var(--bg-surface)));
  color: color-mix(in srgb, var(--study-accent) 85%, hsl(var(--text)));
}
.study-page .wiki-sidebar,
.study-page .media-sidebar,
.study-page .dicom-sidebar,
.study-page .dicom-main {
  background:
    linear-gradient(165deg, color-mix(in srgb, var(--study-accent) 5%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-surface)) 60%);
  border-top: 2px solid color-mix(in srgb, var(--study-accent) 30%, hsl(var(--border-light)));
}
.study-page .dicom-file-list__item.active {
  border-color: color-mix(in srgb, var(--study-accent) 40%, hsl(var(--border)));
  background: color-mix(in srgb, var(--study-accent) 10%, hsl(var(--bg-surface)));
}
.study-page .wiki-author {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .82rem; color: hsl(var(--text-secondary));
}
.study-page .wiki-folder-tree__link:hover,
.study-page .wiki-folder-tree__link.active,
.study-page .wiki-nav a:hover,
.study-page .wiki-nav a.active,
.study-page .wiki-folder-tree__btn.active {
  background: color-mix(in srgb, var(--study-accent) 12%, transparent);
  color: color-mix(in srgb, var(--study-accent) 80%, hsl(var(--text)));
}
.study-page .wiki-page-list__item {
  /* elevated styles live in the wiki aesthetics block below */
  border-top-color: transparent;
  transition: border-color .28s ease, box-shadow .28s ease, background .28s ease;
}
.study-page .wiki-page-list__item:hover {
  transform: none;
}
.study-page .wiki-content.card,
.study-page .wiki-editor__form,
.study-page .wiki-editor__preview {
  background:
    radial-gradient(ellipse 80% 50% at 100% 0%, color-mix(in srgb, var(--study-accent) 7%, transparent), transparent 55%),
    hsl(var(--bg-surface));
  border-top: 2px solid color-mix(in srgb, var(--study-accent) 26%, hsl(var(--border-light)));
}
.study-page .kanban-col,
.study-page .assignee-col {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--study-accent) 5%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-base)) 55%);
  border-top: 2px solid color-mix(in srgb, var(--study-accent) 32%, hsl(var(--border-light)));
  box-shadow: var(--shadow);
  transition: transform .35s var(--ease-out), box-shadow .35s ease, border-color .3s ease;
  position: relative; overflow: hidden;
}
.study-page .kanban-col::before,
.study-page .assignee-col::before {
  content: "";
  position: absolute; top: -10%; right: -6%; width: 48%; height: 42%;
  background: radial-gradient(circle, color-mix(in srgb, var(--study-accent) 13%, transparent), transparent 74%);
  filter: blur(18px); pointer-events: none; opacity: .5;
  animation: blobFloat 22s ease-in-out infinite;
}
.study-page .kanban-col:hover,
.study-page .assignee-col:hover {
  box-shadow: var(--shadow-lg);
}
.study-page .kanban-card:active {
  transform: scale(.99);
}
.study-page .assignee-board-section {
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius);
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--study-accent) 5%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-surface)) 70%);
  border: 1px solid hsl(var(--border-light));
  border-top: 2px solid color-mix(in srgb, var(--study-accent) 28%, hsl(var(--border-light)));
  box-shadow: var(--shadow);
}
.study-page .media-main.card {
  background:
    radial-gradient(ellipse 85% 55% at 100% 0%, color-mix(in srgb, var(--study-accent) 8%, transparent), transparent 55%),
    hsl(var(--bg-surface));
  border-top: 2px solid color-mix(in srgb, var(--study-accent) 28%, hsl(var(--border-light)));
}
.study-page .media-dropzone {
  border-color: color-mix(in srgb, var(--study-accent) 35%, hsl(var(--border)));
  background: color-mix(in srgb, var(--study-accent) 4%, hsl(var(--bg-surface)));
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}
.study-page .media-dropzone--active {
  border-color: var(--study-accent);
  background: color-mix(in srgb, var(--study-accent) 10%, hsl(var(--bg-surface)));
}
.study-page .media-file-card {
  padding: .9rem 1rem;
  border-top: 2px solid color-mix(in srgb, var(--study-accent) 24%, hsl(var(--border-light)));
  gap: .35rem;
}
.study-page .media-file-card__title { font-size: .88rem; }
.study-page .publication-item {
  padding: .85rem .95rem;
  border-radius: var(--radius-sm);
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--study-accent) 6%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-surface)) 65%);
  border: 1px solid hsl(var(--border-light));
  border-top: 2px solid color-mix(in srgb, var(--study-accent) 26%, hsl(var(--border-light)));
  transition: transform var(--transition), box-shadow var(--transition);
}
.study-page .publication-item:hover {
  box-shadow: var(--shadow);
}
.study-page .publication-quick-add {
  margin-top: 1rem; padding-top: 1rem;
  border-top: 1px dashed color-mix(in srgb, var(--study-accent) 25%, hsl(var(--border-light)));
}
.study-goal {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed color-mix(in srgb, var(--study-accent) 25%, hsl(var(--border-light)));
}
.study-goal--readonly {
  margin-top: .85rem;
  margin-bottom: .85rem;
  padding-bottom: .85rem;
}
.study-goal__label,
.study-pubs-section__label {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--study-accent, #2F6F5E) 88%, hsl(var(--text)));
  margin: 0 0 .45rem;
}
.study-goal__input {
  width: 100%;
  resize: vertical;
  min-height: 3.2rem;
  line-height: 1.45;
}
.study-goal__text {
  margin: 0;
  font-size: .92rem;
  line-height: 1.5;
  color: hsl(var(--text));
  white-space: pre-wrap;
}
.study-goal__hint {
  margin: .4rem 0 0;
  font-size: .78rem;
}
.study-pubs-section {
  margin-bottom: .35rem;
}
.study-pubs-section__label {
  margin-bottom: .35rem;
}
.study-page .members-list__item {
  padding: .8rem .55rem;
  margin: 0 -.55rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.study-page .members-list__item:hover {
  background: color-mix(in srgb, var(--study-accent) 6%, transparent);
}
.members-list__item--rights {
  display: grid;
  gap: .65rem;
  align-items: start;
}
.members-list__rights-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}
.members-caps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: .25rem .75rem;
  padding: .5rem .65rem;
  background: hsl(var(--bg-muted, 40 10% 96%));
  border-radius: var(--radius-sm);
}
.form-check--compact {
  font-size: .85rem;
  gap: .35rem;
}
.study-page .form-panel {
  background:
    radial-gradient(ellipse 80% 50% at 0% 0%, color-mix(in srgb, var(--study-accent) 8%, transparent), transparent 55%),
    hsl(var(--bg-surface));
  border-top: 2px solid color-mix(in srgb, var(--study-accent) 28%, hsl(var(--border-light)));
}
.study-page .timeline-calendar {
  background:
    radial-gradient(ellipse 70% 60% at 100% 0%, color-mix(in srgb, var(--study-accent) 10%, transparent), transparent 58%),
    linear-gradient(160deg, color-mix(in srgb, var(--study-accent) 7%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-surface)) 70%);
  border: 1px solid color-mix(in srgb, var(--study-accent) 14%, hsl(var(--border-light)));
  border-top: 2px solid color-mix(in srgb, var(--study-accent) 34%, hsl(var(--border-light)));
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow), 0 1px 0 hsla(0 0% 100% / .55) inset;
}
.study-page .admin-rights-hint {
  border-left: 3px solid color-mix(in srgb, var(--study-accent) 55%, hsl(var(--border)));
}
.study-stagger > * {
  animation: fadeInUp .55s var(--ease-out) both;
}
.study-stagger > *:nth-child(1) { animation-delay: .04s; }
.study-stagger > *:nth-child(2) { animation-delay: .09s; }
.study-stagger > *:nth-child(3) { animation-delay: .14s; }
.study-stagger > *:nth-child(4) { animation-delay: .19s; }
.study-stagger > *:nth-child(5) { animation-delay: .24s; }
.study-stagger > *:nth-child(6) { animation-delay: .29s; }
.study-stagger > *:nth-child(7) { animation-delay: .34s; }
.study-stagger > *:nth-child(8) { animation-delay: .39s; }
.study-stagger > *:nth-child(9) { animation-delay: .44s; }
.study-stagger > *:nth-child(10) { animation-delay: .49s; }
.study-stagger > *:nth-child(11) { animation-delay: .54s; }
.study-stagger > *:nth-child(12) { animation-delay: .59s; }
@media (max-width: 720px) {
  .study-page__head { padding: 1rem 1.05rem; }
}

/* Study hub dashboard */
.study-hub {
  display: flex; flex-direction: column; gap: var(--section-gap);
  --study-accent: var(--study-color, hsl(var(--accent)));
  --study-hub-ease: cubic-bezier(.22, 1, .36, 1);
  position: relative;
}
.study-hub::before,
.study-hub::after {
  content: "";
  position: absolute; pointer-events: none; z-index: 0;
  border-radius: 50%;
  filter: blur(48px);
}
.study-hub::before {
  top: -1rem; left: -0.5rem;
  width: min(26rem, 65vw); height: min(20rem, 42vh);
  background: radial-gradient(circle, color-mix(in srgb, var(--study-accent) 14%, transparent), transparent 74%);
  opacity: .55;
  animation: blobFloat 22s ease-in-out infinite;
}
.study-hub::after {
  top: 5rem; right: -1rem;
  width: min(20rem, 50vw); height: min(16rem, 34vh);
  background: radial-gradient(circle, hsla(var(--mist), .1), transparent 76%);
  opacity: .42;
  animation: blobFloat 28s ease-in-out infinite reverse;
}
.study-hub > * { position: relative; z-index: 1; }

@keyframes studyHubReveal {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes studyHubGlowShift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: .85; }
  50% { transform: translate3d(3%, -2%, 0) scale(1.06); opacity: 1; }
}
@keyframes studyHubProgressFill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
@keyframes studyHubDotPulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--study-accent) 35%, transparent); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--study-accent) 0%, transparent); }
}
@keyframes studyTimelineDotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .72; }
}
@keyframes studyHubSheen {
  0% { transform: translateX(-120%) skewX(-12deg); }
  55%, 100% { transform: translateX(220%) skewX(-12deg); }
}

.study-hub__reveal {
  opacity: 0;
  animation: studyHubReveal .7s var(--study-hub-ease) both;
  animation-delay: var(--reveal-delay, 0ms);
}

.study-hub__hero {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(14rem, .9fr);
  gap: 1.35rem 1.85rem; align-items: start;
  padding: 1.55rem 1.6rem;
  border-radius: calc(var(--radius) + 2px);
  position: relative; overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(148deg, color-mix(in srgb, var(--study-accent) 10%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-surface)) 58%),
    hsl(var(--bg-surface));
  border: 1px solid color-mix(in srgb, var(--study-accent) 16%, hsl(var(--border-light)));
  border-left: 3px solid var(--study-accent);
  box-shadow:
    var(--shadow),
    var(--shadow-glow),
    0 0 0 1px hsla(0 0% 100% / .5) inset;
}
.study-hub__hero-glow {
  position: absolute; top: -14%; right: -6%; width: 54%; height: 88%;
  background:
    radial-gradient(circle at 40% 40%, color-mix(in srgb, var(--study-accent) 16%, transparent), transparent 74%),
    radial-gradient(circle at 70% 55%, hsla(var(--mist), .1), transparent 70%);
  pointer-events: none; z-index: 0;
  filter: blur(28px); opacity: .65;
  animation: blobFloat 16s ease-in-out infinite;
}
.study-hub__hero > *:not(.study-hub__hero-glow) { position: relative; z-index: 1; }
.study-hub__hero--photo {
  grid-template-columns: minmax(13rem, 1.05fr) minmax(0, 1.3fr) minmax(12rem, .85fr);
  align-items: stretch;
}
.study-hub__motto {
  display: flex; flex-direction: column; gap: .5rem; min-width: 0;
  height: 100%;
}
.study-hub__motto-frame {
  margin: 0; position: relative; border-radius: calc(var(--radius) - 1px);
  overflow: hidden; aspect-ratio: 4 / 3; flex: 1 1 auto; min-height: 10rem;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--study-accent) 12%, hsl(var(--bg-muted))), hsl(var(--bg-muted)));
  box-shadow:
    inset 0 0 0 1px hsla(0 0% 100% / .4),
    0 10px 28px -14px color-mix(in srgb, var(--study-accent) 45%, transparent);
  transform: rotate(-1.4deg);
  transition: transform .45s var(--study-hub-ease), box-shadow .45s var(--study-hub-ease);
}
.study-hub__motto-frame:hover {
  transform: rotate(0deg);
  box-shadow:
    inset 0 0 0 1px hsla(0 0% 100% / .5),
    0 16px 36px -14px color-mix(in srgb, var(--study-accent) 40%, transparent);
}
.study-hub__motto-img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .7s var(--study-hub-ease);
}
.study-hub__motto-frame:hover .study-hub__motto-img { transform: scale(1.04); }
.study-hub__motto-sheen {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, hsla(0 0% 100% / .22) 48%, transparent 62%);
  opacity: 0;
}
.study-hub__motto-frame:hover .study-hub__motto-sheen {
  opacity: 1;
  animation: studyHubSheen 1.1s var(--study-hub-ease) both;
}
.study-hub__motto-caption {
  position: absolute; left: .6rem; right: .6rem; bottom: .55rem;
  padding: .3rem .55rem; border-radius: 8px;
  font-size: .68rem; font-weight: 600; letter-spacing: .02em;
  color: #fff;
  background: linear-gradient(180deg, hsla(220 25% 10% / .25), hsla(220 25% 10% / .62));
  backdrop-filter: blur(8px) saturate(1.1);
  border: 1px solid hsla(0 0% 100% / .12);
  transform: translateY(4px); opacity: .92;
  transition: transform .35s var(--study-hub-ease), opacity .35s ease;
}
.study-hub__motto-frame:hover .study-hub__motto-caption {
  transform: none; opacity: 1;
}
.study-hub__motto-empty {
  appearance: none; width: 100%; min-height: 10rem; flex: 1 1 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .4rem; padding: 1.1rem; text-align: center; cursor: pointer;
  border-radius: calc(var(--radius) - 1px);
  border: 1.5px dashed color-mix(in srgb, var(--study-accent) 45%, hsl(var(--border)));
  background:
    radial-gradient(ellipse 80% 70% at 50% 0%, color-mix(in srgb, var(--study-accent) 10%, transparent), transparent 70%),
    color-mix(in srgb, var(--study-accent) 4%, hsl(var(--bg-surface)));
  color: hsl(var(--text-secondary));
  transform: rotate(-1deg);
  transition: border-color .35s ease, background .35s ease, transform .45s var(--study-hub-ease), color .25s ease;
}
.study-hub__motto-empty:hover {
  border-color: var(--study-accent);
  background:
    radial-gradient(ellipse 80% 70% at 50% 0%, color-mix(in srgb, var(--study-accent) 16%, transparent), transparent 70%),
    color-mix(in srgb, var(--study-accent) 7%, hsl(var(--bg-surface)));
  transform: rotate(0deg); color: hsl(var(--text));
}
.study-hub__motto-empty-icon {
  color: var(--study-accent); opacity: .9;
  transition: transform .35s var(--study-hub-ease);
}
.study-hub__motto-empty:hover .study-hub__motto-empty-icon { transform: scale(1.08); }
.study-hub__motto-empty strong { font-size: .9rem; color: hsl(var(--text)); }
.study-hub__motto-empty span:last-child { font-size: .75rem; max-width: 12rem; line-height: 1.35; }
.study-hub__motto-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem;
}
.study-hub__brand {
  display: flex; align-items: flex-start; gap: .8rem;
}
.study-hub__brand-dot {
  margin-top: .45rem;
  animation: studyHubDotPulse 2.8s ease-in-out infinite;
}
.study-hub__eyebrow {
  margin: 0 0 .25rem; font-size: .72rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--study-accent) 55%, hsl(var(--text-muted)));
}
.study-hub__hero h1 {
  margin: 0;
  font-size: clamp(1.75rem, 3.4vw, 2.35rem);
  letter-spacing: -.035em;
  line-height: 1.12;
  background: linear-gradient(180deg, hsl(var(--text)) 40%, color-mix(in srgb, var(--study-accent) 35%, hsl(var(--text))) 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .study-hub__hero h1 { color: hsl(var(--text)); background: none; }
}
.study-hub__lead {
  margin: .75rem 0 0; color: hsl(var(--text-secondary));
  font-size: .97rem; max-width: 38rem; line-height: 1.55;
}
.study-hub__progress { margin-top: 1.15rem; max-width: 28rem; }
.study-hub__progress-meta {
  display: flex; justify-content: space-between; gap: .75rem;
  font-size: .78rem; margin-bottom: .4rem; color: hsl(var(--text-muted));
}
.study-hub__progress-meta strong { color: hsl(var(--text)); font-variant-numeric: tabular-nums; }
.study-hub__progress-track {
  height: 9px;
  background: color-mix(in srgb, var(--study-accent) 10%, hsl(var(--border-light)));
  box-shadow: inset 0 1px 2px hsla(220 20% 20% / .06);
}
.study-hub__progress-bar {
  width: var(--progress, 0%);
  transform-origin: left center;
  transform: scaleX(0);
  animation: studyHubProgressFill 1.05s var(--study-hub-ease) .35s both;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--study-accent) 85%, #1a3d34),
    var(--study-accent),
    color-mix(in srgb, var(--study-accent) 70%, #7eb8a8)
  );
  box-shadow: 0 0 12px color-mix(in srgb, var(--study-accent) 35%, transparent);
}
.study-hub__hero-side {
  display: flex; flex-direction: column; gap: .9rem; align-items: flex-end;
  justify-content: space-between; min-height: 100%;
}
.study-hub__team { text-align: right; }
.study-hub__team .muted { margin: .4rem 0 0; font-size: .78rem; }
.study-hub__avatars {
  display: flex; justify-content: flex-end;
}
.study-hub__avatars .profile-avatar {
  margin-left: -.4rem;
  box-shadow: 0 0 0 2px hsl(var(--bg-surface));
  transition: transform .3s var(--study-hub-ease), z-index 0s;
}
.study-hub__avatars .profile-avatar:hover {
  transform: scale(1.06); z-index: 2;
}
.study-hub__avatars .profile-avatar:first-child { margin-left: 0; }
.study-hub__avatar-more {
  margin-left: -.2rem; min-width: 1.85rem; height: 1.85rem; padding: 0 .4rem;
  display: inline-grid; place-items: center; border-radius: 999px;
  font-size: .7rem; font-weight: 700; color: hsl(var(--text-secondary));
  background: color-mix(in srgb, var(--study-accent) 8%, hsl(var(--bg-muted)));
  border: 2px solid hsl(var(--bg-surface));
}
.study-hub__actions { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; }
.study-hub__actions .btn-primary {
  box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--study-accent) 55%, transparent);
}

.study-hub__modules {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .7rem; align-items: stretch;
}
.study-hub-mod {
  display: flex; flex-direction: column; gap: .25rem;
  height: 100%; min-height: 6.25rem;
  padding: 1rem 1rem .95rem; border-radius: var(--radius-md);
  position: relative; overflow: hidden; isolation: isolate;
  background:
    linear-gradient(165deg, color-mix(in srgb, var(--study-accent) 9%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-surface)) 58%),
    hsl(var(--bg-surface));
  border: 1px solid color-mix(in srgb, var(--study-accent) 14%, hsl(var(--border-light)));
  border-top: 2px solid color-mix(in srgb, var(--study-accent) 52%, hsl(var(--border-light)));
  color: inherit; text-decoration: none;
  box-shadow: 0 1px 0 hsla(0 0% 100% / .55) inset;
  transition:
    border-color .3s ease,
    transform .4s var(--study-hub-ease),
    box-shadow .35s ease,
    background .35s ease;
}
.study-hub-mod::before {
  content: '';
  position: absolute; top: -16%; right: -10%; width: 64%; height: 82%; z-index: 0;
  background: radial-gradient(circle at 40% 40%, color-mix(in srgb, var(--study-accent) 12%, transparent), transparent 74%);
  filter: blur(18px); opacity: .45; pointer-events: none;
  animation: blobFloat 17s ease-in-out infinite;
}
.study-hub-mod::after {
  content: '';
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(105deg, transparent 38%, hsla(0 0% 100% / .4) 50%, transparent 62%);
  transform: translateX(-130%) skewX(-14deg); opacity: 0;
}
.study-hub-mod > * { position: relative; z-index: 2; }
.study-hub-mod:hover {
  border-color: color-mix(in srgb, var(--study-accent) 40%, hsl(var(--border-light)));
  border-top-color: color-mix(in srgb, var(--study-accent) 82%, hsl(var(--border-light)));
  background:
    linear-gradient(165deg, color-mix(in srgb, var(--study-accent) 14%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-surface)) 62%),
    hsl(var(--bg-surface));
  box-shadow:
    var(--shadow),
    0 12px 28px -14px color-mix(in srgb, var(--study-accent) 42%, transparent);
  color: inherit;
}
.study-hub-mod:hover::before { opacity: .8; }
.study-hub-mod:hover::after {
  opacity: 1;
  animation: surfaceSheen .9s var(--ease-out) both;
}
.study-hub-mod:active { transform: scale(.99); }
.study-hub-mod__label {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: hsl(var(--text-muted));
}
.study-hub-mod__value {
  font-family: var(--font-head); font-size: 1.22rem; font-weight: 700;
  letter-spacing: -.025em; line-height: 1.2;
  color: color-mix(in srgb, var(--study-accent) 22%, hsl(var(--text)));
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  flex: 1 1 auto;
}
.study-hub-mod__hint {
  margin-top: auto;
  font-size: .72rem; color: hsl(var(--text-muted));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.study-hub__focus {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: var(--section-gap); align-items: stretch;
}
.study-hub__focus--collab {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr);
}
.study-hub__stream {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--section-gap); align-items: stretch;
}
.study-hub-panel {
  margin: 0;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(168deg, hsl(var(--bg-surface)) 0%, color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 5%, hsl(var(--bg-surface))) 100%);
  border: 1px solid color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 12%, hsl(var(--border-light)));
  border-top: 2px solid color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 38%, hsl(var(--border-light)));
  box-shadow: 0 1px 0 hsla(0 0% 100% / .5) inset, var(--shadow);
  transition: transform .4s var(--study-hub-ease), box-shadow .35s ease, border-color .3s ease;
}
.study-hub-panel::before {
  content: "";
  position: absolute; top: -10%; right: -6%; width: 50%; height: 58%;
  background: radial-gradient(circle at 75% 15%, color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 16%, transparent), transparent 76%);
  pointer-events: none; opacity: .6;
  border-radius: inherit;
  filter: blur(12px);
  z-index: 0;
  animation: blobFloat 19s ease-in-out infinite;
}
.study-hub-panel > * { position: relative; z-index: 1; }
.study-hub-panel:hover {
  border-color: color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 26%, hsl(var(--border-light)));
  box-shadow:
    var(--shadow-lg),
    0 1px 0 hsla(0 0% 100% / .55) inset;
}
/* Full-page forms (Timeline Add event, Publications): static wash, no drift */
.study-hub-panel.form-wide {
  height: auto;
  overflow: hidden;
  isolation: isolate;
}
.study-hub-panel.form-wide::before {
  opacity: .32;
  animation: none !important;
  filter: blur(16px);
}
.study-hub-panel.form-wide:hover {
  transform: none;
}
.study-hub .panel + .panel { margin-top: 0; }
.study-hub-panel .panel__head {
  gap: .75rem;
  flex-shrink: 0;
  margin-bottom: .7rem;
}
.study-hub-panel .panel__head h2 {
  letter-spacing: -.02em;
}
.study-hub-panel .study-hub-quick { flex-shrink: 0; }
.study-hub-panel .study-hub-tasks,
.study-hub-panel .study-timeline-preview,
.study-hub-panel .study-hub-list {
  flex: 1 1 auto;
  min-height: 0;
}
/* Only stretch empty copy inside equal-height study hub columns — not landing */
.study-hub .study-hub-panel .study-hub-empty {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  margin: 0;
}
.study-hub-panel__tabs {
  display: flex; align-items: center; gap: .35rem; flex-wrap: wrap;
}
.study-hub-panel__tabs .btn-secondary {
  background: hsl(var(--bg-muted));
  border-color: hsl(var(--border));
  color: hsl(var(--text-secondary));
}
.study-hub-panel__tabs .btn-secondary:hover {
  background: color-mix(in srgb, var(--study-accent) 10%, hsl(var(--bg-muted)));
  color: color-mix(in srgb, var(--study-accent) 55%, hsl(var(--text)));
  border-color: color-mix(in srgb, var(--study-accent) 28%, hsl(var(--border)));
}
.study-hub-panel__tabs .btn-secondary.active,
.study-hub-panel__tabs .btn-secondary.is-active,
.study-hub-panel__tabs .btn-secondary[aria-pressed="true"] {
  background: color-mix(in srgb, var(--study-accent) 14%, hsl(var(--bg-muted)));
  color: color-mix(in srgb, var(--study-accent) 70%, hsl(var(--accent)));
  border-color: color-mix(in srgb, var(--study-accent) 32%, hsl(var(--border)));
}
/* Legacy pills in panel tabs — match btn-secondary geometry */
.study-hub-panel__tabs .pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 32px; height: 32px; padding: 0 .65rem;
  border-radius: var(--radius-sm); font-size: .75rem; font-weight: 600;
  border: 1px solid hsl(var(--border)); cursor: pointer;
  background: hsl(var(--bg-muted)); color: hsl(var(--text-secondary));
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.study-hub-panel__tabs .pill:hover {
  background: color-mix(in srgb, var(--study-accent) 10%, hsl(var(--bg-muted)));
  color: color-mix(in srgb, var(--study-accent) 55%, hsl(var(--text)));
  border-color: color-mix(in srgb, var(--study-accent) 28%, hsl(var(--border)));
}
.study-hub-panel__tabs .pill.active {
  background: color-mix(in srgb, var(--study-accent) 14%, hsl(var(--bg-muted)));
  color: color-mix(in srgb, var(--study-accent) 70%, hsl(var(--accent)));
  border-color: color-mix(in srgb, var(--study-accent) 32%, hsl(var(--border)));
}

.study-hub-quick {
  display: flex; gap: .4rem; align-items: center; flex-wrap: wrap;
  margin-bottom: .85rem;
  padding: .55rem .65rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--study-accent) 5%, hsl(var(--bg-muted)));
  border: 1px solid color-mix(in srgb, var(--study-accent) 10%, hsl(var(--border-light)));
}
.study-hub-quick .input { flex: 1; min-width: 8rem; }
.study-hub-quick__date { flex: 0 0 auto; width: auto; max-width: 10rem; }

.study-hub-tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .1rem; }
.study-hub-task {
  display: flex; align-items: center; gap: .55rem;
  padding: .55rem .35rem; margin: 0 -.35rem;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid transparent;
  transition: background .2s ease;
}
.study-hub-task:hover { background: color-mix(in srgb, var(--study-accent) 6%, transparent); }
.study-hub-task:last-child { border-bottom: none; }
.study-hub-task--overdue { background: hsla(0, 60%, 50%, .04); }
.study-hub-task__check {
  flex-shrink: 0; width: 1.5rem; height: 1.5rem; border-radius: 999px;
  border: 1.5px solid hsl(var(--border)); background: hsl(var(--bg-surface));
  display: grid; place-items: center; color: hsl(var(--text-muted)); cursor: pointer;
  transition: border-color .2s ease, background .2s ease, color .2s ease, transform .25s var(--study-hub-ease);
}
.study-hub-task__check:hover:not(:disabled) {
  border-color: var(--study-accent); color: var(--study-accent);
  background: color-mix(in srgb, var(--study-accent) 10%, hsl(var(--bg-surface)));
  transform: scale(1.08);
}
.study-hub-task__check:disabled { opacity: .45; cursor: default; }
.study-hub-task__body {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem;
  color: inherit; text-decoration: none;
}
.study-hub-task__body:hover .study-hub-task__title {
  color: color-mix(in srgb, var(--study-accent) 65%, hsl(var(--accent)));
}
.study-hub-task__title {
  font-size: .9rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .2s ease;
}
.study-hub-task__meta {
  display: flex; flex-wrap: wrap; gap: .4rem .55rem;
  font-size: .72rem; color: hsl(var(--text-muted));
}
.study-hub-task__due--overdue { color: hsl(0 60% 45%); font-weight: 600; }
.study-hub-task--invite {
  align-items: flex-start;
  gap: .5rem;
}
.study-hub-task__invite-mark {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: .1rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: color-mix(in srgb, var(--study-accent) 70%, hsl(var(--text-muted)));
  background: color-mix(in srgb, var(--study-accent) 10%, hsl(var(--bg-muted)));
}
.study-hub-empty--tight {
  flex: 0 0 auto;
  align-items: flex-start;
  margin: .35rem 0 .15rem;
  font-size: .82rem;
}
.study-hub-pending {
  margin-top: .85rem;
  padding-top: .75rem;
  border-top: 1px solid color-mix(in srgb, var(--study-accent) 12%, hsl(var(--border-light)));
}
.study-hub-pending--lead {
  margin-top: .35rem;
  margin-bottom: .35rem;
  padding: .75rem .7rem .55rem;
  border-top: none;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--study-accent) 6%, hsl(var(--bg-muted)));
  border: 1px solid color-mix(in srgb, var(--study-accent) 14%, hsl(var(--border-light)));
}
.study-hub-pending__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .2rem;
}
.study-hub-pending__head h3 {
  margin: 0;
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: -.015em;
  color: hsl(var(--text));
}
.study-hub-pending__hint {
  margin: 0 0 .55rem;
  font-size: .78rem;
  line-height: 1.35;
}
.study-hub-pending__unassigned-head {
  margin: .85rem 0 .35rem;
  padding-top: .65rem;
  border-top: 1px solid color-mix(in srgb, var(--study-accent) 12%, hsl(var(--border-light)));
}
.study-hub-pending__unassigned-head h3 {
  margin: 0;
  font-size: .82rem;
  font-weight: 650;
  letter-spacing: -.01em;
  color: hsl(var(--text-secondary));
}
.study-hub-pending__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  flex-shrink: 0;
  margin-top: .1rem;
}
.study-hub-pending__invite {
  margin-bottom: .55rem;
}
.study-hub-task--invite .study-hub-task__title {
  font-weight: 700;
}
.badge--muted {
  background: hsl(var(--bg-muted));
  color: hsl(var(--text-secondary));
  border: 1px solid hsl(var(--border-light));
}

.study-hub-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .05rem; }
.study-hub-list__item {
  display: flex; flex-direction: column; gap: .12rem;
  padding: .55rem .35rem; margin: 0 -.35rem;
  border-radius: var(--radius-sm);
  color: inherit; text-decoration: none;
  transition: background .2s ease;
}
.study-hub-list__item:hover {
  background: color-mix(in srgb, var(--study-accent) 6%, transparent);
}
.study-hub-list__item:hover .study-hub-list__title {
  color: color-mix(in srgb, var(--study-accent) 65%, hsl(var(--accent)));
}
.study-hub-list__item--static:hover { background: transparent; }
.study-hub-list__item--static:hover .study-hub-list__title { color: inherit; }
.study-hub-list__title {
  font-size: .88rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .2s ease;
}
.study-hub-list__meta { font-size: .72rem; color: hsl(var(--text-muted)); }
.study-hub-pub .progress-mini--card { margin-top: .4rem; }
.study-hub__mini-fill {
  width: var(--progress, 0%) !important;
  transform-origin: left center;
  transform: scaleX(0);
  animation: studyHubProgressFill .9s var(--study-hub-ease) .5s both;
  background: linear-gradient(90deg, var(--study-accent), color-mix(in srgb, var(--study-accent) 65%, #8ecbb8)) !important;
}
.study-hub-empty { font-size: .85rem; }

.study-hub .study-timeline-preview__item {
  margin: 0 -.35rem; padding-left: .85rem; padding-right: .85rem;
  border-radius: var(--radius-sm);
  transition: background .2s ease, transform .25s var(--study-hub-ease);
}
.study-hub .study-timeline-preview__item:hover {
  background: color-mix(in srgb, var(--study-accent) 6%, transparent);
}

@media (max-width: 1100px) {
  .study-hub__modules { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .study-hub__stream { grid-template-columns: 1fr 1fr; }
  .study-hub__hero--photo { grid-template-columns: minmax(0, 1fr) minmax(12rem, .9fr); }
  .study-hub__motto { grid-column: 1 / -1; max-width: 24rem; }
}
@media (max-width: 860px) {
  .study-hub__hero,
  .study-hub__hero--photo { grid-template-columns: 1fr; padding: 1.25rem 1.15rem; }
  .study-hub__motto { max-width: none; }
  .study-hub__motto-frame,
  .study-hub__motto-empty { transform: none; }
  .study-hub__motto-frame:hover { transform: scale(1.01); }
  .study-hub__hero-side { align-items: flex-start; }
  .study-hub__team { text-align: left; }
  .study-hub__avatars { justify-content: flex-start; }
  .study-hub__actions { justify-content: flex-start; }
  .study-hub__focus,
  .study-hub__stream { grid-template-columns: 1fr; }
  .study-hub__modules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .study-hub-panel:hover { transform: none; }
}
@media (max-width: 520px) {
  .study-hub__modules { grid-template-columns: 1fr 1fr; gap: .55rem; }
  .study-hub-mod { min-height: 5.5rem; padding: .85rem .8rem; }
  .study-hub-mod__value { font-size: 1.05rem; }
  .landing-hero__stage {
    margin-top: -2.5rem;
    padding-inline: 0;
    flex-direction: column;
    align-items: stretch;
  }
  .landing-hero__glass {
    margin: 0;
    width: 100%;
    flex: none;
  }
  .landing-posse {
    align-items: center;
    margin-top: .55rem;
  }
  .landing-posse__deck {
    --posse-card-w: clamp(4.6rem, 17vw, 5.8rem);
    width: min(100%, calc(var(--posse-card-w) * 6.2));
  }
  .landing-posse__card:nth-child(1) { --posse-x: -8.2rem; --posse-rot: -20deg; }
  .landing-posse__card:nth-child(2) { --posse-x: -4.9rem; --posse-rot: -12deg; }
  .landing-posse__card:nth-child(3) { --posse-x: -1.65rem; --posse-rot: -4deg; }
  .landing-posse__card:nth-child(4) { --posse-x: 1.65rem; --posse-rot: 4deg; }
  .landing-posse__card:nth-child(5) { --posse-x: 4.9rem; --posse-rot: 12deg; }
  .landing-posse__card:nth-child(6) { --posse-x: 8.2rem; --posse-rot: 20deg; }
  .landing-hero__row .landing-cta { width: 100%; min-height: var(--touch-min); }
  .landing-active__label { width: auto; }
  .landing-tasks--with-team { grid-template-columns: 1fr; }
  .study-grid { grid-template-columns: 1fr; }
  .study-card { min-height: 0; }
  .quick-task-form { flex-direction: column; align-items: stretch; }
  .quick-task-form .input,
  .quick-task-form .select,
  .quick-task-form__date,
  .quick-task-form .btn { width: 100%; max-width: none; min-height: var(--touch-min); }
  .study-nav__tab { min-height: var(--touch-min); padding: .5rem .85rem; }
  .my-tasks-panel__tools { width: 100%; }
  .study-hub-panel .panel__head { align-items: flex-start; }
  .study-hub__focus,
  .study-hub__stream,
  .study-hub-panel { height: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .study-hub__reveal,
  .study-hub__hero-glow,
  .study-hub__brand-dot,
  .study-hub__progress-bar,
  .study-hub__mini-fill,
  .study-hub__motto-frame:hover .study-hub__motto-sheen,
  .study-hub::before,
  .study-hub::after,
  .landing-hero,
  .landing-hero__band,
  .landing-hero__glass,
  .landing-hero__glass::after,
  .landing-posse,
  .landing-studies,
  .landing-tasks,
  .study-page__head::before,
  .study-page__head::after {
    animation: none !important;
  }
  .landing-posse__card,
  .landing-posse__card:has(> .landing-posse__open:hover),
  .landing-posse__card:has(> .landing-posse__open:focus-visible) {
    transition: none !important;
  }
  .landing-hero,
  .landing-hero__band,
  .landing-hero__glass,
  .landing-studies,
  .landing-tasks { opacity: 1; transform: none; }
  .study-hub__reveal { opacity: 1; transform: none; }
  .study-hub__progress-bar,
  .study-hub__mini-fill { transform: none; width: var(--progress, 0%); }
  .study-hub-mod:hover,
  .study-hub-panel:hover,
  .study-hub__motto-frame,
  .study-hub__motto-frame:hover,
  .study-hub__motto-empty { transform: none; }
}

.cockpit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--section-gap);
}
.cockpit-widget__body { margin: 0; }
.cockpit-stat { font-size: 1.1rem; font-weight: 600; margin: .25rem 0 0; }
.cockpit-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: var(--section-gap); }
.checklist-list { list-style: none; padding: 0; margin: 0; }
.checklist-item { padding: .4rem 0; border-bottom: 1px solid hsl(var(--border)); }
.checklist-item__label { display: flex; align-items: center; gap: .6rem; cursor: pointer; }
.checklist-item__done { text-decoration: line-through; color: hsl(var(--text-muted)); }
.dataset-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.dataset-table th, .dataset-table td { padding: .6rem 1rem; text-align: left; border-bottom: 1px solid hsl(var(--border)); }
.my-task-item--overdue .my-task-item { border-color: hsl(0 70% 85%); background: hsl(0 70% 98%); }
.my-task-item__due--overdue { color: hsl(0 60% 45%); font-weight: 600; }
.publication-item--expanded { flex-direction: column; align-items: stretch; gap: .35rem; }
.publication-item__meta { display: flex; flex-wrap: wrap; gap: .35rem; }
.publication-authors {
  margin-top: .5rem; padding-top: .5rem;
  border-top: 1px dashed hsl(var(--border-light));
}
.publication-authors__head {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  flex-wrap: wrap; margin-bottom: .35rem;
}
.publication-authors__title { font-size: .8rem; font-weight: 600; margin: 0; }
.publication-authors__head-actions { display: flex; align-items: center; gap: .5rem; }
.publication-authors__list { list-style: none; padding: 0; margin: 0 0 .5rem; display: flex; flex-direction: column; gap: .35rem; }
.publication-authors__empty { font-size: .78rem; margin: 0 0 .5rem; }
.publication-authors--readonly { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; width: 100%; margin-top: .35rem; }
.publication-authors__label { font-size: .75rem; font-weight: 600; }
.publication-author-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .75rem; line-height: 1.2; padding: .2rem .55rem; border-radius: 999px;
  color: hsl(var(--text));
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--author-color, hsl(var(--accent))) 22%, hsl(var(--bg-surface))) 0%,
      color-mix(in srgb, var(--author-color, hsl(var(--accent))) 8%, hsl(var(--bg-surface))) 100%);
  border: 1px solid color-mix(in srgb, var(--author-color, hsl(var(--accent))) 32%, hsl(var(--border-light)));
}
.publication-author-chip .profile-avatar {
  line-height: 1;
  align-self: center;
}
.publication-author-chip__name {
  line-height: 1.2;
  display: inline-flex; align-items: center;
}
.publication-author-chip__order {
  font-weight: 700; font-size: .68rem; opacity: .75; line-height: 1;
}
.publication-author-chip__share {
  font-variant-numeric: tabular-nums; line-height: 1.2;
  color: color-mix(in srgb, var(--author-color, hsl(var(--accent))) 72%, hsl(var(--text)));
}
.publication-author-chip__approved {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1rem; height: 1rem; border-radius: 999px; flex-shrink: 0;
  color: hsl(152, 45%, 28%);
  background: hsla(152, 55%, 40%, .16);
  border: 1px solid hsla(152, 55%, 40%, .28);
}
.publication-author-chip__approved svg {
  width: .65rem; height: .65rem;
  display: block;
}
.publication-shares-total {
  font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums;
  padding: .15rem .5rem; border-radius: 999px;
  border: 1px solid hsl(var(--border-light));
}
.publication-shares-total.is-complete {
  background: linear-gradient(135deg, hsla(152, 55%, 40%, .16), hsla(158, 48%, 34%, .08));
  color: hsl(152, 55%, 28%);
  border-color: hsla(152, 55%, 40%, .3);
}
.publication-shares-total.is-incomplete {
  background: linear-gradient(135deg, hsla(32, 90%, 48%, .16), hsla(28, 70%, 46%, .08));
  color: hsl(28, 70%, 32%);
  border-color: hsla(32, 90%, 48%, .35);
}
.publication-share-bars {
  position: relative;
  width: 100%; height: 10px; border-radius: 999px; overflow: hidden;
  background: color-mix(in srgb, hsl(var(--border-light)) 85%, hsl(var(--bg-surface)));
  margin: .35rem 0 .65rem;
  box-shadow: inset 0 1px 2px hsla(0, 0%, 0%, .06);
}
.publication-share-bars--readonly {
  flex: 1 1 100%;
  min-width: 8rem;
  height: 8px;
  margin: .2rem 0 .15rem;
  order: 1;
}
.publication-authors--readonly .publication-authors__label { order: 0; }
.publication-authors--readonly .publication-author-chip { order: 2; }
.publication-authors--readonly .publication-shares-total { order: 3; }
.publication-share-bars::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, hsla(0, 0%, 100%, .28), transparent 55%);
  pointer-events: none;
  border-radius: inherit;
}
.publication-share-bar {
  height: 100%; width: var(--share, 0%);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--author-color, hsl(var(--accent))) 70%, white),
    var(--author-color, hsl(var(--accent))) 55%,
    color-mix(in srgb, var(--author-color, hsl(var(--accent))) 82%, black));
  min-width: 0;
}
.publication-shares-hint { font-size: .75rem; margin: 0 0 .55rem; }
.publication-shares-hint.is-ok { color: hsl(152, 45%, 32%); }
.publication-shares-hint.is-warn { color: hsl(28, 70%, 36%); }
.publication-author-row {
  display: flex; align-items: center; gap: .45rem .55rem; flex-wrap: wrap;
  padding: .4rem .5rem .4rem .55rem; border-radius: 8px;
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--author-color, hsl(var(--border-light))) 18%, hsl(var(--surface-elevated, var(--bg)))) 0%,
      hsl(var(--surface-elevated, var(--bg))) 3rem);
  border: 1px solid color-mix(in srgb, var(--author-color, hsl(var(--border-light))) 22%, hsl(var(--border-light)));
  box-shadow: inset 3px 0 0 0 var(--author-color, hsl(var(--border-light)));
}
.publication-author-row--share { align-items: center; }
.publication-author-row__who {
  display: inline-flex; align-items: center; gap: .4rem;
  min-width: 0; flex: 1 1 9rem;
}
.publication-author-row__order {
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .75rem; line-height: 1;
  min-width: 1.1rem; text-align: center; flex-shrink: 0;
}
.publication-author-row__swatch {
  width: .7rem; height: .7rem; border-radius: 999px; flex-shrink: 0;
  align-self: center;
  background: linear-gradient(145deg,
    color-mix(in srgb, var(--author-color, hsl(var(--accent))) 65%, white),
    var(--author-color, hsl(var(--accent))) 48%,
    color-mix(in srgb, var(--author-color, hsl(var(--accent))) 78%, black));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--author-color, hsl(var(--accent))) 35%, transparent);
}
.publication-author-row__avatar {
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; line-height: 0;
}
.publication-author-row__avatar .profile-avatar { line-height: 1; }
.publication-author-row__main {
  flex: 1 1 12rem; min-width: 8rem;
  display: flex; flex-wrap: wrap; gap: .35rem; align-items: center;
}
.publication-author-row__name {
  font-size: .82rem; line-height: 1.2; font-weight: 600;
  min-width: 0; display: inline-flex; align-items: center;
}
.publication-author-approval {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .72rem; line-height: 1.2; font-weight: 500; color: hsl(var(--text-muted));
  cursor: pointer; user-select: none; white-space: nowrap;
}
.publication-author-approval input {
  margin: 0; width: .85rem; height: .85rem; accent-color: hsl(152, 45%, 36%);
  flex-shrink: 0;
}
.publication-author-row__actions {
  display: inline-flex; align-items: center; gap: .15rem; flex-shrink: 0;
}
.publication-share-field {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .8rem; font-weight: 600; color: hsl(var(--text-muted));
}
.publication-share-meter {
  width: 2.4rem; height: .45rem; border-radius: 999px; overflow: hidden; flex-shrink: 0;
  background: color-mix(in srgb, hsl(var(--border-light)) 80%, hsl(var(--bg-surface)));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--author-color, hsl(var(--accent))) 18%, transparent);
}
.publication-share-meter::after {
  content: "";
  display: block; height: 100%; width: var(--share, 0%);
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--author-color, hsl(var(--accent))) 55%, white),
    var(--author-color, hsl(var(--accent))));
  transition: width .35s var(--ease-out, ease);
}
.publication-share-input {
  width: 4.5rem; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600;
}
@media (max-width: 640px) {
  .publication-share-bars { height: 12px; }
  .publication-share-meter { width: 2rem; }
  .publication-author-row__swatch { width: .85rem; height: .85rem; }
}
@media (prefers-reduced-motion: reduce) {
  .publication-share-meter::after { transition: none; }
}
.publication-author-add {
  display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-bottom: .5rem;
}
.publication-authorship-notes-label { margin-top: .25rem; }
.publication-authorship-notes { width: 100%; resize: vertical; min-height: 2.5rem; }
.publication-authorship-notes.muted { font-size: .78rem; margin: .25rem 0 0; white-space: pre-wrap; }
.badge--revision {
  font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--study-color, hsl(var(--accent))) 12%, transparent);
  color: var(--study-color, hsl(var(--accent)));
  border: 1px solid color-mix(in srgb, var(--study-color, hsl(var(--accent))) 28%, transparent);
}
.publication-revisions {
  margin-top: .35rem;
  padding-top: .45rem;
  border-top: 1px solid hsl(var(--border-light));
}
.publication-revisions__head {
  display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .75rem;
  justify-content: space-between;
}
.publication-revisions__create {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; flex: 1;
  min-width: 12rem; justify-content: flex-end;
}
.publication-revisions__create .input { flex: 1; min-width: 10rem; max-width: 22rem; }
.publication-revisions__panel { margin-top: .55rem; }
.publication-revisions__hint { font-size: .75rem; margin: 0 0 .55rem; }
.publication-revisions__list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: .45rem;
}
.publication-revisions__item {
  padding: .55rem .7rem; border-radius: var(--radius-sm);
  border: 1px solid hsl(var(--border-light));
  background: hsla(var(--bg-base), .45);
}
.publication-revisions__item--current {
  border-color: color-mix(in srgb, var(--study-color, hsl(var(--accent))) 40%, transparent);
}
.publication-revisions__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .8rem;
}
.publication-revisions__badge {
  font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--study-color, hsl(var(--accent)));
}
.publication-revisions__note { margin: .3rem 0 .15rem; font-size: .85rem; }
.publication-revisions__snapshot { margin: 0 0 .35rem; font-size: .75rem; }
.activity-item--static { display: block; padding: .5rem 1rem; border-bottom: 1px solid hsl(var(--border)); }

/* Study timeline */
.timeline-today-header {
  margin: .5rem 0 0;
  font-size: .88rem;
  font-weight: 600;
  color: color-mix(in srgb, var(--study-accent) 75%, hsl(var(--text)));
}

.study-timeline-head__meta { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.study-timeline-head__today-chip {
  display: inline-flex; align-items: center;
  padding: .2rem .65rem;
  border-radius: 999px;
  font-size: .75rem; font-weight: 700;
  letter-spacing: .02em;
  color: color-mix(in srgb, var(--study-accent) 80%, hsl(var(--text)));
  background: color-mix(in srgb, var(--study-accent) 12%, hsl(var(--bg-surface)));
  border: 1px solid color-mix(in srgb, var(--study-accent) 22%, transparent);
  box-shadow: 0 1px 0 hsla(0 0% 100% / .45) inset;
}

.study-timeline-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.15rem 1.2rem 1.25rem;
}
.study-timeline-panel.form-wide:hover { transform: none; }
.study-timeline-shell {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}
.study-timeline-section { min-width: 0; }
.study-timeline-section__label {
  margin: 0 0 .7rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--study-accent) 55%, hsl(var(--text-muted)));
}
.study-timeline-loading { margin: 0; padding: .35rem 0; }
.study-timeline-readonly-note {
  margin: 0;
  padding-top: .85rem;
  border-top: 1px dashed color-mix(in srgb, var(--study-accent) 18%, hsl(var(--border-light)));
  font-size: .82rem;
}

.study-timeline-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .35rem;
  padding: 2rem 1.25rem;
  border-radius: calc(var(--radius) + 2px);
  background:
    radial-gradient(ellipse 55% 70% at 50% 0%, color-mix(in srgb, var(--study-accent) 10%, transparent), transparent 70%),
    linear-gradient(180deg, color-mix(in srgb, var(--study-accent) 4%, hsl(var(--bg-muted))) 0%, hsl(var(--bg-surface)) 100%);
  border: 1px dashed color-mix(in srgb, var(--study-accent) 22%, hsl(var(--border-light)));
}
.study-timeline-empty__icon {
  display: grid; place-items: center;
  width: 3.25rem; height: 3.25rem;
  margin-bottom: .35rem;
  border-radius: 999px;
  color: color-mix(in srgb, var(--study-accent) 70%, hsl(var(--text-muted)));
  background: color-mix(in srgb, var(--study-accent) 10%, hsl(var(--bg-surface)));
  border: 1px solid color-mix(in srgb, var(--study-accent) 18%, transparent);
  box-shadow: 0 1px 0 hsla(0 0% 100% / .5) inset;
}
.study-timeline-empty__title {
  margin: 0;
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: hsl(var(--text));
}
.study-timeline-empty__hint { margin: 0; font-size: .85rem; max-width: 22rem; }

/* Month calendar strip */
.timeline-calendar {
  margin-bottom: 0;
  padding: 1.1rem 1.15rem 1.15rem;
  border-radius: calc(var(--radius) + 2px);
  background: hsl(var(--bg-surface));
  border: 1px solid hsl(var(--border-light));
  position: relative;
  overflow: hidden;
}
.timeline-calendar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .85rem;
}
.timeline-calendar__title-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .12rem;
  flex: 1;
  min-width: 0;
}
.timeline-calendar__eyebrow {
  margin: 0;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--study-accent) 50%, hsl(var(--text-muted)));
}
.timeline-calendar__nav {
  flex-shrink: 0;
  color: hsl(var(--text-muted));
  border-radius: 999px;
  transition: color var(--transition), background var(--transition);
}
.timeline-calendar__nav:hover {
  color: color-mix(in srgb, var(--study-accent) 70%, hsl(var(--text)));
  background: color-mix(in srgb, var(--study-accent) 10%, transparent);
}
.timeline-calendar__today-btn {
  font-size: .72rem;
  padding: .12rem .55rem;
  margin-top: .1rem;
  border-radius: 999px;
  color: color-mix(in srgb, var(--study-accent) 80%, hsl(var(--text)));
}
.timeline-calendar__month {
  font-family: var(--font-head);
  font-size: 1.12rem;
  font-weight: 700;
  margin: 0;
  text-align: center;
  letter-spacing: -.02em;
}
.timeline-calendar__weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-bottom: .4rem;
}
.timeline-calendar__weekday {
  font-size: .66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: hsl(var(--text-muted));
  text-align: center;
  padding: .25rem 0;
}
.timeline-calendar__grid { display: flex; flex-direction: column; gap: 3px; }
.timeline-calendar__week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.timeline-day {
  position: relative;
  min-height: 3.25rem;
  padding: .35rem .25rem .4rem;
  border-radius: var(--radius-sm);
  text-align: center;
  background: color-mix(in srgb, hsl(var(--bg-muted)) 70%, hsl(var(--bg-surface)));
  border: 1px solid transparent;
  transition: background .25s var(--ease-out), border-color .25s ease, box-shadow .25s ease;
}
.timeline-day--outside { opacity: .22; pointer-events: none; }
.timeline-day--past { color: hsl(var(--text-muted)); }
.timeline-day--upcoming { color: hsl(var(--text)); }
.timeline-day--has-events {
  background: color-mix(in srgb, var(--study-accent) 6%, hsl(var(--bg-surface)));
  border-color: color-mix(in srgb, var(--study-accent) 12%, transparent);
}
.timeline-day--today {
  background: color-mix(in srgb, hsl(4 72% 52%) 8%, hsl(var(--bg-surface)));
  border-color: color-mix(in srgb, hsl(4 72% 52%) 28%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, hsl(4 72% 52%) 10%, transparent);
}
.timeline-day--has-events .timeline-day__num { font-weight: 700; }
.timeline-day__num {
  display: block;
  font-size: .84rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  font-family: var(--font-head);
}
.timeline-day--today .timeline-day__num {
  display: inline-grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  margin: 0 auto;
  border-radius: 50%;
  background: hsl(4 72% 52%);
  color: #fff;
  font-weight: 800;
  box-shadow:
    0 0 0 3px color-mix(in srgb, hsl(4 72% 52%) 18%, transparent),
    0 2px 8px color-mix(in srgb, hsl(4 72% 52%) 35%, transparent);
}
.timeline-day--today .timeline-day__today-badge {
  color: hsl(4 65% 42%);
}
.timeline-day--today .timeline-day__dot {
  background: hsl(4 72% 52%);
}
.timeline-day__dots {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin-top: .22rem;
  min-height: 6px;
}
.timeline-day__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: hsl(var(--accent));
  box-shadow: 0 0 0 1px hsla(0 0% 100% / .35);
  flex-shrink: 0;
}
.timeline-day__dot--milestone {
  background: hsl(158 40% 36%);
  border-radius: 1px;
  transform: rotate(45deg);
}
.timeline-day__dot--deadline {
  background: hsl(10 58% 46%);
  border-radius: 50%;
}
.timeline-day__dot--meeting {
  background: hsl(205 32% 42%);
  border-radius: 2px;
}
.timeline-day__dot--review {
  background: hsl(36 48% 42%);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  border-radius: 0;
  box-shadow: none;
}
.timeline-day__dot--task {
  background: hsl(192 38% 38%);
  border-radius: 1px;
}
.timeline-day__dot--other {
  background: transparent;
  border: 1.5px solid hsl(150 6% 48%);
  box-shadow: none;
}
.timeline-day__today-badge {
  display: block;
  font-size: .55rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: color-mix(in srgb, var(--study-accent) 78%, hsl(var(--text)));
  margin-top: .15rem;
  line-height: 1;
}

/* Countdown badges */
.timeline-countdown {
  display: inline-flex;
  align-items: center;
  font-size: .68rem;
  font-weight: 700;
  padding: .18rem .55rem;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: .01em;
  border: 1px solid transparent;
}
.timeline-countdown--upcoming {
  color: hsl(158 42% 26%);
  background: hsla(158, 48%, 40%, .12);
  border-color: hsla(158, 48%, 40%, .16);
}
.timeline-countdown--today {
  color: color-mix(in srgb, var(--study-accent) 85%, hsl(var(--text)));
  background: color-mix(in srgb, var(--study-accent) 14%, transparent);
  border-color: color-mix(in srgb, var(--study-accent) 22%, transparent);
}
.timeline-countdown--overdue {
  color: hsl(8 58% 36%);
  background: hsla(8, 60%, 50%, .12);
  border-color: hsla(8, 60%, 50%, .18);
}
.timeline-countdown--done {
  color: hsl(var(--text-muted));
  background: color-mix(in srgb, hsl(var(--text-muted)) 12%, transparent);
}
.timeline-countdown--prominent {
  font-size: .75rem;
  padding: .22rem .6rem;
  min-width: 5.5rem;
  justify-content: center;
  flex-shrink: 0;
}

/* Event type icons: fixed chip + SVG masks (shape varies by type) */
.timeline-event-icon {
  --tl-icon-color: hsl(158 40% 32%);
  --tl-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l8 9-8 9-8-9z'/%3E%3C/svg%3E");
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  flex-shrink: 0;
  color: var(--tl-icon-color);
  background: color-mix(in srgb, var(--tl-icon-color) 12%, hsl(var(--bg-muted)));
  border: 1px solid color-mix(in srgb, var(--tl-icon-color) 20%, transparent);
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, color .15s ease;
}
.timeline-event-icon::before {
  content: '';
  display: block;
  width: .84rem;
  height: .84rem;
  background-color: currentColor;
  -webkit-mask: var(--tl-icon) center / contain no-repeat;
  mask: var(--tl-icon) center / contain no-repeat;
}
.timeline-event-icon--inline {
  width: 1.1rem;
  height: 1.1rem;
  vertical-align: -2px;
  margin-right: .25rem;
}
.timeline-event-icon--inline::before {
  width: .62rem;
  height: .62rem;
}
.timeline-event-icon--milestone {
  --tl-icon-color: hsl(158 40% 32%);
  --tl-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l8 9-8 9-8-9z'/%3E%3C/svg%3E");
  border-radius: 4px;
  transform: none;
}
.timeline-event-icon--deadline {
  --tl-icon-color: hsl(10 58% 44%);
  --tl-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Cpath d='M12 8v4l2.5 1.5'/%3E%3C/svg%3E");
  border-radius: 999px;
  background: color-mix(in srgb, var(--tl-icon-color) 14%, hsl(var(--bg-muted)));
}
.timeline-event-icon--meeting {
  --tl-icon-color: hsl(205 32% 40%);
  --tl-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3'/%3E%3Ccircle cx='16.5' cy='9' r='2.2'/%3E%3Cpath d='M3.5 18c.6-2.6 2.8-4 5.5-4s4.9 1.4 5.5 4'/%3E%3Cpath d='M15 14.2c1.7.2 3.2 1.2 3.8 3.3'/%3E%3C/svg%3E");
  border-radius: 6px;
}
.timeline-event-icon--review {
  --tl-icon-color: hsl(36 48% 40%);
  --tl-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 4h8a2 2 0 012 2v14l-6-3-6 3V6a2 2 0 012-2z'/%3E%3Cpath d='M10 10h4M10 13h2.5'/%3E%3C/svg%3E");
  border-radius: 5px;
  clip-path: none;
}
.timeline-event-icon--task {
  --tl-icon-color: hsl(192 38% 36%);
  --tl-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='16' rx='2'/%3E%3Cpath d='M8 12l2.5 2.5L16 9'/%3E%3C/svg%3E");
  border-radius: 3px;
  background: color-mix(in srgb, var(--tl-icon-color) 14%, hsl(var(--bg-muted)));
}
.timeline-event-icon--other {
  --tl-icon-color: hsl(150 6% 46%);
  --tl-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3.2'/%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3C/svg%3E");
  border-radius: 999px;
  border-style: dashed;
  background: color-mix(in srgb, var(--tl-icon-color) 8%, hsl(var(--bg-muted)));
}
.timeline-event-icon--publication {
  --tl-icon-color: hsl(158 36% 34%);
  --tl-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 5.5A2.5 2.5 0 017.5 3H19v16H7.5A2.5 2.5 0 005 16.5v-11z'/%3E%3Cpath d='M5 16.5A2.5 2.5 0 017.5 19H19'/%3E%3Cpath d='M9 8h6M9 12h4'/%3E%3C/svg%3E");
  background: hsla(158, 36%, 40%, .12);
}

.badge--publication {
  background: hsla(168, 40%, 40%, .12);
  color: hsl(168 35% 32%);
}
.badge--kanban {
  background: hsla(200, 42%, 42%, .12);
  color: hsl(200 38% 34%);
}
.timeline-assignee {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .72rem;
  font-weight: 600;
  padding: .1rem .45rem .1rem .2rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--profile-color, hsl(var(--text-muted))) 14%, transparent);
  color: var(--profile-color, hsl(var(--text-muted)));
}
.timeline-assignee .profile-avatar { margin: 0; }
.study-timeline__link {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition);
}
.study-timeline__link:hover {
  color: color-mix(in srgb, var(--study-accent) 70%, hsl(var(--text)));
  text-decoration: none;
}
.kanban-detail-panel__timeline-hint {
  font-size: .78rem;
  margin: -.25rem 0 .75rem;
}

.study-timeline {
  --tl-pad: 1.85rem;
  --tl-spine-x: 9px; /* center of vertical rail */
  --tl-spine-w: 2px;
  --tl-dot: 10px;
  position: relative;
  padding: .35rem 0 .35rem var(--tl-pad);
  margin: 0;
}
.study-timeline::before {
  content: '';
  position: absolute;
  left: calc(var(--tl-spine-x) - var(--tl-spine-w) / 2);
  top: .15rem;
  bottom: .15rem;
  width: var(--tl-spine-w);
  border-radius: 999px;
  background: linear-gradient(
    to bottom,
    color-mix(in srgb, var(--study-accent) 55%, transparent),
    color-mix(in srgb, var(--study-accent) 18%, transparent) 55%,
    color-mix(in srgb, var(--study-accent) 8%, transparent)
  );
}
.study-timeline--grouped { padding-top: .15rem; }
.study-timeline__date-group {
  position: relative;
  margin-bottom: 1.65rem;
}
.study-timeline__date-group:last-of-type { margin-bottom: .5rem; }
.study-timeline__date-group--today .study-timeline__date-heading {
  color: color-mix(in srgb, var(--study-accent) 78%, hsl(var(--text)));
}
.study-timeline__date-group--past .study-timeline__date-heading {
  color: hsl(var(--text-muted));
}
.study-timeline__date-header {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin-bottom: .85rem;
  padding: .15rem 0 .55rem;
  border-bottom: 1px solid color-mix(in srgb, var(--study-accent) 12%, hsl(var(--border-light)));
  position: relative;
}
.study-timeline__date-rail {
  width: 1.65rem;
  height: 2px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--study-accent) 35%, hsl(var(--border-light)));
  flex-shrink: 0;
}
.study-timeline__date-group--today .study-timeline__date-header {
  border-bottom-color: color-mix(in srgb, var(--study-accent) 32%, hsl(var(--border-light)));
}
.study-timeline__date-group--today .study-timeline__date-rail {
  background: var(--study-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--study-accent) 18%, transparent);
}
.study-timeline__date-heading {
  font-family: var(--font-head);
  font-size: .98rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
  letter-spacing: -.02em;
}
.study-timeline__date-events {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.study-timeline__today-line { display: none; }
.study-timeline__block { display: contents; }
.study-timeline__now {
  position: relative;
  height: 1.1rem;
  margin: .15rem 0 .95rem;
  z-index: 4;
}
.study-timeline__now-tick {
  position: absolute;
  left: calc(var(--tl-spine-x) - var(--tl-pad) - 8px);
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: hsl(4 72% 52%);
  box-shadow:
    0 0 0 3px color-mix(in srgb, hsl(4 72% 52%) 18%, transparent),
    0 0 10px color-mix(in srgb, hsl(4 72% 52%) 40%, transparent);
}
.study-timeline__now-tick::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: hsl(4 72% 52%);
  border: 2px solid hsl(var(--bg-surface));
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px color-mix(in srgb, hsl(4 72% 52%) 25%, transparent);
}
.study-timeline__now-label {
  position: absolute;
  left: calc(var(--tl-pad) + .15rem);
  top: 50%;
  transform: translateY(-50%);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: hsl(4 65% 40%);
  background: color-mix(in srgb, hsl(4 72% 52%) 10%, hsl(var(--bg-surface)));
  border: 1px solid color-mix(in srgb, hsl(4 72% 52%) 22%, transparent);
  border-radius: 999px;
  padding: .12rem .5rem;
  line-height: 1.2;
}
.study-timeline__event {
  position: relative;
  display: flex;
  gap: 1rem;
  margin-bottom: 0;
  padding-bottom: 0;
}
/* Spine marker: shape + color by event type */
.study-timeline__marker {
  --tl-dot-core: hsl(158 40% 34%);
  position: absolute;
  left: calc(var(--tl-spine-x) - var(--tl-dot) / 2 - var(--tl-pad));
  top: .95rem;
  width: var(--tl-dot);
  height: var(--tl-dot);
  border-radius: 50%;
  background: var(--tl-dot-core);
  border: 2px solid hsl(var(--bg-surface));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--tl-dot-core) 22%, transparent),
    0 0 8px color-mix(in srgb, var(--tl-dot-core) 28%, transparent);
  flex-shrink: 0;
  z-index: 2;
  pointer-events: none;
}
/* Milestone: diamond */
.study-timeline__event--milestone .study-timeline__marker {
  --tl-dot-core: hsl(158 40% 34%);
  border-radius: 2px;
  transform: rotate(45deg);
  width: calc(var(--tl-dot) - 1px);
  height: calc(var(--tl-dot) - 1px);
  left: calc(var(--tl-spine-x) - (var(--tl-dot) - 1px) / 2 - var(--tl-pad));
}
/* Deadline: circle + outer ring */
.study-timeline__event--deadline .study-timeline__marker,
.study-timeline__event--overdue .study-timeline__marker {
  --tl-dot-core: hsl(10 58% 44%);
  border-radius: 50%;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--tl-dot-core) 28%, transparent),
    0 0 0 3px color-mix(in srgb, var(--tl-dot-core) 14%, transparent),
    0 0 8px color-mix(in srgb, var(--tl-dot-core) 30%, transparent);
}
/* Meeting: soft rounded square */
.study-timeline__event--meeting .study-timeline__marker {
  --tl-dot-core: hsl(205 32% 40%);
  border-radius: 3px;
}
/* Review: hexagon */
.study-timeline__event--review .study-timeline__marker {
  --tl-dot-core: hsl(36 48% 40%);
  border-radius: 0;
  border-width: 0;
  width: calc(var(--tl-dot) + 2px);
  height: calc(var(--tl-dot) + 2px);
  left: calc(var(--tl-spine-x) - (var(--tl-dot) + 2px) / 2 - var(--tl-pad));
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  box-shadow: 0 0 8px color-mix(in srgb, var(--tl-dot-core) 28%, transparent);
}
/* Task: sharp square */
.study-timeline__event--task .study-timeline__marker {
  --tl-dot-core: hsl(192 38% 36%);
  border-radius: 1px;
}
/* Other: hollow ring */
.study-timeline__event--other .study-timeline__marker {
  --tl-dot-core: transparent;
  background: hsl(var(--bg-surface));
  border: 2.5px solid hsl(150 6% 48%);
  border-radius: 50%;
  box-shadow: none;
}
.study-timeline__event--overdue .study-timeline__marker {
  animation: studyTimelineDotPulse 2.8s ease-in-out infinite;
}
.study-timeline__event--today .study-timeline__marker {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--tl-dot-core, var(--study-accent)) 30%, transparent),
    0 0 12px color-mix(in srgb, var(--tl-dot-core, var(--study-accent)) 40%, transparent);
}
.study-timeline__event--today.study-timeline__event--other .study-timeline__marker {
  border-color: var(--study-accent, hsl(158 40% 34%));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--study-accent) 16%, transparent);
}
.study-timeline__body {
  --tl-type: var(--study-accent, hsl(158 40% 34%));
  flex: 1;
  min-width: 0;
  padding: .8rem .95rem .85rem;
  border-radius: calc(var(--radius-sm) + 2px);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(155deg, color-mix(in srgb, var(--tl-type) 7%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-surface)) 62%);
  border: 1px solid color-mix(in srgb, var(--tl-type) 14%, hsl(var(--border-light)));
  border-left: 3px solid color-mix(in srgb, var(--tl-type) 72%, hsl(var(--border-light)));
  box-shadow: 0 1px 0 hsla(0 0% 100% / .5) inset, 0 6px 18px -14px rgba(20, 40, 35, .14);
  transition: border-color .3s ease, box-shadow .3s ease, background .3s ease;
}
.study-timeline__sheen {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: linear-gradient(105deg, transparent 35%, hsla(0 0% 100% / .18) 48%, transparent 62%);
  opacity: 0;
}
.study-timeline__body > *:not(.study-timeline__sheen) { position: relative; z-index: 1; }
.study-timeline__event:hover .study-timeline__body {
  border-color: color-mix(in srgb, var(--tl-type) 28%, hsl(var(--border-light)));
  box-shadow: 0 1px 0 hsla(0 0% 100% / .55) inset, 0 10px 28px -16px color-mix(in srgb, var(--tl-type) 35%, transparent);
}
.study-timeline__event:hover .study-timeline__sheen {
  opacity: 1;
  animation: studyHubSheen 1.05s var(--ease-out) both;
}
.study-timeline__event--milestone .study-timeline__body {
  --tl-type: hsl(158 40% 34%);
  border-left-width: 4px;
}
.study-timeline__event--deadline .study-timeline__body {
  --tl-type: hsl(10 58% 44%);
  border-left-width: 4px;
  background:
    linear-gradient(155deg, color-mix(in srgb, var(--tl-type) 9%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-surface)) 65%);
}
.study-timeline__event--meeting .study-timeline__body {
  --tl-type: hsl(205 32% 40%);
  border-radius: calc(var(--radius) + 2px);
}
.study-timeline__event--review .study-timeline__body {
  --tl-type: hsl(36 48% 40%);
  border-left-style: double;
  border-left-width: 5px;
}
.study-timeline__event--task .study-timeline__body {
  --tl-type: hsl(192 38% 36%);
  border-left-width: 3px;
  border-style: solid;
}
.study-timeline__event--other .study-timeline__body {
  --tl-type: hsl(150 6% 48%);
  border-left-style: dashed;
  border-left-width: 3px;
  background:
    linear-gradient(155deg, color-mix(in srgb, var(--tl-type) 5%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-surface)) 70%);
}
.study-timeline__event--overdue .study-timeline__body {
  --tl-type: hsl(10 58% 42%);
  border-color: hsla(10, 55%, 48%, .32);
  border-left-color: hsl(10 58% 42%);
  background:
    linear-gradient(155deg, hsla(10, 58%, 48%, .08) 0%, hsl(var(--bg-surface)) 65%);
}
.study-timeline__event--today .study-timeline__body {
  border-color: color-mix(in srgb, var(--tl-type) 34%, hsl(var(--border-light)));
  box-shadow:
    0 1px 0 hsla(0 0% 100% / .55) inset,
    0 8px 22px -14px color-mix(in srgb, var(--tl-type) 32%, transparent);
}
.study-timeline__event--publication .study-timeline__body {
  border-style: solid dashed solid solid;
  opacity: .94;
}
.study-timeline__event--kanban .study-timeline__body {
  border-style: solid dashed solid solid;
  opacity: .96;
}
.study-timeline__event--done .study-timeline__body {
  opacity: .58;
  border-style: solid;
  border-left-color: hsl(var(--border));
}
.study-timeline__event--done .study-timeline__title,
.study-timeline__event--done .study-timeline__link {
  text-decoration: line-through;
  color: hsl(var(--text-muted));
  text-decoration-color: hsl(var(--text-muted));
}
.study-timeline__event--done .study-timeline__marker {
  --tl-dot-core: hsl(var(--text-muted));
  opacity: .55;
  box-shadow: none;
  animation: none;
}
.study-timeline__event--editing .study-timeline__body,
.study-timeline__edit-form {
  background: hsl(var(--bg-surface));
}
.study-timeline__head {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
  margin-bottom: .4rem;
}
.study-timeline__head .timeline-countdown { margin-left: auto; }
@media (max-width: 520px) {
  .study-timeline__head .timeline-countdown { margin-left: 0; width: 100%; justify-content: center; }
}
.study-timeline__date {
  font-size: .78rem;
  font-weight: 650;
  color: hsl(var(--text-secondary));
  font-variant-numeric: tabular-nums;
}
.study-timeline__range-sep { margin: 0 .25rem; opacity: .55; }
.study-timeline__title {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.35;
  margin: 0;
  letter-spacing: -.015em;
}
.study-timeline__desc {
  font-size: .84rem;
  margin: .4rem 0 0;
  line-height: 1.45;
}
.study-timeline__status {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-top: .4rem;
  padding: .12rem .4rem;
  border-radius: 999px;
}
.study-timeline__status--overdue {
  color: hsl(8 58% 36%);
  background: hsla(8, 60%, 50%, .12);
}
.study-timeline__status--today {
  color: color-mix(in srgb, var(--study-accent) 80%, hsl(var(--text)));
  background: color-mix(in srgb, var(--study-accent) 14%, transparent);
}
.study-timeline__actions {
  display: flex;
  gap: .35rem;
  margin-top: .65rem;
  padding-top: .55rem;
  border-top: 1px solid color-mix(in srgb, var(--study-accent) 8%, hsl(var(--border-light)));
}

/* Add / edit forms: solid, no blob drift */
.study-timeline__add-form {
  margin-top: .25rem;
  padding: 1.15rem 1.05rem 1.05rem;
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid color-mix(in srgb, var(--study-accent) 14%, hsl(var(--border-light)));
  border-top: 2px solid color-mix(in srgb, var(--study-accent) 32%, hsl(var(--border-light)));
  background: hsl(var(--bg-surface));
  position: relative;
  z-index: 1;
  box-shadow: 0 1px 0 hsla(0 0% 100% / .5) inset;
}
.study-page .study-timeline__add-form {
  margin-top: .15rem;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--study-accent) 5%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-surface)) 48%);
}
.study-timeline__add-head {
  margin-bottom: .85rem;
}
.study-timeline__add-title {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -.02em;
}
.study-timeline__add-lead {
  margin: .2rem 0 0;
  font-size: .8rem;
}
.study-timeline__edit-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  padding: .85rem .95rem;
  border-radius: calc(var(--radius-sm) + 2px);
  border: 1px solid color-mix(in srgb, var(--study-accent) 16%, hsl(var(--border-light)));
  background: hsl(var(--bg-surface));
  box-shadow: 0 1px 0 hsla(0 0% 100% / .45) inset;
}
.study-timeline__edit-actions {
  display: flex;
  gap: .5rem;
}
.form-row--compact { gap: .65rem; }
.field--grow { flex: 1; min-width: 12rem; }
.badge--muted {
  font-size: .68rem;
  padding: .1rem .4rem;
  border-radius: 999px;
  background: hsl(var(--border-light));
  color: hsl(var(--text-muted));
}
.badge--type {
  font-size: .68rem;
  padding: .12rem .5rem;
  border-radius: 999px;
  font-weight: 650;
}
.badge--type-milestone { background: hsla(168, 42%, 36%, .12); color: hsl(168 38% 30%); }
.badge--type-deadline { background: hsla(8, 62%, 48%, .12); color: hsl(8 52% 36%); }
.badge--type-meeting { background: hsla(175, 48%, 36%, .12); color: hsl(175 40% 30%); }
.badge--type-review { background: hsla(195, 40%, 40%, .12); color: hsl(195 36% 32%); }
.badge--type-task { background: hsla(200, 42%, 42%, .12); color: hsl(200 38% 32%); }
.badge--type-other { background: hsl(var(--border-light)); color: hsl(var(--text-muted)); }
.study-timeline-preview { list-style: none; margin: 0; padding: 0; }
.study-timeline-preview__item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem 1rem;
  border-bottom: 1px solid hsl(var(--border-light));
  flex-wrap: wrap;
}
.study-timeline-preview__item:last-child { border-bottom: none; }
.study-timeline-preview__item--overdue { background: hsla(8, 60%, 50%, .04); }
.study-timeline-preview__item--today {
  background: color-mix(in srgb, var(--study-accent) 6%, transparent);
}
.study-timeline-preview__item--done { opacity: .62; }
.study-timeline-preview__item--done .study-timeline-preview__title {
  text-decoration: line-through;
  color: hsl(var(--text-muted));
  text-decoration-color: hsl(var(--text-muted));
}
.study-timeline-preview__date {
  font-size: .78rem;
  font-weight: 600;
  color: hsl(var(--text-secondary));
  font-variant-numeric: tabular-nums;
  min-width: 6.5rem;
}
.study-timeline-preview__title {
  flex: 1;
  font-size: .88rem;
  display: flex;
  align-items: center;
  min-width: 8rem;
}
@media (max-width: 600px) {
  .study-timeline-panel { padding: .95rem .85rem 1rem; gap: 1rem; }
  .timeline-calendar { padding: .85rem .65rem; }
  .timeline-day { min-height: 2.7rem; padding: .22rem .1rem; }
  .timeline-day__today-badge { font-size: .5rem; }
  .timeline-countdown--prominent { min-width: 4.5rem; font-size: .7rem; }
  .study-timeline-preview__item { gap: .5rem; }
  .study-timeline-preview__date { min-width: auto; width: 100%; order: 2; }
  .study-timeline-preview__title { order: 3; width: 100%; }
  .study-timeline {
    --tl-pad: 1.35rem;
    --tl-spine-x: 8px;
    --tl-dot: 9px;
  }
  .study-timeline__marker { top: .85rem; }
  .study-timeline__body { padding: .7rem .75rem .75rem; }
  .study-timeline__add-form { padding: 1rem .8rem .9rem; }
  .study-timeline-empty { padding: 1.5rem 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .study-timeline__event:hover .study-timeline__sheen,
  .study-timeline__event--overdue .study-timeline__marker {
    animation: none;
  }
  .study-timeline__event:hover .study-timeline__sheen { opacity: 0; }
}
.btn-danger-text { color: hsl(0 55% 45%); }
.btn-danger-text:hover { color: hsl(0 60% 38%); background: hsla(0, 60%, 50%, .08); }

.roadmap-item-card__links {
  display: flex; gap: .35rem; margin-top: .5rem; padding-top: .5rem;
  border-top: 1px solid hsl(var(--border));
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
@keyframes surfaceSheen {
  0% { transform: translateX(-130%) skewX(-14deg); opacity: 0; }
  15% { opacity: 1; }
  55%, 100% { transform: translateX(220%) skewX(-14deg); opacity: 0; }
}
@keyframes atmosphereDrift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: .85; }
  50% { transform: translate3d(2.5%, -1.5%, 0) scale(1.04); opacity: 1; }
}
@keyframes meshDriftA {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(1.8%, 1.2%, 0) scale(1.03); }
  100% { transform: translate3d(-1.2%, 1.6%, 0) scale(1.015); }
}
@keyframes meshDriftB {
  0% { transform: translate3d(0, 0, 0) scale(1.015); }
  50% { transform: translate3d(-2%, -1.2%, 0) scale(1.04); }
  100% { transform: translate3d(1.5%, -1.8%, 0) scale(1); }
}
/* Soft blob motion: keep travel small so rounded overflow shells don't hard-clip */
@keyframes blobFloat {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33% { transform: translate3d(2.2%, -1.6%, 0) scale(1.035); }
  66% { transform: translate3d(-1.8%, 1.2%, 0) scale(1.02); }
}
@keyframes chromeSheen {
  0%, 100% { background-position: 0% 50%; opacity: .35; }
  50% { background-position: 100% 50%; opacity: .9; }
}
@keyframes idleSheenDrift {
  0% { transform: translateX(-140%) skewX(-14deg); opacity: 0; }
  8% { opacity: .5; }
  35% { transform: translateX(140%) skewX(-14deg); opacity: 0; }
  100% { transform: translateX(140%) skewX(-14deg); opacity: 0; }
}

.fade-in { animation: fadeInUp .65s var(--ease-out) both; }
.stagger > * { animation: fadeInUp .6s var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: .03s; }
.stagger > *:nth-child(2) { animation-delay: .08s; }
.stagger > *:nth-child(3) { animation-delay: .13s; }
.stagger > *:nth-child(4) { animation-delay: .18s; }
.stagger > *:nth-child(5) { animation-delay: .23s; }
.stagger > *:nth-child(6) { animation-delay: .28s; }
.stagger > *:nth-child(7) { animation-delay: .33s; }
.stagger > *:nth-child(8) { animation-delay: .38s; }
.stagger > *:nth-child(9) { animation-delay: .43s; }
.stagger > *:nth-child(10) { animation-delay: .48s; }
.stagger > *:nth-child(11) { animation-delay: .53s; }
.stagger > *:nth-child(12) { animation-delay: .58s; }

.landing-hero__photo img { will-change: auto; }

.btn:active { transform: none; filter: brightness(.97); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fade-in,
  .stagger > *,
  .study-stagger > *,
  .landing-hero,
  .landing-hero__band,
  .landing-hero__glass,
  .landing-hero__glass::after,
  .landing-posse,
  .landing-studies,
  .landing-tasks {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
  .module-tile:hover,
  .kanban-card:hover,
  .assignee-card:hover,
  .study-card:hover,
  .landing-active__chip:hover,
  .landing-active__chip:focus-visible,
  .landing-posse__card:has(> .landing-posse__open:hover),
  .landing-posse__card:has(> .landing-posse__open:focus-visible),
  .study-hub-mod:hover,
  .study-page .kanban-col:hover,
  .study-page .assignee-col:hover {
    transform: none;
  }
  .module-tile:hover::after,
  .kanban-card:hover::after,
  .assignee-card:hover::after,
  .study-hub-mod:hover::after {
    animation: none !important;
    opacity: 0;
  }
  body::before,
  body::after,
  .app-header::after,
  .study-page__head::before,
  .study-page__head::after,
  .study-hub::before,
  .study-hub::after,
  .study-hub__hero-glow,
  .study-nav::before,
  .study-hub-mod::before,
  .study-hub-panel::before,
  .module-tile::before,
  .panel::before,
  .study-page .kanban-col::before,
  .study-page .assignee-col::before {
    animation: none !important;
  }
  .kanban-card,
  .assignee-card {
    transition: border-color .2s ease, box-shadow .2s ease;
  }
}

/* Responsive */
@media (max-width: 1100px) {
  .module-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .kpi-strip { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

@media (max-width: 900px) {
  .dashboard-split, .wiki-editor, .wiki-layout, .media-layout__body { grid-template-columns: 1fr; }
  .landing-tasks--with-team { grid-template-columns: 1fr; }
  .landing-hero__stage {
    flex-wrap: wrap;
    justify-content: center;
    padding-inline: 0;
  }
  .landing-hero__glass {
    margin: 0;
    width: min(100%, 36rem);
    flex: 1 1 18rem;
  }
  .landing-posse {
    flex: 1 1 20rem;
    min-width: min(100%, 22rem);
  }
  .landing-posse__deck {
    --posse-card-w: clamp(5rem, 12vw, 6.6rem);
    width: min(100%, calc(var(--posse-card-w) * 6.2));
  }
  .landing-posse__card:nth-child(1) { --posse-x: -9.6rem; }
  .landing-posse__card:nth-child(2) { --posse-x: -5.75rem; }
  .landing-posse__card:nth-child(3) { --posse-x: -1.9rem; }
  .landing-posse__card:nth-child(4) { --posse-x: 1.9rem; }
  .landing-posse__card:nth-child(5) { --posse-x: 5.75rem; }
  .landing-posse__card:nth-child(6) { --posse-x: 9.6rem; }
  .wiki-sidebar { position: static; max-height: none; }
  .app-header { position: sticky; }
  .app-header__inner { position: relative; }
  .app-header__left { flex: 1; min-width: 0; gap: .5rem; }
  .app-header__divider { display: none; }
  .app-header__subtitle { display: none; }
  .top-nav {
    display: none; position: absolute;
    top: calc(var(--header-h) + env(safe-area-inset-top, 0px)); left: 0; right: 0;
    flex-direction: column; padding: .75rem; gap: .25rem;
    background: hsla(var(--bg-surface), .98); backdrop-filter: blur(16px);
    border-bottom: 1px solid hsl(var(--border)); box-shadow: var(--shadow);
    z-index: 210; max-height: min(70vh, 28rem); overflow-y: auto;
  }
  .top-nav--open { display: flex; }
  .top-nav__link {
    width: 100%; min-height: var(--touch-min);
    padding: .7rem .9rem; border-radius: var(--radius-sm);
  }
  .top-nav__link--studies {
    border-radius: var(--radius-sm);
    justify-content: flex-start;
  }
  .top-nav__crumb { display: none; }
  .top-nav__link--study { max-width: none; }
  .top-nav__link--mobile-only { display: inline-flex; }
  .nav-toggle { display: flex; flex-shrink: 0; }
  /* Admin text links → hamburger; keep icon cluster + user menu */
  .app-header__user .header-admin-links { display: none; }
  .user-pill { max-width: 9.5rem; }
  .user-pill__label {
    min-width: 0;
    overflow: hidden;
  }
  .user-pill__name {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    display: block;
  }
  .hero h1 { font-size: 1.5rem; }
  :root { --header-h: 48px; --study-nav-h: 3.65rem; }
  html { scrollbar-gutter: auto; }
  .app-header__inner { min-height: var(--header-h); gap: .45rem; }
  .app-header__logo { width: 28px; height: 28px; }
  .app-header__title { font-size: .88rem; }
  .header-bell__btn {
    min-width: var(--touch-min); min-height: var(--touch-min);
  }
  .user-pill {
    min-height: var(--touch-min);
    display: inline-flex; align-items: center;
    padding: .35rem .7rem;
  }
  .user-pill--menu {
    height: var(--touch-min);
    min-height: var(--touch-min);
    gap: .28rem;
    padding: 0 .55rem 0 .3rem;
  }

  /* Study module nav → thumb-friendly bottom bar */
  .study-page {
    padding-bottom: calc(var(--study-nav-h) + env(safe-area-inset-bottom, 0px) + .75rem);
  }
  .study-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 190;
    flex-wrap: nowrap;
    align-items: center;
    gap: .35rem;
    margin: 0;
    padding: .4rem .55rem calc(.4rem + env(safe-area-inset-bottom, 0px));
    border-radius: 0;
    border: none;
    border-top: 1px solid color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 16%, hsl(var(--border)));
    background: hsla(var(--bg-surface), .94);
    backdrop-filter: blur(18px) saturate(1.3);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    box-shadow: 0 -8px 28px -18px rgba(20, 40, 35, .28);
    overflow: hidden;
    transition: transform .22s var(--ease-out);
  }
  .study-nav::before { display: none; }
  .study-nav__tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: .2rem;
    padding: .05rem .15rem;
    mask-image: linear-gradient(90deg, #000 88%, transparent);
    scroll-snap-type: x proximity;
    overscroll-behavior-x: contain;
  }
  .study-nav__tabs::-webkit-scrollbar { display: none; }
  .study-nav__tab {
    flex: 0 0 auto;
    min-height: var(--touch-min);
    padding: .5rem .85rem;
    font-size: .78rem;
    scroll-snap-align: start;
  }
  .study-nav__label-full { display: none; }
  .study-nav__label-short { display: inline; }
  .study-nav__actions {
    flex: 0 0 auto;
    margin-left: 0;
    align-items: center;
    padding-left: .25rem;
    border-left: 1px solid hsl(var(--border-light));
  }
  .study-nav__actions:not(:has(a, button)) {
    display: none;
    border: none;
    padding: 0;
  }
  .study-nav__actions .btn {
    min-height: var(--touch-min);
    min-width: var(--touch-min);
    padding: .4rem .65rem;
  }
  body.kanban-detail-open .study-nav {
    transform: translateY(110%);
    pointer-events: none;
    transition: transform .22s var(--ease-out);
  }

  .kanban-wrap { overflow: hidden; max-width: 100%; }
  .kanban-page__actions { justify-content: stretch; width: 100%; }
  .kanban-page__actions .toolbar { flex: 1; }
  .kanban-page__actions .btn-secondary { min-height: var(--touch-min); }
  .kanban-columns-btn { min-height: var(--touch-min); }
  .kanban-columns-list__item {
    flex-wrap: wrap;
    gap: .35rem .4rem;
    min-height: var(--touch-min);
    padding: .55rem .6rem;
  }
  .kanban-columns-list__name { flex: 1 1 100%; min-height: var(--touch-min); }
  .kanban-columns-list__actions { margin-left: auto; }
  .kanban-columns-list__actions .btn-icon {
    width: var(--touch-min); height: var(--touch-min);
  }
  .kanban-columns-add { flex-wrap: wrap; }
  .kanban-columns-add .btn { min-height: var(--touch-min); }
  .kanban-board,
  .roadmap-board,
  .assignee-board {
    display: flex; grid-template-columns: none;
    gap: .75rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding-bottom: .5rem;
    margin-inline: calc(-1 * var(--page-padding));
    padding-inline: var(--page-padding);
  }
  .kanban-board > .kanban-col,
  .roadmap-board > *,
  .assignee-board > .assignee-col {
    flex: 0 0 min(82vw, 19.5rem);
    max-width: min(82vw, 19.5rem);
    scroll-snap-align: start;
    scroll-snap-stop: normal;
  }
  .kanban-card {
    padding: .85rem .9rem;
    min-height: 3.25rem;
  }
  .kanban-card__title { font-size: .92rem; line-height: 1.35; }
  .kanban-card__trash {
    opacity: .65;
    width: var(--touch-min); height: var(--touch-min);
  }
  .kanban-add .input,
  .kanban-add .btn { min-height: var(--touch-min); }
  .quick-task-form { gap: .5rem; }
  .quick-task-form .input,
  .quick-task-form .select,
  .quick-task-form .btn {
    flex: 1 1 100%;
    min-height: var(--touch-min);
  }
  .quick-task-form__date { max-width: none; }
  .my-task-item__link { min-height: var(--touch-min); }
  .my-task-item__edit { min-height: var(--touch-min); min-width: var(--touch-min); }
  .todo-check,
  .my-task-item__check,
  .study-hub-task__check {
    width: var(--touch-min); height: var(--touch-min);
  }
  .btn, a.btn, .pill, button.pill {
    min-height: var(--touch-min);
  }
  .btn-icon {
    width: var(--touch-min); height: var(--touch-min);
  }
  .input, .select, textarea.input {
    min-height: var(--touch-min);
    font-size: 16px; /* avoid iOS zoom on focus */
  }
  textarea.input { min-height: 5.5rem; }
  .module-tile:hover,
  .study-card:hover,
  .study-hub-mod:hover,
  .study-page .kanban-col:hover,
  .study-page .assignee-col:hover {
    transform: none;
  }
  .module-tile:active,
  .study-card:active,
  .study-hub-mod:active {
    transform: scale(.985);
  }
  .form-row { grid-template-columns: 1fr; }
  .forum-topic-row { flex-wrap: wrap; }
  .forum-topic-row__aside { flex-direction: row; align-items: center; width: 100%; justify-content: flex-end; }
  .forum-toolbar__search { max-width: none; width: 100%; }
  .forum-new-form { max-width: none; }
  .study-page__head {
    gap: .75rem;
  }
  .study-page__actions {
    width: 100%;
    display: flex; flex-wrap: wrap; gap: .5rem;
  }
  .study-page__actions .btn { flex: 1 1 auto; justify-content: center; }
  .study-page__lead { font-size: .92rem; line-height: 1.5; }
  .page-head { gap: .75rem; }
  .page-head .toolbar { width: 100%; }
  .page-head .toolbar .btn { min-height: var(--touch-min); }
  .timeline-calendar__nav,
  .timeline-calendar__today-btn {
    min-width: var(--touch-min); min-height: var(--touch-min);
  }
  .header-bell__panel {
    position: fixed;
    top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + .35rem);
    left: var(--page-padding); right: var(--page-padding);
    width: auto; max-width: none;
    max-height: min(60dvh, 22rem);
  }

  /* Forms / modals → full-width bottom sheets */
  .modal-backdrop {
    align-items: end;
    place-items: end stretch;
    padding: 0;
  }
  .modal,
  .modal--wide {
    width: 100%;
    max-width: none;
    margin: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 1.15rem 1.15rem calc(1.15rem + env(safe-area-inset-bottom, 0px));
    max-height: min(92dvh, 100%);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 -16px 48px -20px rgba(20, 40, 35, .28);
  }
  .modal .btn,
  .modal .btn-block { min-height: var(--touch-min); }
  .roadmap-detail-overlay {
    flex-direction: column;
    justify-content: flex-end;
    align-items: stretch;
    padding: 0;
  }
  .roadmap-detail-panel {
    width: 100%;
    max-width: none;
    max-height: min(92dvh, 100%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding-bottom: calc(1.15rem + env(safe-area-inset-bottom, 0px));
    align-self: auto;
  }
  .kanban-detail-panel__meta-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  :root {
    --page-padding: .8rem;
    --section-gap: 1.05rem;
    --study-nav-h: 3.85rem;
  }
  .landing-hero__brand { font-size: clamp(2.15rem, 9vw, 2.85rem); }
  .landing-hero__motto { font-size: 1rem; }
  .landing-hero__band { border-radius: calc(var(--radius) + 4px); }
  .main--landing { padding-top: 0; }
  .study-hub__hero,
  .study-hub__hero--photo { padding: 1.1rem 1rem; }
  .study-hub__modules { gap: .55rem; }
  .study-hub-mod { min-height: 5.5rem; padding: .85rem; }
  .study-hub-mod__value { font-size: 1.05rem; }
  .panel { padding: 1rem; }
  .main { padding-top: var(--space-md); }
  .main:has(.study-page) { padding-bottom: .65rem; }
  .study-page__head h1 { font-size: 1.35rem; }
  .study-page__eyebrow { font-size: .68rem; }
  .kanban-board > .kanban-col,
  .roadmap-board > *,
  .assignee-board > .assignee-col {
    flex: 0 0 min(88vw, 20rem);
    max-width: min(88vw, 20rem);
  }
  .filter-pills { gap: .4rem; }
  .data-table th, .data-table td { padding: .7rem .55rem; }
  .table-wrap {
    margin-inline: calc(-1 * var(--page-padding));
    padding-inline: var(--page-padding);
  }
  .wiki-main__toolbar .btn,
  .media-tabs__btn { min-height: var(--touch-min); }
  .media-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .media-tabs::-webkit-scrollbar { display: none; }
  .media-tabs__btn { flex: 0 0 auto; white-space: nowrap; }
  .study-forum-settings__grid { grid-template-columns: 1fr; }
  .publication-item--expanded,
  .publication-authors__head { gap: .55rem; }
  .members-list__item { gap: .65rem; padding: .75rem 0; }
}

/* Cross-module link chips */
.link-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: .35rem 0 .65rem;
}
.link-chip-row--compact { margin: .25rem 0; }
.link-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 500;
  text-decoration: none;
  background: hsl(var(--bg-muted));
  border: 1px solid hsl(var(--border-light));
  color: hsl(var(--text-secondary));
  transition: background .15s, border-color .15s;
}
.link-chip:hover {
  background: hsla(var(--accent), .08);
  border-color: hsla(var(--accent), .25);
  color: hsl(var(--accent));
}
.link-chip--sm { font-size: .68rem; padding: .15rem .45rem; }
.link-chip__label { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-chip__icon {
  width: .85rem;
  height: .85rem;
  flex-shrink: 0;
  border-radius: 2px;
  background: currentColor;
  opacity: .75;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}
.link-chip--kanban .link-chip__icon { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='3' width='7' height='18' rx='1'/%3E%3Crect x='14' y='3' width='7' height='12' rx='1'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='3' width='7' height='18' rx='1'/%3E%3Crect x='14' y='3' width='7' height='12' rx='1'/%3E%3C/svg%3E"); }
.link-chip--timeline .link-chip__icon { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E"); }
.link-chip--wiki .link-chip__icon { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 19h16M6 17l2-14h8l2 14'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 19h16M6 17l2-14h8l2 14'/%3E%3C/svg%3E"); }
.link-chip--file .link-chip__icon { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z'/%3E%3Cpath d='M14 2v6h6'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z'/%3E%3Cpath d='M14 2v6h6'/%3E%3C/svg%3E"); }
.link-chip__remove {
  border: none;
  background: transparent;
  color: inherit;
  opacity: .55;
  cursor: pointer;
  padding: 0 .1rem;
  font-size: .9rem;
  line-height: 1;
}
.link-chip__remove:hover { opacity: 1; }
.link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: .75rem;
}
.link-picker {
  border: 1px solid hsl(var(--border-light));
  border-radius: var(--radius);
  padding: .65rem;
  margin-bottom: .75rem;
  background: hsl(var(--bg-surface));
}
.link-picker__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .5rem;
}
.link-picker__list {
  list-style: none;
  margin: .35rem 0 0;
  padding: 0;
  max-height: 10rem;
  overflow-y: auto;
}
.link-picker__item {
  display: flex;
  align-items: center;
  gap: .4rem;
  width: 100%;
  text-align: left;
  padding: .4rem .35rem;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .82rem;
}
.link-picker__item:hover { background: hsl(var(--bg-muted)); }
.link-picker__empty { padding: .35rem; font-size: .8rem; }
.wiki-related {
  margin: 0 0 1rem;
  padding: .75rem 1rem;
  border-radius: var(--radius);
  background: hsl(var(--bg-muted));
  border: 1px solid hsl(var(--border-light));
}
.wiki-related__title {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: hsl(var(--text-muted));
  margin: 0 0 .5rem;
}
.wiki-author {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .82rem;
}
.forum-avatar.profile-avatar { border-radius: 50%; }

/* DICOM viewer */
.main.main--dicom { max-width: none; }
.dicom-layout {
  display: grid;
  grid-template-columns: minmax(200px, 260px) 1fr;
  gap: 1rem;
  align-items: stretch;
  min-height: calc(100vh - var(--header-h) - 10rem);
}
.dicom-sidebar {
  padding: .85rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  max-height: calc(100vh - var(--header-h) - 8rem);
  overflow: auto;
}
.dicom-sidebar__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
}
.dicom-sidebar__head h2 { font-size: 1rem; margin: 0; }
.dicom-sidebar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  justify-content: flex-end;
}
.dicom-sidebar__empty { font-size: .85rem; line-height: 1.45; }
.dicom-file-list { list-style: none; display: flex; flex-direction: column; gap: .35rem; }
.dicom-file-list__item {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .55rem .65rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  color: inherit;
  text-decoration: none;
  background: hsl(var(--bg-muted));
  transition: border-color var(--transition), background var(--transition);
}
.dicom-file-list__item:hover { border-color: hsl(var(--border)); }
.dicom-file-list__item.active {
  border-color: hsl(var(--accent));
  background: hsl(var(--accent-light));
}
.dicom-file-list__name {
  font-size: .82rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dicom-file-list__meta { font-size: .72rem; }
.dicom-main {
  padding: .85rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
  min-width: 0;
}
.dicom-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .75rem;
  align-items: center;
  justify-content: space-between;
}
.dicom-toolbar__group {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  align-items: center;
}
.dicom-toolbar__file {
  font-weight: 600;
  font-size: .9rem;
  margin-right: .35rem;
}
.dicom-slider {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .75rem;
  color: hsl(var(--text-muted));
}
.dicom-slider input[type="range"] { width: 90px; }
.dicom-roi-panel {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .85rem;
  align-items: baseline;
  padding: .45rem .65rem;
  border-radius: var(--radius-sm);
  background: hsl(45 80% 96%);
  border: 1px solid hsl(43 74% 66% / .45);
  font-size: .8rem;
  color: hsl(28 40% 22%);
}
.dicom-roi-panel__title {
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-size: .72rem;
}
.dicom-roi-panel strong { font-variant-numeric: tabular-nums; }
.dicom-seed-panel {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .85rem;
  align-items: center;
  padding: .45rem .65rem;
  border-radius: var(--radius-sm);
  background: hsl(199 80% 96%);
  border: 1px solid hsl(199 70% 70% / .4);
  font-size: .8rem;
  color: hsl(200 40% 22%);
}
.dicom-seed-panel__title {
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-size: .72rem;
}
.dicom-seed-panel__val {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 4.5rem;
}
.dicom-slider--wide input[type="range"] { width: min(220px, 40vw); }
.dicom-export-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
}
.dicom-slicebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
}
.dicom-slicebar__range {
  flex: 1;
  min-width: 120px;
  max-width: 420px;
  accent-color: #2f6f5e;
}
.dicom-slicebar__label {
  font-size: .78rem;
  color: hsl(var(--text-muted));
  min-width: 8rem;
}
.dicom-stage {
  position: relative;
  flex: 1;
  min-height: 420px;
  border-radius: var(--radius);
  overflow: hidden;
  background: #0b1220;
  border: 1px solid hsl(var(--border));
}
.dicom-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}
.dicom-stage .empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  margin: 0;
  padding: 1.5rem;
  color: #cbd5e1;
  text-align: center;
}
.dicom-hud {
  position: absolute;
  left: .75rem;
  bottom: .75rem;
  padding: .35rem .6rem;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, .72);
  color: #e2e8f0;
  font-size: .78rem;
  pointer-events: none;
}
.dicom-loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: .65rem;
  padding: 1.5rem;
  background: rgba(11, 18, 32, .92);
  color: #e2e8f0;
  text-align: center;
}
.dicom-loader--error {
  background: rgba(30, 12, 12, .92);
  color: #fecaca;
}
.dicom-loader__label {
  margin: 0;
  max-width: 28rem;
  font-size: .92rem;
  line-height: 1.45;
  font-weight: 500;
}
.dicom-loader__track {
  width: min(280px, 70vw);
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, .28);
  overflow: hidden;
}
.dicom-loader__bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #2f6f5e, #5eead4);
  transition: width .15s ease-out;
}
.dicom-loader__pct {
  margin: 0;
  font-size: .78rem;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}
.dicom-loader__hint {
  margin: 0;
  font-size: .78rem;
  color: #fca5a5;
}
.dicom-help { font-size: .78rem; }
.dicom-ann-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.dicom-ann-list li {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .25rem .5rem;
  border-radius: 999px;
  background: hsl(var(--bg-muted));
  font-size: .78rem;
}
@media (max-width: 900px) {
  .dicom-layout { grid-template-columns: 1fr; }
  .dicom-sidebar { max-height: none; }
  .dicom-stage { min-height: 320px; }
}

/* Study forum: scoped wrappers (reuse .forum-* patterns) */
.study-forum {
  --study-accent: var(--study-color, hsl(var(--accent)));
  --forum-ease: cubic-bezier(.22, 1, .36, 1);
}
.study-forum .study-forum__toolbar {
  margin-bottom: 1rem;
  padding: 1rem 1.15rem;
  position: relative;
  overflow: hidden;
}
.study-forum .forum-thread-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1rem;
}
.study-forum .forum-topic-header {
  margin-bottom: 1.25rem;
  padding: 1.15rem 1.25rem 1.2rem;
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid color-mix(in srgb, var(--study-accent) 14%, hsl(var(--border-light)));
  border-top: 2px solid color-mix(in srgb, var(--study-accent) 34%, hsl(var(--border-light)));
  background:
    radial-gradient(ellipse 80% 55% at 100% 0%, color-mix(in srgb, var(--study-accent) 10%, transparent), transparent 58%),
    linear-gradient(168deg, hsl(var(--bg-surface)) 0%, color-mix(in srgb, var(--study-accent) 5%, hsl(var(--bg-surface))) 100%);
  box-shadow: var(--shadow), 0 1px 0 hsla(0 0% 100% / .5) inset;
}
.study-forum .forum-post-card,
.study-forum .forum-reply-card {
  margin-bottom: .85rem;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-color: color-mix(in srgb, var(--study-accent) 12%, hsl(var(--border-light)));
  border-top: 2px solid color-mix(in srgb, var(--study-accent) 26%, hsl(var(--border-light)));
  transition: border-color .28s ease, box-shadow .28s ease;
}
.study-forum .forum-post-card:hover,
.study-forum .forum-reply-card:hover {
  border-color: color-mix(in srgb, var(--study-accent) 28%, hsl(var(--border-light)));
  box-shadow: var(--shadow-lg), 0 1px 0 hsla(0 0% 100% / .5) inset;
}
.study-forum .forum-post-card--op {
  background:
    radial-gradient(ellipse 70% 50% at 0% 0%, color-mix(in srgb, var(--study-accent) 10%, transparent), transparent 55%),
    linear-gradient(145deg, hsl(var(--bg-surface)) 0%, color-mix(in srgb, var(--study-accent) 6%, hsl(var(--bg-surface))) 100%);
}
.study-forum .forum-reply-box {
  margin-top: 1rem;
  position: relative;
  overflow: hidden;
  transition: border-color .3s ease, box-shadow .3s ease;
}
.study-forum .forum-reply-box:focus-within,
.study-forum .forum-new-form:focus-within {
  border-color: color-mix(in srgb, var(--study-accent) 36%, hsl(var(--border-light)));
  box-shadow: var(--shadow-lg), 0 0 0 3px color-mix(in srgb, var(--study-accent) 12%, transparent);
}
.study-forum__readonly {
  margin-top: 1rem;
  padding: .85rem 1rem;
  border-radius: var(--radius);
  border: 1px dashed color-mix(in srgb, var(--study-accent) 28%, hsl(var(--border)));
  background: color-mix(in srgb, var(--study-accent) 4%, hsl(var(--bg-surface)));
}
.study-forum .forum-new-form {
  max-width: 40rem;
}
.study-forum .forum-pill-tab.active {
  background: color-mix(in srgb, var(--study-accent) 88%, hsl(var(--text)));
  border-color: transparent;
  color: #fff;
}
.study-forum .forum-category-chip,
.study-forum .forum-pin-badge,
.study-forum .forum-op-badge {
  color: color-mix(in srgb, var(--study-accent) 85%, hsl(var(--text)));
  background: color-mix(in srgb, var(--study-accent) 12%, hsl(var(--bg-surface)));
  border-color: color-mix(in srgb, var(--study-accent) 24%, transparent);
}
.study-forum .forum-topic-row {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  transition: color .22s ease;
}
.study-forum .forum-topic-row::before { display: none; }
/* Card owns the hover chrome — row-level :hover was zeroed / clipped by overflow */
.forum-topic-list__card {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0;
  flex: 1;
  min-width: 0;
  border-radius: calc(var(--radius) + 2px);
  overflow: hidden;
  isolation: isolate;
  border: 0;
  background:
    linear-gradient(168deg, hsl(var(--bg-surface)) 0%, color-mix(in srgb, var(--study-accent) 4%, hsl(var(--bg-surface))) 100%);
  /* Only inset shadows — overflow:hidden would clip outer box-shadow (hover looked broken) */
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--study-accent) 14%, hsl(var(--border-light))),
    0 1px 0 hsla(0 0% 100% / .45) inset;
  transition: box-shadow .22s ease;
  -webkit-tap-highlight-color: transparent;
}
/* Soft tint via opacity — avoids gradient snap + sheen flash on hover */
.forum-topic-list__card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    168deg,
    color-mix(in srgb, var(--study-accent) 12%, transparent) 0%,
    transparent 70%
  );
  opacity: 0;
  transition: opacity .22s ease;
}
.forum-topic-list__card > * { position: relative; z-index: 1; }
@media (hover: hover) and (pointer: fine) {
  .forum-topic-list__card:hover::before,
  .forum-topic-list__item:focus-within .forum-topic-list__card::before {
    opacity: 1;
  }
  .forum-topic-list__card:hover,
  .forum-topic-list__item:focus-within .forum-topic-list__card {
    /* Same layer count/widths as rest — only ring color intensifies */
    box-shadow:
      inset 0 0 0 1px color-mix(in srgb, var(--study-accent) 42%, hsl(var(--border-light))),
      0 1px 0 hsla(0 0% 100% / .55) inset;
  }
  .forum-topic-list__card:hover .forum-topic-row__title,
  .forum-topic-list__item:focus-within .forum-topic-list__card .forum-topic-row__title {
    color: color-mix(in srgb, var(--study-accent) 72%, hsl(var(--text)));
  }
  .forum-topic-list__card:hover .forum-topic-row__chevron,
  .forum-topic-list__item:focus-within .forum-topic-list__card .forum-topic-row__chevron {
    color: var(--study-accent);
    opacity: 1;
    transform: translateX(2px);
  }
}
.forum-topic-list__card:focus-within {
  outline: none;
}
.forum-topic-list__card .forum-topic-row {
  flex: 1 1 100%;
  border: 0;
  box-shadow: none;
  background: transparent;
  border-radius: 0;
}
.forum-topic-list__card .forum-topic-row:focus-visible {
  background: transparent;
  box-shadow: none;
}
.forum-topic-list__card .forum-topic-row:focus-visible::before { opacity: 0; }
/* Neutralize global item>row hover inside cards (card handles it) */
.forum-topic-list__item:hover > .forum-topic-list__card .forum-topic-row,
.forum-topic-list__item:focus-within > .forum-topic-list__card .forum-topic-row {
  background: transparent;
  box-shadow: none;
}
.forum-topic-list__item:hover > .forum-topic-list__card .forum-topic-row::before,
.forum-topic-list__item:focus-within > .forum-topic-list__card .forum-topic-row::before {
  opacity: 0;
}
/* Sheen disabled on thread cards — surfaceSheen caused a bright flash on hover */
.forum-topic-list__sheen {
  display: none;
}
.forum-topic-list__item {
  display: flex;
  align-items: stretch;
  gap: .5rem;
  flex-wrap: nowrap;
}
.forum-topic-list__item .forum-topic-list__card { flex: 1; min-width: 0; }
/* Reserve top-right corner so post-count / time never sit under the trash button */
.forum-topic-list__card .forum-topic-row {
  padding-right: 2.85rem;
}
.forum-topic-list__card .forum-topic-row__delete {
  position: absolute;
  top: .7rem;
  right: .7rem;
  z-index: 3;
  opacity: .55;
  transition: opacity .2s ease, background .2s ease, color .2s ease;
  pointer-events: auto;
}
@media (hover: hover) and (pointer: fine) {
  .forum-topic-list__card:hover .forum-topic-row__delete,
  .forum-topic-list__card .forum-topic-row__delete:focus-visible {
    opacity: 1;
  }
}
/* Global forum: delete stays a flex sibling, not an overlay */
.forum-topic-list__item > .forum-topic-row__delete {
  position: static;
  opacity: .7;
  align-self: flex-start;
  margin-top: 1.1rem;
  flex-shrink: 0;
  z-index: 1;
}
.forum-topic-list__item > .forum-topic-row__delete:hover,
.forum-topic-list__item > .forum-topic-row__delete:focus-visible {
  opacity: 1;
}
.forum-topic-list__engagement {
  flex: 1 1 100%;
  padding: 0 1.1rem .8rem;
  margin-top: -.15rem;
  position: relative;
  z-index: 1;
}
.forum-post-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.forum-reply-box__input.is-focused,
.forum-composer-input.is-focused,
.study-forum .forum-reply-box__input:focus,
.study-forum .forum-composer-input:focus {
  border-color: color-mix(in srgb, var(--study-accent) 45%, hsl(var(--border)));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--study-accent) 14%, transparent);
  outline: none;
}
.forum-reply-box__error {
  margin: .5rem 0 0;
  font-size: .82rem;
  font-weight: 600;
}
.forum-post-edit-error {
  font-size: .78rem;
  font-weight: 600;
  color: hsl(var(--danger, 0 70% 45%));
}
.forum-mention {
  display: inline;
  font-weight: 650;
  color: color-mix(in srgb, var(--study-accent) 82%, hsl(var(--text)));
  background: color-mix(in srgb, var(--study-accent) 12%, transparent);
  padding: .05em .35em;
  border-radius: .35em;
  border: 1px solid color-mix(in srgb, var(--study-accent) 22%, transparent);
}
.study-forum__empty {
  text-align: center;
  padding: 2.5rem 1.5rem;
  border-style: dashed;
}
.study-forum__empty svg {
  width: 2.75rem;
  height: 2.75rem;
  margin: 0 auto .85rem;
  display: block;
  color: color-mix(in srgb, var(--study-accent) 70%, hsl(var(--text-muted)));
  opacity: .85;
}
.study-forum .forum-topic-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
  margin-top: .85rem;
}
@media (max-width: 700px) {
  .study-forum .forum-topic-row { flex-wrap: wrap; }
  .study-forum .forum-topic-row__aside {
    flex-direction: row;
    align-items: center;
    width: 100%;
    justify-content: flex-start;
  }
  .study-forum .forum-topic-header { padding: 1rem 1.05rem; }
  .study-forum .forum-reply-box,
  .study-forum .forum-new-form {
    border-radius: calc(var(--radius) + 4px);
  }
  .forum-topic-list__card .forum-topic-row {
    padding-right: 2.6rem;
  }
  .forum-topic-list__card .forum-topic-row__delete {
    top: .5rem;
    right: .5rem;
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .study-forum .study-stagger > * {
    animation: none !important;
  }
  .study-forum .forum-topic-row,
  .study-forum .forum-post-card,
  .study-forum .forum-reply-card,
  .forum-topic-list__card,
  .forum-topic-list__card::before,
  .forum-topic-row,
  .forum-topic-row::before,
  .forum-topic-row__title,
  .forum-topic-row__chevron {
    transition: none !important;
  }
  .forum-topic-list__item:hover > .forum-topic-row .forum-topic-row__chevron,
  .forum-topic-list__card:hover .forum-topic-row__chevron {
    transform: none;
  }
}

/* ── Wiki / Files elevated aesthetics + engagement ── */
.study-page--wiki .study-page__head--wiki {
  padding: 1.45rem 1.5rem 1.5rem;
}
.wiki-breadcrumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .45rem;
  font-size: .8rem; font-weight: 600;
  color: hsl(var(--text-muted));
  margin: -.35rem 0 0;
}
.wiki-breadcrumb a {
  color: color-mix(in srgb, var(--study-accent) 70%, hsl(var(--text-muted)));
  text-decoration: none;
}
.wiki-breadcrumb a:hover { color: var(--study-accent); }
.wiki-breadcrumb__sep { opacity: .45; }
.wiki-main__sub { margin: .2rem 0 0; font-size: .78rem; }
.wiki-page-list__chevron {
  color: color-mix(in srgb, var(--study-accent) 55%, hsl(var(--text-muted)));
  font-weight: 700; opacity: 0; transition: opacity .25s ease;
  flex-shrink: 0;
}
.study-page .wiki-page-list__item:hover .wiki-page-list__chevron { opacity: 1; }
.wiki-versions__head { margin-bottom: .35rem; }

.study-page .wiki-layout {
  gap: 1.35rem;
  position: relative;
}
.study-page .wiki-sidebar {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: 1.1rem 1rem 1.15rem;
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow), 0 1px 0 hsla(0 0% 100% / .55) inset;
}
.study-page .wiki-sidebar::before {
  content: '';
  position: absolute; z-index: 0; pointer-events: none;
  top: -18%; right: -22%; width: 70%; height: 55%;
  background: radial-gradient(circle, color-mix(in srgb, var(--study-accent) 16%, transparent), transparent 72%);
  filter: blur(22px); opacity: .55;
  animation: blobFloat 22s ease-in-out infinite;
}
.study-page .wiki-sidebar > * { position: relative; z-index: 1; }
.study-page .wiki-sidebar__head h2 {
  font-family: var(--font-head);
  letter-spacing: -.02em;
  font-size: 1rem;
}
.study-page .wiki-new-folder {
  padding: .45rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--study-accent) 5%, hsl(var(--bg-base)));
  border: 1px dashed color-mix(in srgb, var(--study-accent) 22%, hsl(var(--border-light)));
}
.study-page .wiki-folder-tree__link,
.study-page .wiki-nav a {
  transition: background .25s ease, color .25s ease, border-color .25s ease;
}
.study-page .wiki-folder-tree__link:hover,
.study-page .wiki-nav a:hover {
  transform: none;
}

.study-page .wiki-main.panel,
.study-page .wiki-main.study-hub-panel {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: 1.35rem 1.4rem 1.5rem;
  border-radius: calc(var(--radius) + 2px);
}
.study-page .wiki-main.panel::before,
.study-page .wiki-main.study-hub-panel::before {
  content: '';
  position: absolute; z-index: 0; pointer-events: none;
  top: -20%; right: -10%; width: 55%; height: 70%;
  background:
    radial-gradient(circle at 40% 40%, color-mix(in srgb, var(--study-accent) 14%, transparent), transparent 70%),
    radial-gradient(circle at 70% 70%, hsla(168, 40%, 45%, .08), transparent 65%);
  filter: blur(28px); opacity: .65;
  animation: blobFloat 18s ease-in-out infinite;
}
.study-page .wiki-main.panel > *,
.study-page .wiki-main.study-hub-panel > * { position: relative; z-index: 1; }

.wiki-main__toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .65rem 1rem; margin-bottom: 1.15rem;
  padding-bottom: .85rem;
  border-bottom: 1px solid color-mix(in srgb, var(--study-accent) 12%, hsl(var(--border-light)));
}
.wiki-main__heading {
  margin: 0; font-family: var(--font-head); font-size: 1.05rem;
  letter-spacing: -.02em;
}
.wiki-sort { display: inline-flex; gap: .25rem; padding: .2rem;
  border-radius: 999px; background: hsl(var(--bg-surface));
  border: 1px solid hsl(var(--border-light)); box-shadow: var(--shadow);
}
.wiki-sort__link {
  padding: .3rem .7rem; border-radius: 999px; font-size: .75rem; font-weight: 600;
  color: hsl(var(--text-muted)); text-decoration: none;
  transition: background .2s ease, color .2s ease;
}
.wiki-sort__link:hover { color: hsl(var(--text)); background: color-mix(in srgb, var(--study-accent) 8%, transparent); }
.wiki-sort__link.active {
  color: color-mix(in srgb, var(--study-accent) 85%, hsl(var(--text)));
  background: color-mix(in srgb, var(--study-accent) 14%, hsl(var(--bg-surface)));
}

.study-page .wiki-page-list { gap: .65rem; }
.study-page .wiki-page-list__item {
  display: flex; align-items: center; justify-content: space-between; gap: .85rem;
  padding: 1rem 1.1rem;
  border-radius: calc(var(--radius-sm) + 2px);
  border: 1px solid color-mix(in srgb, var(--study-accent) 12%, hsl(var(--border-light)));
  border-left: none;
  background:
    linear-gradient(155deg, color-mix(in srgb, var(--study-accent) 9%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-surface)) 58%),
    hsl(var(--bg-surface));
  box-shadow: 0 1px 0 hsla(0 0% 100% / .5) inset, var(--shadow);
  transition: border-color .28s ease, box-shadow .28s ease, background .28s ease;
  text-decoration: none; color: inherit;
}
.study-page .wiki-page-list__item:hover {
  border-color: color-mix(in srgb, var(--study-accent) 38%, hsl(var(--border-light)));
  box-shadow: var(--shadow-lg), 0 1px 0 hsla(0 0% 100% / .55) inset;
  transform: none;
  background:
    linear-gradient(155deg, color-mix(in srgb, var(--study-accent) 14%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-surface)) 55%),
    hsl(var(--bg-surface));
}
.wiki-page-list__main {
  display: flex; flex-direction: column; gap: .2rem; min-width: 0; flex: 1;
}
.wiki-page-list__title {
  font-family: var(--font-head); font-size: 1.02rem; font-weight: 650;
  letter-spacing: -.02em; line-height: 1.3;
}
.wiki-page-list__meta { font-size: .75rem; }

.study-page__engagement { margin-top: .55rem; }

.engagement {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: .45rem .7rem;
  flex-shrink: 0; position: relative;
}
.engagement__group {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .15rem .35rem .15rem .25rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--study-accent) 6%, hsl(var(--bg-surface)));
  border: 1px solid color-mix(in srgb, var(--study-accent) 14%, hsl(var(--border-light)));
}
.engagement__group--edit {
  background: color-mix(in srgb, var(--study-accent) 10%, hsl(var(--bg-surface)));
  border-color: color-mix(in srgb, var(--study-accent) 28%, hsl(var(--border-light)));
}
.engagement__group--read {
  background: hsla(200, 35%, 96%, .9);
  border-color: hsla(200, 30%, 70%, .35);
}
.engagement__label {
  display: inline-flex; color: color-mix(in srgb, var(--study-accent) 70%, hsl(var(--text-muted)));
  padding-left: .15rem;
}
.engagement__group--read .engagement__label { color: hsl(200, 35%, 42%); }
.engagement .avatar-stack {
  --avatar-stack-ring: color-mix(in srgb, hsl(var(--bg-surface)) 88%, hsla(200, 35%, 96%, .9));
  --avatar-stack-glow: color-mix(in srgb, var(--study-accent, #2F6F5E) 24%, hsla(200, 40%, 55%, .2));
  --avatar-stack-overlap: -8px;
}
.engagement__group--edit .avatar-stack {
  --avatar-stack-ring: color-mix(in srgb, hsl(var(--bg-surface)) 85%, color-mix(in srgb, var(--study-accent) 10%, hsl(var(--bg-surface))));
  --avatar-stack-glow: color-mix(in srgb, var(--study-accent, #2F6F5E) 34%, transparent);
}

button.engagement__group.engagement__trigger {
  cursor: pointer;
  font: inherit;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.engagement__trigger:hover,
.engagement__trigger[aria-expanded="true"] {
  border-color: hsla(200, 40%, 48%, .55);
  background: hsla(200, 40%, 94%, 1);
  box-shadow: 0 0 0 3px hsla(200, 40%, 60%, .12);
}
.engagement__count {
  font-size: .68rem; font-weight: 650; letter-spacing: .02em;
  color: hsl(200, 35%, 38%);
  min-width: .9rem; text-align: center;
  padding-right: .1rem;
}
.engagement__empty-hint {
  font-size: .72rem; font-weight: 600; color: hsl(200, 30%, 42%);
  padding-right: .15rem;
}

/* Host keeps a home slot; live panel is teleported to body. */
.engagement > .engagement__popover[hidden] { display: none !important; }

.engagement-portal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: hsla(160, 18%, 12%, .28);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.engagement-portal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.engagement__popover.engagement__popover--portal {
  position: fixed;
  z-index: 1201;
  left: 0; top: 0;
  width: min(22rem, calc(100vw - 1.5rem));
  max-height: min(20rem, calc(100dvh - 1.5rem));
  overflow: auto;
  padding: .7rem .75rem .8rem;
  margin: 0;
  border-radius: calc(var(--radius-sm) + 2px);
  border: 1px solid color-mix(in srgb, var(--study-accent, #2F6F5E) 18%, hsl(var(--border-light)));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--study-accent, #2F6F5E) 5%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-surface)) 40%),
    hsl(var(--bg-surface));
  box-shadow: var(--shadow-lg), 0 1px 0 hsla(0 0% 100% / .5) inset;
  color: hsl(var(--text));
  animation: engagementPop .18s ease;
  --study-accent: var(--engagement-accent, #2F6F5E);
}
.engagement__popover.engagement__popover--portal[hidden] { display: none !important; }
.engagement__popover-head {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  margin-bottom: .15rem;
}
.engagement__popover-head .engagement__popover-title { margin-bottom: 0; }
.engagement__popover-close {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  width: 1.6rem; height: 1.6rem; border-radius: 999px;
  font-size: 1.15rem; line-height: 1;
  color: hsl(var(--text-muted));
  display: inline-grid; place-items: center;
}
.engagement__popover-close:hover {
  background: color-mix(in srgb, var(--study-accent, #2F6F5E) 10%, transparent);
  color: hsl(var(--text));
}
@keyframes engagementPop {
  from { opacity: 0; transform: translateY(-4px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.engagement__popover-title {
  margin: 0 0 .4rem; font-size: .72rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  color: color-mix(in srgb, var(--study-accent, #2F6F5E) 55%, hsl(var(--text-muted)));
}
.engagement__popover-title--spaced { margin-top: .75rem; }
.engagement__history-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: .35rem;
}
.engagement__history-item {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .45rem;
  padding: .2rem .15rem; border-radius: 6px;
}
.engagement__history-item:hover {
  background: color-mix(in srgb, var(--study-accent, #2F6F5E) 6%, transparent);
}
.engagement__history-name {
  font-size: .82rem; font-weight: 550; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.engagement__history-time {
  font-size: .72rem; color: hsl(var(--text-muted)); white-space: nowrap;
}
.engagement__history-empty { margin: 0; font-size: .8rem; }

@media (max-width: 640px) {
  .engagement__popover.engagement__popover--portal {
    width: min(100vw - 1rem, 24rem);
    max-height: min(70dvh, 28rem);
    border-radius: calc(var(--radius) + 2px);
    padding: .85rem .9rem 1rem;
  }
  .engagement__popover.engagement__popover--portal.is-sheet {
    left: .5rem !important;
    right: .5rem !important;
    width: auto !important;
    bottom: .5rem !important;
    top: auto !important;
    max-height: min(72dvh, 32rem);
    animation: engagementSheet .22s ease;
  }
  @keyframes engagementSheet {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

.forum-topic-engagement { margin-top: .55rem; }

.publication-item__engagement {
  display: flex; flex-wrap: wrap; gap: .4rem;
  margin: .35rem 0 .15rem;
}

.wiki-page-list__row {
  display: flex; align-items: center; gap: .65rem;
  padding-right: .55rem;
  border-radius: calc(var(--radius-sm) + 2px);
  border: 1px solid color-mix(in srgb, var(--study-accent) 14%, hsl(var(--border-light)));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--study-accent) 5%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-surface)) 55%);
  box-shadow: 0 1px 0 hsla(0 0% 100% / .45) inset;
  transition: border-color .28s ease, box-shadow .28s ease;
}
.wiki-page-list__row:hover {
  border-color: color-mix(in srgb, var(--study-accent) 38%, hsl(var(--border-light)));
  box-shadow: var(--shadow-lg), 0 1px 0 hsla(0 0% 100% / .55) inset;
}
.wiki-page-list__row .wiki-page-list__item {
  flex: 1; min-width: 0; border: none; background: transparent; box-shadow: none;
}
.wiki-page-list__row:hover .wiki-page-list__item { border: none; box-shadow: none; }
.wiki-page-list__engagement { flex-shrink: 0; padding-right: .25rem; }

.empty-state--wiki,
.empty-state--files {
  text-align: center;
  padding: 2.75rem 1.5rem;
  border-radius: calc(var(--radius) + 2px);
  border: 1px dashed color-mix(in srgb, var(--study-accent) 28%, hsl(var(--border)));
  background:
    radial-gradient(ellipse 70% 60% at 50% 0%, color-mix(in srgb, var(--study-accent) 12%, transparent), transparent 65%),
    color-mix(in srgb, var(--study-accent) 3%, hsl(var(--bg-surface)));
}
.empty-state__glyph {
  width: 3.25rem; height: 3.25rem; margin: 0 auto .9rem;
  display: grid; place-items: center;
  border-radius: 1rem;
  font-family: var(--font-head); font-weight: 750; font-size: 1.25rem;
  color: color-mix(in srgb, var(--study-accent) 85%, hsl(var(--text)));
  background: color-mix(in srgb, var(--study-accent) 14%, hsl(var(--bg-surface)));
  border: 1px solid color-mix(in srgb, var(--study-accent) 28%, transparent);
  box-shadow: 0 1px 0 hsla(0 0% 100% / .5) inset;
}
.empty-state--wiki h3,
.empty-state--files h3 {
  margin: 0 0 .4rem; font-family: var(--font-head); font-size: 1.2rem; letter-spacing: -.02em;
}
.empty-state--wiki p,
.empty-state--files p { margin: 0 auto 1.1rem; max-width: 26rem; }

/* Wiki reading mode */
.study-page .wiki-content.card {
  position: relative; overflow: hidden; isolation: isolate;
  padding: 1.65rem 1.75rem 2rem;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid color-mix(in srgb, var(--study-accent) 14%, hsl(var(--border-light)));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--study-accent) 6%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-surface)) 28%),
    hsl(var(--bg-surface));
  box-shadow: var(--shadow-lg), 0 1px 0 hsla(0 0% 100% / .55) inset;
}
.study-page .wiki-content.card::before {
  content: '';
  position: absolute; z-index: 0; pointer-events: none;
  top: -12%; right: -8%; width: 48%; height: 42%;
  background: radial-gradient(circle, color-mix(in srgb, var(--study-accent) 16%, transparent), transparent 72%);
  filter: blur(30px); opacity: .55;
  animation: blobFloat 20s ease-in-out infinite;
}
.study-page .wiki-content.card > * { position: relative; z-index: 1; }
.study-page .wiki-content .prose {
  font-size: .98rem; line-height: 1.78; max-width: 46rem;
}
.study-page .wiki-content .prose h1,
.study-page .wiki-content .prose h2,
.study-page .wiki-content .prose h3 {
  font-family: var(--font-head); letter-spacing: -.02em;
  color: color-mix(in srgb, var(--study-accent) 18%, hsl(var(--text)));
}
.study-page .wiki-content .prose h2 {
  margin-top: 1.75rem; padding-bottom: .35rem;
  border-bottom: 1px solid color-mix(in srgb, var(--study-accent) 14%, hsl(var(--border-light)));
}
.study-page .wiki-content .prose a {
  color: color-mix(in srgb, var(--study-accent) 80%, hsl(var(--accent)));
  text-decoration-thickness: 1px; text-underline-offset: .15em;
}
.study-page .wiki-related {
  margin: 0 0 1.35rem; padding: .85rem 1rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--study-accent) 5%, hsl(var(--bg-base)));
  border: 1px solid color-mix(in srgb, var(--study-accent) 14%, hsl(var(--border-light)));
}

.study-page .wiki-versions {
  margin-top: 2rem; padding: 1.15rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--study-accent) 16%, hsl(var(--border-light)));
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--study-accent) 7%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-base)) 100%);
  box-shadow: var(--shadow);
}
.study-page .wiki-versions__title {
  font-family: var(--font-head); letter-spacing: -.02em;
}
.study-page .wiki-versions__item {
  padding: .75rem .85rem;
  border-radius: var(--radius-sm);
  background: hsl(var(--bg-surface));
  border: 1px solid hsl(var(--border-light));
  transition: border-color .25s ease;
}
.study-page .wiki-versions__item--current {
  border-color: color-mix(in srgb, var(--study-accent) 42%, hsl(var(--border)));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--study-accent) 12%, transparent);
}
.study-page .wiki-versions__badge {
  background: color-mix(in srgb, var(--study-accent) 14%, hsl(var(--bg-surface)));
  color: color-mix(in srgb, var(--study-accent) 80%, hsl(var(--text)));
  border: 1px solid color-mix(in srgb, var(--study-accent) 28%, transparent);
}

/* Wiki editor chrome: stable panels, no blob on form inputs */
.wiki-editor-shell { margin-top: .25rem; }
.study-page .wiki-editor { gap: 1.15rem; }
.study-page .wiki-editor__form,
.study-page .wiki-editor__preview {
  position: relative; overflow: hidden; isolation: isolate;
  padding: 1.2rem 1.25rem 1.35rem;
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid color-mix(in srgb, var(--study-accent) 14%, hsl(var(--border-light)));
  background: hsl(var(--bg-surface));
  box-shadow: var(--shadow), 0 1px 0 hsla(0 0% 100% / .5) inset;
  /* no animated blobs on form panels */
}
.study-page .wiki-editor__form::before,
.study-page .wiki-editor__preview::before {
  content: '';
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse 80% 45% at 100% 0%, color-mix(in srgb, var(--study-accent) 8%, transparent), transparent 55%);
  opacity: 1;
}
.study-page .wiki-editor__form > *,
.study-page .wiki-editor__preview > * { position: relative; z-index: 1; }
.wiki-editor__chrome,
.wiki-editor__preview-head {
  display: flex; align-items: center; gap: .45rem;
  margin: -.15rem 0 .85rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: color-mix(in srgb, var(--study-accent) 55%, hsl(var(--text-muted)));
}
.wiki-editor__chrome-dot {
  width: .55rem; height: .55rem; border-radius: 50%;
  background: color-mix(in srgb, var(--study-accent) 75%, hsl(168 45% 40%));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--study-accent) 18%, transparent);
}
.wiki-editor__chrome-dot--preview {
  background: hsl(200, 45%, 48%);
  box-shadow: 0 0 0 3px hsla(200, 45%, 48%, .18);
}
.wiki-editor__actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .35rem;
}
.study-page .wiki-editor__form textarea.input {
  min-height: 24rem;
  border-color: color-mix(in srgb, var(--study-accent) 16%, hsl(var(--border)));
  background: color-mix(in srgb, var(--study-accent) 2%, hsl(var(--bg-base)));
}
.study-page .wiki-editor__form textarea.input:focus {
  border-color: color-mix(in srgb, var(--study-accent) 45%, hsl(var(--border)));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--study-accent) 14%, transparent);
}

/* Files polish + version UI */
.version-badge {
  display: inline-flex; align-items: center;
  font-size: .65rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase;
  padding: .12rem .4rem; border-radius: .3rem; flex-shrink: 0;
  color: color-mix(in srgb, var(--study-accent) 85%, hsl(var(--text)));
  background: color-mix(in srgb, var(--study-accent) 12%, hsl(var(--bg-surface)));
  border: 1px solid color-mix(in srgb, var(--study-accent) 32%, transparent);
}
.version-badge--sm { font-size: .6rem; padding: .08rem .32rem; }
.media-dropzone__icon {
  width: 2.5rem; height: 2.5rem; margin: 0 auto .55rem;
  display: grid; place-items: center; border-radius: .75rem;
  font-size: 1.1rem; font-weight: 700;
  color: color-mix(in srgb, var(--study-accent) 80%, hsl(var(--text)));
  background: color-mix(in srgb, var(--study-accent) 12%, hsl(var(--bg-surface)));
  border: 1px solid color-mix(in srgb, var(--study-accent) 25%, transparent);
}
.study-page .media-dropzone {
  padding: 1.65rem 1.35rem;
  border-radius: calc(var(--radius) + 2px);
  border-width: 2px;
  border-style: dashed;
}
.study-page .media-dropzone:hover {
  border-color: color-mix(in srgb, var(--study-accent) 48%, hsl(var(--border)));
  background: color-mix(in srgb, var(--study-accent) 7%, hsl(var(--bg-surface)));
}
.media-section-hint { margin: .15rem 0 0; font-size: .8rem; }
.study-page .media-file-card {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; gap: .55rem;
  padding: 1rem 1.05rem 1.05rem;
  border-radius: calc(var(--radius-sm) + 2px);
  border: 1px solid color-mix(in srgb, var(--study-accent) 12%, hsl(var(--border-light)));
  border-left: 3px solid color-mix(in srgb, var(--study-accent) 50%, hsl(var(--border-light)));
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--study-accent) 8%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-surface)) 60%);
  box-shadow: var(--shadow), 0 1px 0 hsla(0 0% 100% / .5) inset;
  transition: border-color .28s ease, box-shadow .28s ease;
}
.study-page .media-file-card:hover {
  transform: none;
  border-color: color-mix(in srgb, var(--study-accent) 36%, hsl(var(--border-light)));
  box-shadow: var(--shadow-lg), 0 1px 0 hsla(0 0% 100% / .55) inset;
}
.media-file-card__top { display: flex; gap: .7rem; align-items: flex-start; }
.media-file-card__kind {
  flex-shrink: 0; width: 2.6rem; height: 2.6rem;
  display: grid; place-items: center;
  border-radius: .65rem; font-size: .58rem; font-weight: 800; letter-spacing: .04em;
  color: color-mix(in srgb, var(--study-accent) 80%, hsl(var(--text)));
  background: color-mix(in srgb, var(--study-accent) 12%, hsl(var(--bg-surface)));
  border: 1px solid color-mix(in srgb, var(--study-accent) 22%, transparent);
}
.media-file-card__kind--dicom { background: hsla(200, 45%, 45%, .12); color: hsl(200, 45%, 32%); border-color: hsla(200, 45%, 45%, .3); }
.media-file-card__kind--pdf { background: hsla(0, 55%, 48%, .1); color: hsl(0, 50%, 38%); border-color: hsla(0, 55%, 48%, .28); }
.media-file-card__kind--image { background: hsla(168, 40%, 40%, .12); color: hsl(168, 40%, 28%); border-color: hsla(168, 40%, 40%, .3); }
.media-file-card__head { min-width: 0; flex: 1; }
.media-file-card__title {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem;
  white-space: normal; overflow: visible; text-overflow: unset;
  font-family: var(--font-head); font-size: .92rem; letter-spacing: -.015em;
}
.file-versions {
  margin-top: .15rem; padding: .75rem .8rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--study-accent) 4%, hsl(var(--bg-base)));
  border: 1px solid color-mix(in srgb, var(--study-accent) 14%, hsl(var(--border-light)));
}
.file-versions__title {
  margin: 0 0 .55rem; font-size: .78rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  color: color-mix(in srgb, var(--study-accent) 55%, hsl(var(--text-muted)));
}
.file-versions__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.file-versions__item {
  padding: .55rem .65rem; border-radius: var(--radius-sm);
  background: hsl(var(--bg-surface)); border: 1px solid hsl(var(--border-light));
}
.file-versions__item--current {
  border-color: color-mix(in srgb, var(--study-accent) 40%, hsl(var(--border)));
}
.file-versions__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .78rem;
}
.file-versions__annotation { margin: .25rem 0 .35rem; font-size: .75rem; }
.file-versions__actions { display: flex; flex-wrap: wrap; gap: .25rem; }

.study-page .media-tabs {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--study-accent) 8%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-surface)) 70%);
  border-color: color-mix(in srgb, var(--study-accent) 14%, hsl(var(--border-light)));
}
.study-page .media-tabs__btn.active {
  background: color-mix(in srgb, var(--study-accent) 88%, hsl(168 40% 28%));
  border-color: transparent;
}

@media (max-width: 900px) {
  .study-page .wiki-content.card { padding: 1.25rem 1.15rem 1.5rem; }
  .study-page .wiki-page-list__item { flex-wrap: wrap; }
  .engagement { width: 100%; }
  .wiki-main__toolbar { align-items: flex-start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .study-page .wiki-sidebar::before,
  .study-page .wiki-main.panel::before,
  .study-page .wiki-main.study-hub-panel::before,
  .study-page .wiki-content.card::before {
    animation: none !important;
  }
  .avatar-stack .profile-avatar,
  .avatar-stack .assignee-avatar,
  .study-hub__avatars .profile-avatar,
  .engagement__popover {
    transition: none !important;
    animation: none !important;
  }
  .avatar-stack .profile-avatar:hover,
  .avatar-stack .assignee-avatar:hover,
  .study-hub__avatars .profile-avatar:hover {
    transform: none;
  }
}

/* Study forum settings */
.study-forum__prefs { margin-bottom: 1rem; }
.study-forum__prefs-grid {
  display: flex; flex-wrap: wrap; gap: .65rem 1.25rem;
}
.study-forum__prefs-hint { margin: .5rem 0 0; font-size: .82rem; }
.study-forum-settings__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .85rem 1rem;
  margin-bottom: 1.25rem;
}
.study-forum-settings__field {
  display: flex; flex-direction: column; gap: .35rem;
  font-size: .88rem; font-weight: 600;
}
.study-forum-settings__field .select,
.study-forum-settings__field .input { font-weight: 400; }
.study-forum-settings__toggles {
  display: flex; flex-wrap: wrap; gap: .75rem 1.25rem;
  margin-bottom: 1rem;
}
.study-forum-settings-hint { margin-bottom: 1rem; }
.study-forum-cat-list {
  list-style: none; margin: 0 0 .85rem; padding: 0;
  display: flex; flex-direction: column; gap: .4rem;
}
.study-forum-cat-list li {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; padding: .45rem .6rem;
  border-radius: var(--radius-sm);
  background: hsla(var(--bg-elevated, var(--bg-surface)), .55);
}
.forum-lock-badge {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .72rem; font-weight: 600; letter-spacing: .02em;
  color: hsl(var(--text-secondary));
  border: 1px solid hsla(var(--border), .9);
  border-radius: 999px; padding: .12rem .45rem;
}
.forum-post-card__actions {
  display: flex; align-items: center; gap: .35rem; margin-left: auto;
}
.forum-post-edit { margin-top: .65rem; }
.forum-post-edit-actions { margin-top: .5rem; }

/* Collaborative study hub expansions */
.study-template-picker { border: 0; margin: 1.25rem 0; padding: 0; }
.study-template-picker__hint { margin: 0 0 .75rem; font-size: .88rem; }
.study-template-picker__grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem;
}
.study-template-card {
  position: relative;
  display: flex; flex-direction: column; gap: .35rem;
  padding: .9rem 1rem; border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--bg-surface));
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.study-template-card input {
  position: absolute; inset: 0; opacity: 0; margin: 0;
  width: 100%; height: 100%; cursor: pointer;
}
.study-template-card strong { font-family: var(--font-head); font-size: 1rem; }
.study-template-card span { font-size: .82rem; color: hsl(var(--text-muted)); line-height: 1.35; }
.study-template-card:hover {
  border-color: color-mix(in srgb, #2F6F5E 28%, hsl(var(--border)));
}
.study-template-card:has(input:focus-visible) {
  outline: 2px solid color-mix(in srgb, #2F6F5E 45%, transparent);
  outline-offset: 2px;
}
/* Single-select: only the checked radio gets selected styling (no static --active class). */
.study-template-card:has(input:checked) {
  border-color: color-mix(in srgb, #2F6F5E 55%, hsl(var(--border)));
  box-shadow: 0 0 0 1px color-mix(in srgb, #2F6F5E 35%, transparent);
  background: linear-gradient(165deg, color-mix(in srgb, var(--brand, #2F6F5E) 10%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-surface)) 70%);
}

.study-outline-list { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.study-outline-item {
  display: flex; align-items: center; gap: .55rem;
  padding: .35rem 0; border-bottom: 1px solid hsla(var(--border), .55);
}
.study-outline-item--done .study-outline-item__title {
  text-decoration: line-through; color: hsl(var(--text-muted));
}
.study-outline-item__title { flex: 1; font-size: .9rem; }

.study-hub-activity {
  margin-top: var(--section-gap);
  /* Full-width feed: grow with items; don't inherit equal-height panel clipping. */
  height: auto;
  overflow: visible;
}
.study-hub-activity .study-activity-feed {
  flex: 1 1 auto;
  min-height: 0;
}
.study-hub-badge {
  display: inline-flex; min-width: 1.1rem; height: 1.1rem; padding: 0 .3rem;
  align-items: center; justify-content: center;
  border-radius: 999px; font-size: .65rem; font-weight: 700;
  background: #0F766E; color: #fff; margin-left: .25rem;
}
.study-activity-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.study-activity-item { display: flex; gap: .65rem; align-items: flex-start; }
.study-activity-item__body { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.study-activity-item__link { color: inherit; text-decoration: none; }
.study-activity-item__link:hover { color: #0F766E; }
.study-activity-more {
  display: flex;
  justify-content: center;
  margin-top: .85rem;
  padding-top: .65rem;
  border-top: 1px solid hsla(var(--accent), .1);
  flex-shrink: 0;
}
.study-activity-overlay {
  z-index: 420;
}
.study-activity-overlay__panel {
  width: min(100%, 34rem);
  max-height: min(86dvh, 40rem);
  display: flex;
  flex-direction: column;
  gap: .85rem;
  overflow: hidden;
  background: hsl(var(--bg-surface));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.15rem 1.2rem;
}
.study-activity-overlay__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
}
.study-activity-overlay__head h2 {
  margin: 0;
  font-family: var(--font-head);
  font-size: 1.25rem;
}
.study-activity-overlay__head .muted { margin: .2rem 0 0; font-size: .85rem; }
.study-activity-overlay__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  justify-content: flex-end;
}
.study-activity-feed--overlay {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-right: .15rem;
  gap: .7rem;
}
@media (max-width: 800px) {
  .study-activity-overlay.modal-backdrop {
    align-items: end;
    place-items: end stretch;
    padding: 0;
  }
  .study-activity-overlay__panel {
    width: 100%;
    max-width: none;
    max-height: min(92dvh, 100%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding-bottom: calc(1.15rem + env(safe-area-inset-bottom, 0px));
  }
}
.study-inbox { margin-bottom: .85rem; padding: .75rem; border-radius: var(--radius-sm); background: hsla(168 30% 40% / .06); }
.study-inbox__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.study-inbox__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.study-inbox__link { display: grid; gap: .1rem; text-decoration: none; color: inherit; }
.study-inbox__item {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: .45rem .4rem;
  border-radius: var(--radius-sm);
}
.study-inbox__item--unread { font-weight: 600; background: hsla(168 30% 40% / .08); }
.study-inbox__actor { font-size: .78rem; color: hsl(var(--text-muted)); }
.study-inbox__actions,
.header-bell__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  padding: 0 .35rem .35rem;
}
.task-invite-row { margin-top: .75rem; }
.task-invite-row__controls {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
}
.task-invite-row__controls .select { flex: 1 1 10rem; min-width: 0; }
.task-invite-row__status { margin: .35rem 0 0; font-size: .78rem; }
.study-hub-quick__invite { max-width: 11rem; }
.study-hub-quick__status { margin: .35rem 0 0; font-size: .78rem; }

/* Invite to task — clean shell at dashboard foot */
.study-hub-invite {
  scroll-margin-top: 5.5rem;
}
.study-hub-invite__shell {
  padding: .75rem .85rem;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--study-accent) 14%, hsl(var(--border-light)));
  background: color-mix(in srgb, var(--study-accent) 5%, hsl(var(--bg-muted)));
  transition: border-color .25s ease, background .25s ease;
}
.study-hub-invite__shell.is-ready {
  border-color: color-mix(in srgb, var(--study-accent) 28%, hsl(var(--border-light)));
  background: color-mix(in srgb, var(--study-accent) 7%, hsl(var(--bg-surface)));
}
.study-hub-invite__shell.is-sending {
  opacity: .92;
}
.study-hub-invite__shell.is-sent {
  border-color: color-mix(in srgb, var(--study-accent) 32%, hsl(var(--border-light)));
  background: color-mix(in srgb, var(--study-accent) 10%, hsl(var(--bg-surface)));
}
.study-hub-invite__fields {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(9rem, .9fr) auto;
  gap: .5rem;
  align-items: center;
}
.study-hub-invite__submit {
  min-width: 8.5rem;
  justify-self: start;
}
.study-hub-invite__hint {
  margin: .55rem 0 0;
  font-size: .78rem;
}
.study-hub-invite__error {
  margin: .55rem 0 0;
  font-size: .8rem;
  color: hsl(0 55% 42%);
}
.study-hub-invite__success {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1rem;
}
.study-hub-invite__success strong {
  display: block;
  font-size: .95rem;
  letter-spacing: -.01em;
}
.study-hub-invite__success-mark {
  flex-shrink: 0;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: color-mix(in srgb, var(--study-accent) 75%, hsl(var(--accent)));
  background: color-mix(in srgb, var(--study-accent) 14%, hsl(var(--bg-surface)));
  border: 1.5px solid color-mix(in srgb, var(--study-accent) 28%, hsl(var(--border-light)));
}
.study-invite-morph-enter {
  transition: opacity .3s ease, transform .35s var(--study-hub-ease), max-height .35s ease;
}
.study-invite-morph-enter-start { opacity: 0; transform: translateY(4px); max-height: 0; }
.study-invite-morph-enter-end { opacity: 1; transform: none; max-height: 4rem; }
.study-invite-morph-leave {
  transition: opacity .25s ease, transform .3s var(--study-hub-ease), max-height .3s ease;
}
.study-invite-morph-leave-start { opacity: 1; transform: none; max-height: 4rem; }
.study-invite-morph-leave-end { opacity: 0; transform: translateY(-2px); max-height: 0; }
.study-inbox__item {
  transition: background .3s ease, opacity .3s ease;
}
.study-inbox__item--invite-busy {
  background: color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 8%, transparent);
}
.study-inbox__item--invite-done { opacity: .72; }
@media (max-width: 720px) {
  .study-hub-invite__fields { grid-template-columns: 1fr; }
  .study-hub-invite__submit { width: 100%; min-width: 0; }
  .study-hub-invite__success { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .study-hub-invite__shell,
  .study-inbox__item {
    transition: none !important;
  }
  .study-invite-morph-enter,
  .study-invite-morph-leave {
    transition: opacity .15s ease !important;
  }
  .study-invite-morph-enter-start,
  .study-invite-morph-leave-end {
    transform: none !important;
  }
}

.wiki-discussion {
  margin-top: 1.5rem; padding: 1.15rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 16%, hsl(var(--border-light)));
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--study-accent, hsl(var(--accent))) 7%, hsl(var(--bg-surface))) 0%, hsl(var(--bg-base)) 100%);
  box-shadow: var(--shadow);
  scroll-margin-top: 5.5rem;
}
.wiki-discussion__head { margin-bottom: .75rem; }
.wiki-discussion__head h2 { font-family: var(--font-head); font-size: 1.1rem; margin: 0 0 .25rem; }
.wiki-versions { scroll-margin-top: 5.5rem; }
.wiki-editor__chrome { display: flex; align-items: center; gap: .5rem; margin-bottom: .65rem; }
.wiki-editor__chrome-hint { margin-left: auto; font-size: .75rem; }

.forum-topic-actions { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; margin-top: .65rem; }
.forum-topic-links { margin-top: .65rem; }


/* --- Header icon cluster (Messages + Mentions) --- */
.header-icon-cluster {
  display: inline-flex;
  align-items: center;
  align-self: center;
  gap: .4rem;
  padding: .2rem;
  border-radius: 14px;
  background: linear-gradient(145deg, hsla(158, 40%, 96%, .9), hsla(168, 30%, 98%, .55));
  border: 1px solid hsla(158, 30%, 40%, .1);
}
.header-icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid hsla(158, 35%, 35%, .12);
  background:
    linear-gradient(160deg, hsl(0 0% 100%) 0%, hsl(158 35% 97%) 100%);
  color: hsl(158 40% 28%);
  box-shadow: 0 1px 2px hsla(160, 25%, 20%, .04), inset 0 1px 0 hsla(0, 0%, 100%, .8);
  cursor: pointer;
  text-decoration: none;
  overflow: hidden;
  transition: border-color .2s ease, box-shadow .2s ease, color .2s ease, background .2s ease;
}
.header-icon-btn:hover,
.header-icon-btn:focus-visible {
  color: hsl(var(--accent));
  border-color: hsla(var(--accent), .35);
  box-shadow:
    0 0 0 3px hsla(var(--accent), .12),
    0 4px 14px hsla(var(--accent), .18),
    inset 0 1px 0 hsla(0, 0%, 100%, .9);
  outline: none;
}
.header-icon-btn.is-active {
  color: hsl(var(--accent));
  border-color: hsla(var(--accent), .4);
  background: linear-gradient(160deg, hsl(158 45% 96%) 0%, hsl(158 40% 92%) 100%);
}
.header-icon-btn.is-lit {
  color: hsl(var(--accent));
  border-color: hsla(var(--accent), .45);
  background: linear-gradient(160deg, hsl(158 50% 97%) 0%, hsl(158 42% 91%) 100%);
  box-shadow:
    0 0 0 3px hsla(var(--accent), .14),
    0 0 18px hsla(var(--accent), .28),
    inset 0 1px 0 hsla(0, 0%, 100%, .9);
}
.header-icon-btn.is-lit .header-icon-btn__spark {
  opacity: .85;
  animation: header-icon-spark 1.5s ease-in-out infinite;
}
.header-icon-btn.is-flash {
  animation: header-icon-pulse 1.4s var(--ease-out) 1;
}
@keyframes header-icon-pulse {
  0% { box-shadow: 0 0 0 0 hsla(var(--accent), .45), 0 0 0 0 hsla(var(--accent), .2); }
  40% { box-shadow: 0 0 0 6px hsla(var(--accent), .18), 0 0 22px hsla(var(--accent), .4); }
  100% { box-shadow: 0 0 0 3px hsla(var(--accent), .14), 0 0 18px hsla(var(--accent), .28); }
}
@media (prefers-reduced-motion: reduce) {
  .header-icon-btn.is-lit .header-icon-btn__spark,
  .header-icon-btn.is-flash { animation: none; }
}
.dm-status {
  margin: 0 0 .75rem;
  padding: .55rem .75rem;
  border-radius: var(--radius-sm);
  background: hsl(0 70% 96%);
  color: hsl(0 55% 35%);
  border: 1px solid hsla(0, 55%, 50%, .25);
  font-size: .85rem;
  font-weight: 600;
}
.dm-app.is-ready .dm-shell { opacity: 1; }

.header-icon-btn__sheen {
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, hsla(0,0%,100%,.55) 48%, transparent 62%);
  transform: translateX(-120%);
  pointer-events: none;
}
.header-icon-btn:hover .header-icon-btn__sheen {
  animation: header-icon-sheen 1.1s var(--ease-out);
}
.header-icon-btn__spark {
  position: absolute;
  top: 6px; right: 7px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: hsl(158 70% 48%);
  box-shadow: 0 0 8px hsla(158, 80%, 50%, .7);
  opacity: .35;
  pointer-events: none;
}
.header-icon-btn:hover .header-icon-btn__spark {
  animation: header-icon-spark 1.4s ease-in-out infinite;
}
.header-icon-btn__spark--delay { animation-delay: .2s; top: 8px; right: 11px; width: 3px; height: 3px; }
.header-icon-btn__badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 .28rem;
  border-radius: 999px;
  font-size: .62rem;
  font-weight: 700;
  line-height: 1.05rem;
  text-align: center;
  background: linear-gradient(145deg, hsl(158 55% 38%), hsl(168 50% 32%));
  color: #fff;
  box-shadow: 0 0 0 2px hsl(var(--bg-surface)), 0 2px 6px hsla(158, 40%, 30%, .35);
  z-index: 1;
}
@keyframes header-icon-sheen {
  to { transform: translateX(120%); }
}
@keyframes header-icon-spark {
  0%, 100% { opacity: .25; transform: scale(.85); }
  50% { opacity: .95; transform: scale(1.15); }
}
@media (prefers-reduced-motion: reduce) {
  .header-icon-btn:hover .header-icon-btn__sheen,
  .header-icon-btn:hover .header-icon-btn__spark { animation: none; }
}

.header-bell { position: relative; }
.header-bell__panel {
  position: absolute; right: 0; top: calc(100% + .45rem); z-index: 40;
  width: min(20rem, 84vw); max-height: 22rem; overflow: auto;
  padding: .7rem; border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--bg-surface));
  box-shadow: var(--shadow-lg);
}
.header-bell__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .45rem; }
.header-bell__list { list-style: none; margin: 0; padding: 0; }
.header-bell__list a {
  display: flex; flex-direction: column; gap: .1rem;
  padding: .45rem .35rem; border-radius: var(--radius-sm);
  text-decoration: none; color: inherit; font-size: .85rem;
}
.header-bell__list a:hover { background: hsla(168 30% 40% / .08); }
.header-bell__item--unread a { font-weight: 600; }
.header-bell__empty { margin: .35rem 0; font-size: .82rem; }

.header-admin-links { display: inline-flex; align-items: center; gap: .35rem; }
.header-admin-links .btn.is-active {
  border-color: hsla(var(--accent), .35);
  color: hsl(var(--accent));
  background: hsla(var(--accent), .08);
}

/* Flex (not block + inline-flex) avoids baseline strut space under the pill,
   which otherwise centers a taller box and makes the pill look shifted up. */
.header-user-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
  align-self: center;
}
.user-pill--menu {
  display: inline-flex; align-items: center; gap: .28rem;
  border: 1px solid hsla(var(--accent), .18);
  background: hsl(var(--bg-surface));
  cursor: pointer;
  box-sizing: border-box;
  height: 40px;
  min-height: 40px;
  padding: 0 .5rem 0 .28rem;
  font: inherit;
  font-size: .78rem;
  line-height: 1;
  vertical-align: middle;
}
.user-pill--menu:hover {
  border-color: hsla(var(--accent), .35);
  background: hsla(var(--accent), .06);
}
.user-pill--menu .profile-avatar {
  flex-shrink: 0;
}
.user-pill__label {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  line-height: 1;
}
.user-pill--menu .user-pill__name,
.user-pill--menu .user-pill__role {
  line-height: 1;
  white-space: nowrap;
}
.user-pill__role {
  display: inline-flex;
  align-items: center;
  font-weight: 500;
}
.user-pill__sep {
  margin: 0 .2rem;
  opacity: .5;
  font-weight: 400;
}
/* Block + 1px nudge: stroke path sits optically high vs. text x-height */
.user-pill__caret {
  display: block;
  flex-shrink: 0;
  opacity: .55;
  margin-left: -.02rem;
  transform: translateY(1px);
}
.header-user-menu__panel {
  position: absolute; right: 0; top: calc(100% + .4rem); z-index: 45;
  min-width: 10.5rem;
  padding: .35rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--bg-surface));
  box-shadow: var(--shadow-lg);
}
.header-user-menu__item {
  display: block;
  padding: .55rem .7rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: hsl(var(--text));
  font-size: .85rem;
  font-weight: 600;
}
.header-user-menu__item:hover { background: hsla(var(--accent), .08); color: hsl(var(--accent)); }
.header-user-menu__item--muted { font-weight: 500; color: hsl(var(--text-secondary)); }

.link-chip--publication .link-chip__icon,
.link-chip--forum_thread .link-chip__icon {
  background: currentColor;
  mask-size: contain; -webkit-mask-size: contain;
  mask-repeat: no-repeat; -webkit-mask-repeat: no-repeat;
}
.link-chip--publication .link-chip__icon {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 19h16M7 17V5h10v12'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 19h16M7 17V5h10v12'/%3E%3C/svg%3E");
}
.link-chip--forum_thread .link-chip__icon {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z'/%3E%3C/svg%3E");
}

@media (max-width: 960px) {
  .study-hub__focus--collab { grid-template-columns: 1fr; }
  .study-template-picker__grid { grid-template-columns: 1fr; }
}

/* --- Docs (Wiki + Files) --- */
.docs-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1rem;
  margin: 0 0 1.25rem;
}
.docs-mode-tabs {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
}
.docs-mode-tabs__btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border: 1px solid hsla(var(--accent), .18);
  background: hsla(var(--accent), .04);
  color: hsl(var(--ink));
  border-radius: 999px;
  padding: .4rem .9rem;
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  min-height: var(--touch-min, 40px);
}
.docs-mode-tabs__btn:hover { background: hsla(var(--accent), .1); }
.docs-mode-tabs__btn.active {
  background: hsl(var(--accent));
  border-color: hsl(var(--accent));
  color: #fff;
}
.docs-mode-tabs__count {
  font-size: .75rem;
  font-weight: 500;
  opacity: .8;
}
.docs-search { flex: 1 1 12rem; max-width: 18rem; }
.docs-search .input { width: 100%; }
.docs-pane { animation: fade-in .25s ease; }

/* --- Direct messages --- */
.dm-app {
  max-width: 1080px;
  margin: 0 auto;
  --dm-accent: hsl(var(--accent));
}
.dm-app__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}
.dm-app__head h1 {
  font-family: var(--font-head);
  font-size: clamp(1.55rem, 3vw, 1.95rem);
  margin: .1rem 0 0;
  color: hsl(var(--text));
}
.dm-shell {
  display: grid;
  grid-template-columns: minmax(240px, 300px) 1fr;
  gap: 0;
  min-height: min(68vh, 620px);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--dm-accent) 16%, hsl(var(--border)));
  background: hsl(var(--bg-surface));
  box-shadow: var(--shadow), 0 1px 0 hsla(0 0% 100% / .55) inset;
}
.dm-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}
.dm-main > .dm-thread:not([hidden]),
.dm-main > .dm-empty:not([hidden]) {
  flex: 1;
  min-height: 0;
}
.dm-compose-backdrop:not([hidden]) {
  display: grid;
  place-items: center;
  z-index: 400;
}
.dm-compose-modal {
  position: relative;
  z-index: 1;
  background: hsl(var(--bg-surface));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: min(85dvh, 36rem);
  overflow: auto;
}
.dm-sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid hsla(var(--accent), .1);
  background: linear-gradient(180deg, hsl(158 30% 98%) 0%, hsl(var(--bg-surface)) 40%);
  min-height: 0;
}
.dm-sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1rem;
  border-bottom: 1px solid hsla(var(--accent), .08);
}
.dm-sidebar__head h2 { margin: 0; font-size: 1rem; font-family: var(--font-head); }
.dm-sidebar__unread {
  font-size: .72rem;
  font-weight: 700;
  color: hsl(var(--accent));
  background: hsla(var(--accent), .1);
  padding: .2rem .5rem;
  border-radius: 999px;
}
.dm-conv-list {
  list-style: none;
  margin: 0;
  padding: .4rem;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  scrollbar-gutter: stable;
}
.dm-conv-list > li { min-width: 0; }
.dm-conv {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .65rem;
  align-items: center;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: .55rem .65rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
  /* Inset ring instead of border — no layout/scrollbar flicker on hover/active */
  box-shadow: inset 0 0 0 1px transparent;
  transition: background-color .16s ease, box-shadow .16s ease;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) and (pointer: fine) {
  .dm-conv:hover {
    background: hsla(var(--accent), .07);
    box-shadow: inset 0 0 0 1px hsla(var(--accent), .1);
  }
  .dm-conv.is-active:hover {
    background: hsla(var(--accent), .14);
    box-shadow: inset 0 0 0 1px hsla(var(--accent), .28);
  }
}
.dm-conv:focus-visible {
  outline: none;
  background: hsla(var(--accent), .08);
  box-shadow: inset 0 0 0 1.5px hsla(var(--accent), .4);
}
.dm-conv.is-active {
  background: hsla(var(--accent), .12);
  box-shadow: inset 0 0 0 1px hsla(var(--accent), .24);
}
.dm-conv.is-unread .dm-conv__title { font-weight: 700; }
.dm-conv__avatar { display: flex; flex-shrink: 0; pointer-events: none; }
.dm-conv__body { min-width: 0; display: flex; flex-direction: column; gap: .12rem; pointer-events: none; }
.dm-conv__title, .dm-conv__preview {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dm-conv__preview { font-size: .8rem; color: hsl(var(--text-muted)); }
.dm-conv__badge {
  min-width: 1.2rem; height: 1.2rem; padding: 0 .3rem;
  border-radius: 999px; background: hsl(var(--accent)); color: #fff;
  font-size: .68rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.dm-sidebar__empty {
  padding: 1.5rem 1rem; text-align: center; color: hsl(var(--text-muted));
  display: flex; flex-direction: column; gap: .65rem; align-items: center;
}

.dm-thread {
  display: flex; flex-direction: column; min-height: 0; background: hsl(150 20% 99%);
}
.dm-thread__head {
  display: flex; align-items: center; gap: .65rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid hsla(var(--accent), .1);
  background: hsl(var(--bg-surface));
}
.dm-thread__who { min-width: 0; }
.dm-thread__who h2 { margin: 0; font-size: 1.05rem; font-family: var(--font-head); }
.dm-thread__back { display: none; }
.dm-thread__messages {
  flex: 1; overflow-y: auto; padding: 1rem 1.1rem;
  display: flex; flex-direction: column; gap: .55rem;
  background:
    radial-gradient(ellipse 70% 40% at 8% 0%, hsla(var(--accent), .07), transparent 55%),
    hsl(150 18% 98.5%);
}
.dm-thread__hint { margin: auto; color: hsl(var(--text-muted)); font-size: .9rem; }
.dm-bubble {
  display: flex; gap: .45rem; align-items: flex-end;
  max-width: min(78%, 28rem);
}
.dm-bubble--mine { align-self: flex-end; flex-direction: row-reverse; }
.dm-bubble__content {
  border-radius: 16px 16px 16px 6px;
  padding: .55rem .8rem .4rem;
  background: #fff;
  border: 1px solid hsla(var(--accent), .1);
  box-shadow: 0 1px 2px hsla(160, 20%, 20%, .04);
}
.dm-bubble--mine .dm-bubble__content {
  border-radius: 16px 16px 6px 16px;
  background: linear-gradient(160deg, hsl(158 48% 36%), hsl(168 45% 30%));
  border-color: transparent;
  color: #fff;
}
.dm-bubble__text { margin: 0; white-space: pre-wrap; word-break: break-word; line-height: 1.4; font-size: .92rem; }
.dm-bubble__time {
  display: block; margin-top: .2rem; font-size: .68rem;
  color: hsl(var(--text-muted)); text-align: right;
}
.dm-bubble--mine .dm-bubble__time { color: hsla(0, 0%, 100%, .7); }
.dm-composer {
  display: flex; gap: .5rem; align-items: flex-end;
  padding: .75rem 1rem;
  border-top: 1px solid hsla(var(--accent), .1);
  background: hsl(var(--bg-surface));
  position: sticky; bottom: 0;
}
.dm-composer__input {
  flex: 1; resize: none; min-height: 40px; max-height: 8rem;
  border-radius: 12px;
}
.dm-empty {
  display: grid; place-items: center; padding: 2rem 1rem;
  background:
    radial-gradient(ellipse 60% 50% at 50% 30%, hsla(var(--accent), .08), transparent 70%),
    hsl(150 18% 98.5%);
}
.dm-empty__card {
  text-align: center; max-width: 20rem;
  display: flex; flex-direction: column; align-items: center; gap: .55rem;
}
.dm-empty__glyph {
  width: 3.25rem; height: 3.25rem; border-radius: 16px;
  display: grid; place-items: center;
  color: hsl(var(--accent));
  background: linear-gradient(160deg, hsl(158 45% 96%), hsl(158 40% 90%));
  border: 1px solid hsla(var(--accent), .18);
  box-shadow: 0 6px 18px hsla(var(--accent), .12);
  margin-bottom: .35rem;
}
.dm-empty__card h3 { margin: 0; font-family: var(--font-head); }
.dm-empty__card p { margin: 0 0 .35rem; color: hsl(var(--text-secondary)); font-size: .9rem; line-height: 1.45; }
.dm-compose-modal { max-width: 420px; width: min(92vw, 420px); }
.dm-picker { list-style: none; margin: .75rem 0 0; padding: 0; max-height: 240px; overflow: auto; }
.dm-picker__btn {
  width: 100%; display: flex; align-items: center; gap: .65rem;
  text-align: left; border: 0; background: transparent;
  padding: .55rem .4rem; border-radius: 10px; cursor: pointer;
  font: inherit; color: inherit;
}
.dm-picker__btn:hover { background: hsla(var(--accent), .08); }
.dm-picker__meta { display: flex; flex-direction: column; gap: .05rem; }
.members-list__dm { margin-top: .25rem; display: inline-flex; }

@media (max-width: 800px) {
  .dm-shell { grid-template-columns: 1fr; min-height: 70dvh; }
  .dm-shell--thread .dm-sidebar { display: none; }
  .dm-shell:not(.dm-shell--thread) .dm-main .dm-empty { display: none; }
  .dm-shell--thread .dm-main .dm-empty { display: none; }
  .dm-thread__back { display: inline-flex; }
  .header-icon-btn { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  .user-pill--menu { height: 44px; min-height: 44px; }
  .dm-compose-backdrop:not([hidden]) {
    place-items: end stretch;
    padding: 0;
  }
  .dm-compose-modal {
    width: 100%;
    max-width: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: min(92dvh, 100%);
  }
}

@media (max-width: 640px) {
  .btn, a.btn, .btn-sm, .btn-xs, .study-page__actions .btn {
    min-height: var(--touch-min);
    height: auto;
    --btn-h: var(--touch-min);
  }
}

/* Member public profile */
.profile-avatar-link {
  display: inline-flex;
  text-decoration: none;
  color: inherit;
  border-radius: 50%;
  line-height: 0;
}
.profile-avatar-link:hover .profile-avatar,
.profile-avatar-link:focus-visible .profile-avatar {
  box-shadow: 0 0 0 2px hsl(var(--bg)), 0 0 0 4px var(--profile-color, hsl(var(--accent)));
}
.member-name-link {
  color: inherit;
  text-decoration: none;
  font-weight: inherit;
}
.member-name-link:hover,
.member-name-link:focus-visible {
  color: hsl(var(--accent));
  text-decoration: underline;
  text-underline-offset: 2px;
}

.member-profile {
  --profile-color: #2F6F5E;
  --mp-ease: var(--ease-out);
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.member-profile__eyebrow {
  margin: 0;
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--profile-color) 72%, hsl(var(--text-muted)));
}
.member-profile__hero {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.1rem 1.75rem;
  padding: 1.35rem 1.45rem 1.45rem;
  border-radius: calc(var(--radius-lg) + 2px);
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(
      152deg,
      color-mix(in srgb, var(--profile-color) 16%, hsl(var(--bg-surface))) 0%,
      hsl(var(--bg-surface)) 52%,
      color-mix(in srgb, hsl(var(--mist)) 8%, hsl(var(--bg-surface))) 100%
    );
  border: 1px solid color-mix(in srgb, var(--profile-color) 24%, hsl(var(--border-light)));
  box-shadow:
    0 1px 0 hsla(0 0% 100% / .55) inset,
    0 16px 40px -22px color-mix(in srgb, var(--profile-color) 28%, transparent);
  animation: memberProfileHeroIn .55s var(--mp-ease) both;
}
.member-profile__hero-glow {
  position: absolute;
  inset: -20% auto auto -8%;
  width: min(52%, 22rem);
  height: 140%;
  background:
    radial-gradient(circle at 30% 35%, color-mix(in srgb, var(--profile-color) 28%, transparent), transparent 68%);
  filter: blur(18px);
  opacity: .7;
  pointer-events: none;
  z-index: 0;
  animation: blobFloat 22s ease-in-out infinite;
}
.member-profile__hero > *:not(.member-profile__hero-glow) {
  position: relative;
  z-index: 1;
}
.member-profile__identity {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  min-width: 0;
}
.member-profile__who { min-width: 0; }
.member-profile__who .member-profile__eyebrow {
  margin-bottom: .35rem;
}
.member-profile__who h1 {
  margin: 0;
  font-size: clamp(1.55rem, 2.8vw, 2.15rem);
  line-height: 1.1;
  font-family: var(--font-head);
  letter-spacing: -.03em;
  font-weight: 650;
}
.member-profile__handle {
  margin: .2rem 0 0;
  color: hsl(var(--text-muted));
  font-size: .94rem;
}
.member-profile__bio {
  margin: .55rem 0 0;
  max-width: 38rem;
  color: hsl(var(--text-secondary));
  font-size: .97rem;
  line-height: 1.5;
}
.member-profile__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  align-items: center;
  margin-top: .15rem;
}
.member-profile__body {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}
.member-profile__rail {
  display: flex;
  flex-direction: column;
  gap: .85rem;
  padding: 1.05rem 1.1rem 1.15rem;
  border-radius: calc(var(--radius-lg) + 2px);
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--profile-color) 7%, hsl(var(--bg-surface))) 0%,
      color-mix(in srgb, hsl(var(--bg-muted)) 55%, hsl(var(--bg-surface))) 100%
    );
  border: 1px solid color-mix(in srgb, var(--profile-color) 14%, hsl(var(--border-light)));
  box-shadow: 0 1px 0 hsla(0 0% 100% / .4) inset;
}
.member-profile__rail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .35rem .85rem;
  padding: 0 .15rem;
}
.member-profile__rail-note {
  margin: 0;
  font-size: .82rem;
}
.member-profile__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .85rem;
  align-items: stretch;
}
.member-profile__section {
  --study-accent: var(--profile-color);
  margin: 0;
  min-height: 11.75rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.05rem 1.05rem;
  animation: memberProfileCardIn .5s var(--mp-ease) both;
  animation-delay: calc(var(--mp-i, 0) * 45ms + 80ms);
}
.member-profile__section.panel + .member-profile__section.panel {
  margin-top: 0;
}
.member-profile__section-head {
  margin-bottom: .55rem;
  align-items: flex-start;
  gap: .65rem;
}
.member-profile__section-head h2 {
  margin: 0;
  font-size: .98rem;
  font-weight: 650;
  letter-spacing: -.02em;
}
.member-profile__section-sub {
  margin: .2rem 0 0;
  font-size: .78rem;
  line-height: 1.35;
}
.member-profile__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  height: 1.55rem;
  padding: 0 .4rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--profile-color) 82%, hsl(var(--text)));
  background: color-mix(in srgb, var(--profile-color) 12%, hsl(var(--bg-muted)));
  border: 1px solid color-mix(in srgb, var(--profile-color) 18%, hsl(var(--border-light)));
  flex-shrink: 0;
}
.member-profile__count--zero {
  color: hsl(var(--text-muted));
  background: hsl(var(--bg-muted));
  border-color: hsl(var(--border-light));
}
.member-profile__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .12rem;
  flex: 1 1 auto;
  min-height: 0;
}
.member-profile__row {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  padding: .5rem .45rem;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
  transition: background .22s ease, transform .22s var(--mp-ease);
}
.member-profile__row:hover {
  background: color-mix(in srgb, var(--profile-color) 9%, transparent);
}
.member-profile__row:hover strong {
  color: color-mix(in srgb, var(--profile-color) 55%, hsl(var(--text)));
}
.member-profile__row-main {
  display: flex;
  flex-direction: column;
  gap: .12rem;
  min-width: 0;
}
.member-profile__row-main strong {
  font-size: .92rem;
  font-weight: 600;
  line-height: 1.3;
  transition: color .22s ease;
}
.member-profile__row-main .muted {
  font-size: .76rem;
  line-height: 1.35;
}
.member-profile__partner {
  display: flex;
  align-items: center;
  gap: .4rem;
  min-width: 0;
  padding: .15rem;
  border-radius: 12px;
  background: color-mix(in srgb, hsl(var(--bg-surface)) 72%, transparent);
  border: 1px solid color-mix(in srgb, var(--profile-color) 10%, hsl(var(--border-light)));
}
.member-profile__partner .member-profile__row {
  flex: 1;
  padding: .4rem .45rem;
}
.member-profile__partner .member-profile__row:hover {
  background: transparent;
}
.member-profile__list--partners {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: .55rem;
  flex: 0 1 auto;
}
.member-profile__section--messages {
  min-height: 0;
  padding: 1.1rem 1.2rem 1.2rem;
  animation-delay: .38s;
}
.member-profile__section--messages .member-profile__section-head {
  margin-bottom: .75rem;
}
.member-profile__empty {
  margin: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  font-size: .85rem;
  min-height: 3.5rem;
}

@keyframes memberProfileHeroIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes memberProfileCardIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 960px) {
  .member-profile__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .member-profile__hero { padding: 1.05rem 1rem 1.15rem; }
  .member-profile__identity { align-items: flex-start; }
  .member-profile__rail { padding: .9rem .85rem 1rem; }
  .member-profile__grid {
    grid-template-columns: 1fr;
    gap: .7rem;
  }
  .member-profile__section { min-height: 0; }
  .member-profile__list--partners {
    grid-template-columns: 1fr;
  }
}
@media (prefers-reduced-motion: reduce) {
  .member-profile__hero,
  .member-profile__hero-glow,
  .member-profile__section {
    animation: none !important;
  }
}
