/* CO Hierarchy — hierarchy.communityorg.co.uk
   Mirrors the public-site visual system (Inter + Instrument Serif, aurora,
   gold-on-deep-navy) but with a denser, directory-feel layout. */

* { box-sizing: border-box; }

:root {
  --bg: #07142b;
  --bg-2: #0B1F3A;
  --ink: #EAF1FF;
  --ink-dim: #9BAACB;
  --ink-mute: #6F7FA3;
  --line: rgba(201, 168, 76, 0.18);
  --line-strong: rgba(201, 168, 76, 0.42);
  --gold: #C9A84C;
  --gold-hi: #FFD86B;
  --indigo: #5865F2;
  --indigo-hi: #7C8BFF;
  --card: rgba(13, 27, 58, 0.62);
  --card-hi: rgba(20, 38, 78, 0.78);
  --shadow: 0 18px 40px -20px rgba(0,0,0,0.6);

  --r-sm: 8px;
  --r: 14px;
  --r-lg: 22px;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-feature-settings: 'cv11', 'ss03';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* The HTML `hidden` attribute must beat explicit `display:` values like
   the `display: grid` on `.hero`, or both the not-found and dept panels
   end up stacked on /dept.html. */
[hidden] { display: none !important; }

a { color: inherit; text-decoration: none; }

/* ───── aurora background (lighter than landing — less distracting) */
.aurora {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.blob {
  position: absolute;
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.32;
  mix-blend-mode: screen;
}
.blob-1 { background: radial-gradient(circle, var(--gold) 0%, transparent 60%); top: -25vw; left: -10vw; }
.blob-2 { background: radial-gradient(circle, var(--indigo-hi) 0%, transparent 60%); top: 20vh; right: -20vw; }
.blob-3 { background: radial-gradient(circle, #2c4a8c 0%, transparent 60%); bottom: -20vw; left: 30vw; }
.grain {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2' seed='3'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.07 0'/></filter><rect width='220' height='220' filter='url(%23n)'/></svg>");
  opacity: 0.5;
  mix-blend-mode: overlay;
}
.vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.5) 100%);
}

/* ───── topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px clamp(20px, 4vw, 56px);
  background: linear-gradient(to bottom, rgba(7,20,43,0.92) 0%, rgba(7,20,43,0.72) 70%, transparent 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
}
.brand-text {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.02em;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand-text-dim {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-link {
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-dim);
  border-radius: 99px;
  transition: color .2s, background .2s;
}
.nav-link:hover {
  color: var(--ink);
  background: rgba(255,255,255,0.04);
}
.nav-cta {
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--bg);
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-hi) 100%);
  border-radius: 99px;
  box-shadow: 0 8px 24px -8px rgba(201,168,76,0.5);
  transition: transform .15s, box-shadow .2s;
}
.nav-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -8px rgba(201,168,76,0.65);
}

/* ───── main wrapper */
main {
  position: relative;
  z-index: 1;
  max-width: 1680px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 72px);
}

/* ───── hero */
.hero {
  padding: clamp(28px, 4vw, 56px) 0 clamp(24px, 3.5vw, 44px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 64px);
  align-items: center;
}
.hero-inner {
  max-width: none;
}
.hero-aside {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
    align-items: start;
  }
}
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-dim);
  background: rgba(201,168,76,0.06);
  border: 1px solid var(--line);
  border-radius: 99px;
  margin-bottom: 24px;
}
.kicker-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold-hi);
  box-shadow: 0 0 10px var(--gold-hi);
}
.kicker strong {
  color: var(--ink);
  font-weight: 700;
}
.title {
  font-family: 'Instrument Serif', 'Inter', serif;
  font-weight: 400;
  font-size: clamp(40px, 5vw, 84px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
}
.title .line {
  display: block;
}
.title em {
  font-style: italic;
  color: var(--gold-hi);
}
.title-shimmer {
  background: linear-gradient(120deg, var(--gold) 0%, var(--gold-hi) 50%, var(--gold) 100%);
  background-size: 200% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  animation: shimmer 6s linear infinite;
}
@keyframes shimmer {
  to { background-position: -200% 0; }
}
.title-period {
  color: var(--gold-hi);
}
.lede {
  font-size: clamp(15px, 1.2vw, 17px);
  line-height: 1.6;
  color: var(--ink-dim);
  margin: 0;
}
.hero-search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color .2s, background .2s;
}
.hero-search:focus-within {
  border-color: var(--line-strong);
  background: var(--card-hi);
}
.hero-search svg {
  color: var(--ink-mute);
  flex-shrink: 0;
}
.hero-search input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}
.hero-search input::placeholder {
  color: var(--ink-mute);
}
.hero-search kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 3px 7px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink-dim);
}

/* ───── breadcrumbs (section pages) */
.crumbs {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-mute);
  padding: 18px 0 0;
  margin-bottom: -8px;
}
.crumbs a {
  color: var(--ink-dim);
  transition: color .2s;
}
.crumbs a:hover { color: var(--ink); }
.crumbs-sep { color: var(--ink-mute); opacity: 0.6; }
.crumbs-here {
  color: var(--ink);
  font-weight: 600;
}

/* ───── landing page: hero variant + three entry cards */
.hero-landing {
  padding-bottom: clamp(24px, 4vw, 40px);
}
.hero-landing .hero-inner { max-width: 900px; }
.hero-landing .lede { max-width: 760px; }

.landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: clamp(16px, 2vw, 24px);
  padding: clamp(12px, 3vw, 32px) 0 clamp(48px, 7vw, 88px);
}
.landing-card {
  --lc: var(--gold-hi);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: clamp(26px, 3vw, 36px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .18s, border-color .2s, background .2s;
}
.landing-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--lc) 0%, transparent 55%);
  opacity: 0.06;
  pointer-events: none;
  transition: opacity .2s;
}
.landing-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--lc) 30%, var(--lc) 70%, transparent);
  opacity: 0.55;
}
.landing-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  background: var(--card-hi);
}
.landing-card:hover::before { opacity: 0.12; }
.landing-co       { --lc: #FFD86B; }
.landing-usgrp    { --lc: #7C8BFF; }
.landing-netadmin { --lc: #5BD0FF; }

.landing-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.landing-icon {
  width: 60px;
  height: 60px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--lc);
}
.landing-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  font-weight: 500;
  padding: 6px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
}
.landing-tag-warn {
  background: rgba(255,216,107,0.08);
  border-color: rgba(255,216,107,0.28);
  color: var(--gold-hi);
}
.landing-name {
  margin: 0;
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  font-size: clamp(26px, 2.4vw, 36px);
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.landing-blurb {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-dim);
}
.landing-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0 0;
  margin-top: auto;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--lc);
  letter-spacing: 0.005em;
  border-top: 1px dashed var(--line);
}
.landing-card:hover .landing-cta svg {
  transform: translateX(3px);
}
.landing-cta svg { transition: transform .15s; }

/* Section-tinted kickers */
.kicker-co       { color: var(--ink-dim); border-color: rgba(255,216,107,0.28); background: rgba(255,216,107,0.06); }
.kicker-co .kicker-dot       { background: #FFD86B; box-shadow: 0 0 10px #FFD86B; }
.kicker-usgrp    { color: var(--ink-dim); border-color: rgba(124,139,255,0.28); background: rgba(124,139,255,0.06); }
.kicker-usgrp .kicker-dot    { background: #7C8BFF; box-shadow: 0 0 10px #7C8BFF; }
.kicker-netadmin { color: var(--ink-dim); border-color: rgba(91,208,255,0.28); background: rgba(91,208,255,0.06); }
.kicker-netadmin .kicker-dot { background: #5BD0FF; box-shadow: 0 0 10px #5BD0FF; }

/* ───── org sections */
.org-section {
  --sc: var(--gold-hi);
  padding: clamp(24px, 3.5vw, 48px) 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: 90px;
}
.org-section:first-of-type {
  border-top: 0;
  padding-top: clamp(16px, 2vw, 24px);
}
.org-section#co       { --sc: #FFD86B; }
.org-section#usgrp    { --sc: #7C8BFF; }
.org-section#netadmin { --sc: #5BD0FF; }

.org-head {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 40px);
  align-items: end;
  margin-bottom: clamp(20px, 3vw, 32px);
}
@media (max-width: 960px) {
  .org-head { grid-template-columns: 1fr; align-items: start; }
}
.org-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sc);
  margin-bottom: 14px;
}
.org-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sc);
  box-shadow: 0 0 10px var(--sc);
}
.org-title {
  margin: 0 0 10px;
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.015em;
}
.org-blurb {
  margin: 0;
  font-size: clamp(14.5px, 1.1vw, 16.5px);
  line-height: 1.6;
  color: var(--ink-dim);
  max-width: 720px;
}
.org-blurb code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  padding: 1px 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
}
.org-head-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 6px;
}
.meta-pill {
  font-size: 12.5px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--ink-dim);
  white-space: nowrap;
}
.meta-pill strong {
  color: var(--ink);
  font-weight: 700;
}
.meta-pill-warn {
  background: rgba(255,216,107,0.08);
  border-color: rgba(255,216,107,0.28);
  color: var(--gold-hi);
}
.meta-pill-warn strong {
  color: var(--gold-hi);
}

.org-subhead {
  margin: clamp(20px, 3vw, 32px) 0 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  display: flex;
  align-items: center;
  gap: 14px;
}
.org-subhead::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.org-subhead:first-of-type {
  margin-top: 0;
}

/* ───── unused-from-here-down (kept in case future filters return) */
.filters {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 99px;
  flex-wrap: wrap;
}
.filter {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-dim);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 99px;
  cursor: pointer;
  transition: color .2s, background .2s;
}
.filter:hover { color: var(--ink); }
.filter.is-active {
  color: var(--bg);
  background: var(--gold-hi);
  font-weight: 600;
}

/* ───── department cards */
.dept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.dept-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  transition: transform .15s, border-color .2s, background .2s;
  cursor: pointer;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}
.dept-card-arrow {
  position: absolute;
  right: 18px;
  bottom: 18px;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent, var(--gold-hi));
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.dept-card:hover .dept-card-arrow {
  opacity: 1;
  transform: translateX(0);
}
.dept-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent, var(--gold)) 0%, transparent 40%);
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.dept-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  background: var(--card-hi);
}
.dept-card:hover::before {
  opacity: 0.08;
}
.dept-card.is-hidden {
  display: none;
}
.dept-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.dept-icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--accent, var(--gold-hi));
  flex-shrink: 0;
}
.dept-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 5px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  color: var(--ink-dim);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.dept-name {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.dept-remit {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-dim);
}
.dept-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  margin-top: auto;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--ink-mute);
}
.dept-lead {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.lead-av {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent, var(--gold)) 0%, var(--indigo) 100%);
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--bg);
}
.lead-name {
  color: var(--ink-dim);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dept-headcount {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  white-space: nowrap;
}
.dept-headcount strong {
  color: var(--ink);
  font-weight: 600;
}
.dept-placeholder-tag {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 9px;
  font-family: 'JetBrains Mono', monospace;
  padding: 3px 6px;
  background: rgba(255,216,107,0.1);
  border: 1px solid rgba(255,216,107,0.3);
  border-radius: 4px;
  color: var(--gold-hi);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.depts-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-mute);
  font-size: 14px;
}

/* ───── footer */
.foot {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line);
  margin-top: 40px;
  padding: 28px 0;
  font-size: 13px;
  color: var(--ink-mute);
}
.foot-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 56px);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.foot a { color: var(--ink-dim); }
.foot a:hover { color: var(--ink); }
.foot-dot { color: var(--ink-mute); opacity: 0.5; }
.foot-mute { margin-left: auto; font-family: 'JetBrains Mono', monospace; font-size: 11px; }

/* ───────────────────────────────────────────────────────────────────
   DEPARTMENT DETAIL PAGE
   ─────────────────────────────────────────────────────────────────── */

/* hero meta on /dept.html */
.dept-hero-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-bottom: 16px;
}
.dept-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--ink);
}
.dept-meta-label {
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 600;
}
.dept-meta-row code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 4px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--sc, var(--gold-hi));
  letter-spacing: 0.05em;
}

/* View-mode tabs */
.view-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 99px;
  margin: 0 0 28px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}
.view-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-dim);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 99px;
  cursor: pointer;
  transition: color .2s, background .2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.view-tab:hover { color: var(--ink); }
.view-tab.is-active {
  color: var(--bg);
  background: var(--gold-hi);
}
.view-tab svg { flex-shrink: 0; }

.view-panel {
  padding: 0 0 clamp(48px, 7vw, 96px);
}

/* ───── ORG TREE (CSS-only tree with connector lines) */
.org-tree-wrap {
  position: relative;
  padding: clamp(16px, 2vw, 24px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  /* Shrink to the actual tree width; scroll only when the tree
     is genuinely wider than the page. */
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  overflow-x: auto;
}
.org-tree {
  padding: 4px 0;
  display: flex;
  justify-content: center;
}
.org-tree-root,
.org-tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  gap: 18px;
  position: relative;
}
/* spacing under each node where its children hang */
.org-tree li {
  position: relative;
  padding: 28px 12px 0;
  text-align: center;
}
/* vertical line from parent down to this node */
.org-tree li::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 28px;
  background: var(--line-strong);
}
/* horizontal line over the row when a row has siblings */
.org-tree li::after {
  content: '';
  position: absolute;
  top: 0;
  height: 1px;
  background: var(--line-strong);
}
.org-tree li:only-child::after { display: none; }
.org-tree li:first-child::after { left: 50%; right: -10px; }
.org-tree li:last-child::after  { left: -10px; right: 50%; }
.org-tree li:not(:first-child):not(:last-child)::after { left: -10px; right: -10px; }
/* root nodes have no line above */
.org-tree > .org-tree-root > li::before,
.org-tree > .org-tree-root > li::after {
  display: none;
}
.org-tree > .org-tree-root > li {
  padding-top: 0;
}

.org-node {
  display: inline-block;
  min-width: 200px;
  max-width: 280px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(13,27,58,0.96), rgba(20,38,78,0.88));
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: left;
  position: relative;
  box-shadow: 0 6px 14px -8px rgba(0,0,0,0.6);
}
.org-node::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--sc, var(--gold-hi));
  border-radius: 10px 0 0 10px;
}
.org-node-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.org-node-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--sc, var(--gold-hi));
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.org-node-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--ink);
}
.org-node-title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 4px;
}
.org-node-holder {
  font-size: 12px;
  color: var(--ink-dim);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.org-node-holder::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--sc, var(--gold-hi));
}
.org-node-holder-tbd {
  color: var(--ink-mute);
  font-style: italic;
}
.org-node-holder-tbd::before { background: var(--ink-mute); }

/* ───── LIST view */
.list-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow-x: auto;
}
.position-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.position-table thead th {
  text-align: left;
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 600;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
}
.position-table th.num,
.position-table td.num { text-align: right; }
.position-table tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: top;
}
.position-table tbody tr:last-child td { border-bottom: 0; }
.position-table tbody tr:hover td { background: rgba(255,255,255,0.025); }
.position-table code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  padding: 3px 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--sc, var(--gold-hi));
  letter-spacing: 0.06em;
}
.cell-mute { color: var(--ink-mute); font-style: italic; }

/* ───── MATRIX view */
.matrix-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: clamp(16px, 2vw, 24px);
}
.matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.matrix-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color .2s, background .2s;
}
.matrix-cell::before {
  content: '';
  position: absolute;
  top: 12px; left: 0;
  width: 3px; height: calc(100% - 24px);
  background: var(--sc, var(--gold-hi));
  border-radius: 0 3px 3px 0;
  opacity: 0.7;
}
.matrix-cell:hover {
  border-color: var(--line-strong);
  background: rgba(255,255,255,0.04);
}
.matrix-cell-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.matrix-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--sc, var(--gold-hi));
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 5px;
}
.matrix-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--ink);
}
.matrix-title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}
.matrix-bottom {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--ink-dim);
}
.matrix-holder { font-weight: 600; color: var(--ink); }
.matrix-holder-tbd { color: var(--ink-mute); font-weight: 500; font-style: italic; }
.matrix-reports { font-size: 11.5px; color: var(--ink-mute); }
.matrix-reports strong { color: var(--ink-dim); font-weight: 600; }

/* ───── responsive */
@media (max-width: 640px) {
  .nav-link { display: none; }
  .filters { width: 100%; justify-content: flex-start; overflow-x: auto; }
  .org-node { min-width: 160px; }
}

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