/* data13f: plain, readable, table-first. No external fonts or assets. */

/* Theme: system preference by default; <html data-theme="light|dark">
   (set from localStorage by the inline head script, or by the toggle)
   overrides it. The dark set appears twice because CSS cannot share one
   block between a media query and an attribute selector. */

:root,
:root[data-theme="light"] {
  color-scheme: light;
  --theme-icon: "\263E\FE0E";   /* moon: click for dark */
  --bg: #ffffff;
  --fg: #1c1e22;
  --num: #15171b;
  --muted: #646a74;
  --faint: #70767f;     /* placeholder text: 4.5:1 on --bg */
  --line: #e4e6ea;
  --line-strong: #c8ccd2;
  --head: #f5f6f8;
  --zebra: #fafbfc;
  --hover: #edf3f5;
  --link: #0d6466;
  --link-hover: #08484a;
  --accent: #2f8f8c;
  --bar: #358a87;
  --bar-track: #e6eeee;
  --pos: #1f6a3c;
  --pos-bg: #e4f2e9;
  --pos-line: #a9d3b7;
  --neg: #9e3129;
  --neg-bg: #f9e8e6;
  --neg-line: #e3b2ad;
  --same: #5b616a;
  --same-bg: #eef0f2;
  --ad-bg: #f7f8f9;
  --focus: #2f8f8c;

  --wrap: 1200px;      /* content width */
  --side: 300px;       /* side ad column */
  --side-gap: 24px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --theme-icon: "\2600\FE0E";   /* sun: click for light */
  --bg: #121417;
  --fg: #e2e4e8;
  --num: #f0f2f5;
  --muted: #979ea8;
  --faint: #7e858f;
  --line: #262a30;
  --line-strong: #3b4048;
  --head: #1a1d22;
  --zebra: #15181c;
  --hover: #1c252a;
  --link: #62c3c0;
  --link-hover: #8fd8d5;
  --accent: #4fb3af;
  --bar: #45a5a1;
  --bar-track: #263433;
  --pos: #86d29f;
  --pos-bg: #182a1f;
  --pos-line: #2f5a3e;
  --neg: #f0968d;
  --neg-bg: #33201e;
  --neg-line: #6a3530;
  --same: #a4abb4;
  --same-bg: #23272d;
  --ad-bg: #171a1e;
  --focus: #4fb3af;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --theme-icon: "\2600\FE0E";
    --bg: #121417;
    --fg: #e2e4e8;
    --num: #f0f2f5;
    --muted: #979ea8;
    --faint: #7e858f;
    --line: #262a30;
    --line-strong: #3b4048;
    --head: #1a1d22;
    --zebra: #15181c;
    --hover: #1c252a;
    --link: #62c3c0;
    --link-hover: #8fd8d5;
    --accent: #4fb3af;
    --bar: #45a5a1;
    --bar-track: #263433;
    --pos: #86d29f;
    --pos-bg: #182a1f;
    --pos-line: #2f5a3e;
    --neg: #f0968d;
    --neg-bg: #33201e;
    --neg-line: #6a3530;
    --same: #a4abb4;
    --same-bg: #23272d;
    --ad-bg: #171a1e;
    --focus: #4fb3af;
  }
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, th:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

/* skip link: off-screen until focused */
a.skip {
  position: absolute;
  left: 8px;
  top: -100px;
  z-index: 10;
  padding: 8px 14px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}
a.skip:focus { top: 8px; text-decoration: none; }

h1, h2, h3 { line-height: 1.25; margin: 0; color: var(--fg); }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; margin: 22px 0 4px; }
h2 { font-size: 16px; font-weight: 650; margin: 26px 0 10px; }
h3 { font-size: 14px; font-weight: 650; margin: 18px 0 6px; }
p { margin: 8px 0; }
main p, main li, footer p { overflow-wrap: anywhere; }

/* ---------- header / footer ---------- */

header.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 22px;
  padding: 8px max(16px, calc((100% - var(--wrap)) / 2 + 16px));
  background: var(--head);
  border-bottom: 1px solid var(--line-strong);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--fg);
  text-decoration: none;
}
.brand-mark { flex: none; display: block; border-radius: 7px; }
.brand-word {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1;
}
.brand-word b {
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: lining-nums;
  margin-left: 1px;
}
.brand:hover { color: var(--fg); text-decoration: none; }
header.top nav { display: flex; flex-wrap: wrap; gap: 0 4px; }
header.top nav a { color: var(--muted); padding: 4px 8px; border-radius: 3px; }
header.top nav a:hover { color: var(--fg); background: var(--hover); text-decoration: none; }
header.top nav a[aria-current="page"] { color: var(--fg); font-weight: 600; }

/* light/dark switch: glyph shows the mode a click switches to */
.theme-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-top: -4px;
  margin-bottom: -4px;
  padding: 0;
  font: inherit;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}
.theme-toggle::before {
  content: var(--theme-icon);
  font-size: 17px;
  line-height: 1;
}
.theme-toggle:hover { color: var(--fg); background: var(--hover); border-color: var(--line); }

main {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 16px 24px;
}

footer {
  max-width: var(--wrap);
  margin: 28px auto 0;
  padding: 14px 16px 30px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------- page furniture ---------- */

.meta { color: var(--muted); font-size: 13px; margin: 2px 0 14px; }
.note { color: var(--muted); font-size: 12.5px; }
p.note { margin: 10px 0 4px; }
div.note { font-size: 12px; line-height: 1.35; }

.stats {
  display: flex;
  flex-wrap: wrap;
  margin: 12px 0 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.stats > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 7px 16px 8px;
  border-right: 1px solid var(--line);
}
.stats > div:last-child { border-right: 0; }
.stats .k { color: var(--muted); font-size: 12px; white-space: nowrap; }
.stats .v {
  color: var(--num);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

nav.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0 2px;
  margin: 16px 0 0;
  border-bottom: 1px solid var(--line-strong);
}
nav.tabs a {
  padding: 7px 14px 6px;
  margin-bottom: -1px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 4px 4px 0 0;
}
nav.tabs a:hover { color: var(--fg); text-decoration: none; background: var(--hover); }
nav.tabs a.on {
  color: var(--fg);
  font-weight: 600;
  background: var(--bg);
  border-color: var(--line-strong) var(--line-strong) var(--bg);
}

ul.recent {
  margin: 4px 0 8px;
  padding-left: 18px;
  columns: 2 22em;
  column-gap: 32px;
  font-size: 13px;
}
ul.recent li { break-inside: avoid; margin: 2px 0; }

/* ---------- filter ---------- */

input.filter {
  font: inherit;
  font-size: 13px;
  width: 18em;
  max-width: calc(100% - 7.5em);
  margin: 0 0 8px;
  padding: 5px 9px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
}
input.filter::placeholder { color: var(--faint); opacity: 1; }
.count {
  display: inline-block;
  margin-left: 8px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- tables ---------- */

.scroll {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
/* app.js adds .fits when the table needs no horizontal scroll, so the
   sticky header sticks to the page instead of to the wrapper. A table that
   does scroll sideways gets .wide: the wrapper then also scrolls vertically
   (capped height), so the header sticks to the top of the wrapper. */
.scroll.fits { overflow: visible; }
.scroll.wide { overflow: auto; max-height: 85vh; overscroll-behavior-x: contain; }

table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
table.data th,
table.data td {
  padding: 5px 10px;
  text-align: left;
  vertical-align: baseline;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.data th:first-child, table.data td:first-child { padding-left: 8px; }
table.data thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--head);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  vertical-align: bottom;
  border-bottom: 1px solid var(--line-strong);
  user-select: none;
}
table.data th[data-sort] { cursor: pointer; }
table.data th[data-sort]:hover { color: var(--fg); }
table.data th[data-sort]::after {
  content: "\25BC";
  display: inline-block;
  width: 1em;
  margin-left: 3px;
  font-size: 8px;
  text-align: center;
  vertical-align: 1px;
  opacity: 0;
}
table.data th[data-sort]:hover::after { opacity: 0.35; }
table.data th.asc::after { content: "\25B2"; opacity: 1 !important; }
table.data th.desc::after { content: "\25BC"; opacity: 1 !important; }
table.data th.asc,
table.data th.desc { color: var(--fg); }

/* faint zebra that stays correct while filtering (ignored by old browsers) */
table.data tbody tr:nth-child(even of :not([hidden])) td { background: var(--zebra); }
table.data tbody tr:hover:not([hidden]) td { background: var(--hover); }
table.data tbody tr:last-child td { border-bottom-color: var(--line-strong); }

table.data th.num,
table.data td.num { text-align: right; }
td.num { color: var(--num); font-variant-numeric: tabular-nums; }

td.tk { font-weight: 600; }
td.name {
  max-width: 26em;
  overflow: hidden;
  text-overflow: ellipsis;
}
table.data td.note { white-space: normal; }

/* muted rows: closed positions, managers whose latest filing is older */
tr.exit td, tr.stale td { color: var(--muted); }
tr.exit td a, tr.stale td a { color: inherit; }
tr.exit td a:hover, tr.stale td a:hover { color: var(--fg); }
tr.exit .bar { opacity: 0.5; }

/* weight bar next to a number: 60px track, inner width is % of 100 */
.bar {
  display: inline-block;
  width: 60px;
  height: 7px;
  margin-left: 7px;
  vertical-align: 0;
  background: var(--bar-track);
  border-radius: 1px;
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  max-width: 100%;
  min-width: 1px;
  background: var(--bar);
}

/* ---------- change badges ---------- */

.chg {
  display: inline-block;
  padding: 0 6px;
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 3px;
}
.chg.new    { color: var(--pos); background: var(--pos-bg); border-color: var(--pos-line); font-weight: 600; }
.chg.add    { color: var(--pos); background: var(--pos-bg); }
.chg.reduce { color: var(--neg); background: var(--neg-bg); }
.chg.exit   { color: var(--neg); background: var(--neg-bg); border-color: var(--neg-line); font-weight: 600; }
.chg.same   { color: var(--same); background: var(--same-bg); }

/* activity page: several stock + badge groups in one cell */
.acts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  white-space: normal;
}
.act { white-space: nowrap; }
.act .note { font-size: 12px; }

/* ---------- ad slots ----------
   Hidden unless <body class="ads-on">. When on, each slot reserves its
   final size up front so a later ad fill causes no layout shift. */

.ad-slot { display: none; }

body.ads-on .ad-slot {
  display: block;
  width: 100%;
  margin: 16px auto;
  background: var(--ad-bg);
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
  contain: layout paint;
}
body.ads-on .ad-slot[data-slot="top"]    { min-height: 90px; max-width: 970px; margin: 10px 0 16px; }
body.ads-on .ad-slot[data-slot="inline"] { min-height: 250px; }
body.ads-on .ad-slot[data-slot="side"]   { display: none; }

@media (min-width: 1200px) {
  body.ads-on {
    --wrap: calc(1200px + var(--side) + var(--side-gap));
  }
  body.ads-on main {
    position: relative;
    min-height: 660px;
    padding-right: calc(16px + var(--side) + var(--side-gap));
  }
  body.ads-on .ad-slot[data-slot="side"] {
    display: block;
    position: absolute;
    top: 0;   /* level with the h1: its top margin collapses through main */
    right: 16px;
    width: var(--side);
    min-height: 600px;
    margin: 0;
  }
}

/* ---------- tablets and phones: lower-priority columns ---------- */

@media (max-width: 959.98px) {
  table.data .opt { display: none; }
}

/* ---------- small screens: readability over density ---------- */

@media (max-width: 639.98px) {
  body { font-size: 15px; }
  h1 { font-size: 20px; margin-top: 16px; }
  h2 { font-size: 16px; margin-top: 22px; }

  /* names and tickers may wrap onto a second line; numbers stay on one */
  table.data td:first-child,
  table.data td.tk {
    white-space: normal;
    max-width: 10em;
    overflow-wrap: break-word;
  }

  /* header: brand on its own line, nav as one swipeable row */
  header.top { display: block; position: relative; padding: 6px 0 0; }
  .theme-toggle { position: absolute; top: 6px; right: 8px; width: 44px; height: 40px; margin: 0; }
  .brand { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; }
  header.top nav {
    flex-wrap: nowrap;
    gap: 0;
    padding: 0 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
  }
  header.top nav::-webkit-scrollbar { display: none; }
  header.top nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 10px;
    font-size: 14.5px;
    white-space: nowrap;
    border-radius: 0;
  }
  header.top nav a:last-child { margin-right: 20px; }

  .meta { font-size: 13.5px; }
  .note { font-size: 13px; }

  /* stats: 2-column grid with hairline separators */
  .stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--line);
    overflow: hidden;
  }
  .stats > div { padding: 8px 12px 9px; border-right: 0; background: var(--bg); }
  .stats > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stats .k { font-size: 12.5px; white-space: normal; }
  .stats .v { font-size: 17px; white-space: normal; }

  nav.tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  nav.tabs::-webkit-scrollbar { display: none; }
  nav.tabs a { display: inline-flex; align-items: center; min-height: 42px; padding: 0 14px; white-space: nowrap; }

  input.filter { font-size: 16px; min-height: 42px; width: 100%; max-width: calc(100% - 6.5em); }

  table.data { font-size: 14px; }
  table.data th, table.data td { padding: 9px 5px; }
  /* headers may wrap too, so a long label doesn't set the column width */
  table.data thead th { font-size: 12.5px; padding-top: 10px; padding-bottom: 10px; white-space: normal; }
  table.data td { border-bottom-color: var(--line-strong); }
  td.name { max-width: 8.5em; }
  .bar { width: 28px; margin-left: 4px; }
  .chg { font-size: 12.5px; line-height: 20px; }

  ul.recent li { margin: 6px 0; }
}

@media print {
  header.top nav, nav.tabs, input.filter, .count, .ad-slot, .theme-toggle { display: none !important; }
  .scroll, .scroll.wide { overflow: visible; max-height: none; }
  table.data thead th { position: static; }
}

/* compare */

.cmp-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  gap: 8px 14px;
  margin: 10px 0 14px;
}
.cmp-side { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cmp-side label { color: var(--muted); font-size: 12px; font-weight: 600; }
.cmp-side select {
  font: inherit;
  font-size: 14px;
  width: 100%;
  min-height: 34px;
  padding: 5px 8px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
}
.cmp-swap {
  align-self: start;
  margin-top: 22px;            /* level with the selects, below their labels */
  min-height: 34px;
  padding: 0 12px;
  font: inherit;
  font-size: 13px;
  color: var(--fg);
  background: var(--head);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
}
.cmp-swap:hover { background: var(--hover); }
.cmp-swap span { color: var(--accent); }
.cmp-side select:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.cmp-info { font-size: 12px; }

.cmp-sum { margin: 4px 0 2px; font-size: 14.5px; }
.cmp-sum strong { color: var(--num); font-weight: 650; font-variant-numeric: tabular-nums; }
p.cmp-counts { margin: 0 0 10px; }
.cmp-msg { margin: 12px 0; }
.cmp-err { color: var(--neg); }
.cmp-warn {
  margin: 8px 0 12px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--fg);
  background: var(--same-bg);
  border-left: 3px solid var(--accent);
  border-radius: 2px;
}

/* investor names as column headers: let them wrap instead of widening */
table.data th.cmp-col { white-space: normal; min-width: 7.5em; max-width: 12em; }
.cmp-sub { display: block; font-weight: 400; font-size: 11.5px; }

.cmp-onlys { margin-top: 18px; }
.cmp-only-sec { margin: 0 0 8px; border: 1px solid var(--line); border-radius: 4px; }
.cmp-only-sec summary {
  padding: 7px 10px;
  font-weight: 600;
  cursor: pointer;
  background: var(--head);
  border-radius: 4px;
}
.cmp-only-sec[open] summary { border-bottom: 1px solid var(--line); border-radius: 4px 4px 0 0; }
.cmp-only-sec summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.cmp-only-sec > p { margin: 8px 10px; }
table.data.cmp-only { width: auto; min-width: 100%; }
table.data.cmp-only tbody tr:last-child td { border-bottom: 0; }

@media (max-width: 639.98px) {
  .cmp-controls { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .cmp-swap { justify-self: center; margin-top: 0; min-height: 40px; padding: 0 18px; }
  .cmp-swap span { display: inline-block; transform: rotate(90deg); }
  .cmp-side select { font-size: 16px; min-height: 42px; }
  .cmp-sum { font-size: 15px; }
  .cmp-only-sec summary { padding: 10px 12px; }
  table.data th.cmp-col { min-width: 6em; }
}

/* charts (scripts/lib/charts.mjs) */
.spark { display: block; color: var(--accent); overflow: visible; }
.spark polyline { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
.spark polygon { fill: currentColor; opacity: .14; stroke: none; }
.chart { margin: 8px 0 18px; max-width: 760px; }
.chart svg { display: block; width: 100%; height: 180px; color: var(--accent); }
.chart .area { fill: currentColor; opacity: .14; }
.chart .line { fill: none; stroke: currentColor; stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.chart .bar-mark { fill: currentColor; opacity: .75; }
.chart .bar-mark:hover { opacity: 1; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--hover); opacity: .6; }
.chart .axis, .chart .tick { stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-top, .chart-bot { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart-top b { color: var(--num); font-weight: 600; }
.chart figcaption { font-size: 12px; color: var(--muted); margin-top: 2px; }
.charts2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 24px; }
@media (max-width: 639.98px) { .chart svg { height: 130px; } }

/* investor page "at a glance" boxes */
.glance { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 14px 0 18px; }
.glance-box { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; background: var(--bg); }
.glance-box h3, h2.glance-h { margin: 0 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.glance-box ol { margin: 0; padding-left: 18px; }
.glance-box li { padding: 3px 0; line-height: 1.5; }
/* phones: the boxes repeat the Changes tab, so hide them to keep holdings near the top */
@media (max-width: 639.98px) { .glance { display: none; } }

/* TradingView price chart on stock pages (assets/tvchart.js) */
.tv-wrap { margin: 14px 0 18px; max-width: 900px; }
.tv { height: 380px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--bg); }
.tv-credit { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
@media (max-width: 639.98px) { .tv { height: 300px; } }
@media print { .tv-wrap { display: none; } }

/* phones: keep all section tabs visible (investor and stock pages have 5-6) */
@media (max-width: 639.98px) {
  nav.tabs { flex-wrap: wrap; overflow-x: visible; }
  nav.tabs a { padding-left: 9px; padding-right: 9px; }
}
