:root {
  --bg: #ffffff;
  --soft: #f5f5f4;
  --ink: #18181b;
  --muted: #71717a;
  --line: #e7e7e5;
  --accent: #0f766e;
  --merged: #7c3aed;
  --open: #16a34a;
  --closed: #dc2626;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111113; --soft: #1c1c1f; --ink: #ececee; --muted: #8e8e96; --line: #26262a;
    --accent: #2dd4bf; --merged: #a78bfa; --open: #4ade80; --closed: #f87171;
  }
}
:root[data-theme="dark"] {
  --bg: #111113; --soft: #1c1c1f; --ink: #ececee; --muted: #8e8e96; --line: #26262a;
  --accent: #2dd4bf; --merged: #a78bfa; --open: #4ade80; --closed: #f87171;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
.prose a, .links a, .soc a, .prs a, td a { color: var(--accent); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; }
img { display: block; }
input, select, button { font: inherit; color: inherit; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* header */
.top { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; gap: 28px; height: 54px; }
.brand { font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.tabs { display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none; height: 100%; }
.tabs a { display: flex; align-items: center; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-color: var(--ink); }

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 20px 0 10px; }
.toolbar input[type="search"] { flex: 1 1 260px; }
input[type="search"], select, .more-f input {
  height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg);
}
input:focus, select:focus { outline: none; border-color: var(--ink); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; height: 38px; }
.seg button { border: 0; background: none; padding: 0 12px; cursor: pointer; color: var(--muted); font-variant-numeric: tabular-nums; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--ink); color: var(--bg); }
.more-f { position: relative; }
.more-f summary { list-style: none; cursor: pointer; height: 38px; display: flex; align-items: center; gap: 6px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; }
.more-f summary::-webkit-details-marker { display: none; }
.more-f[open] summary { border-color: var(--ink); }
#f-count:not(:empty) { background: var(--ink); color: var(--bg); font-size: 11px; border-radius: 9px; padding: 0 6px; }
.more-f-body { position: absolute; right: 0; top: 44px; z-index: 5; width: min(340px, calc(100vw - 32px)); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 8px 30px rgb(0 0 0 / .08); }
.more-f-body label, .lbl { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.more-f-body input { width: 100%; color: var(--ink); }
button.link { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; text-align: left; font-size: 13px; }
button.link:hover { color: var(--ink); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 6px; background: var(--soft); font-size: 12.5px; white-space: nowrap; }
button.chip { border: 1px solid var(--line); background: none; cursor: pointer; padding: 3px 9px; }
button.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c, var(--muted)); display: inline-block; flex: none; }

.stats { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; }
.stats b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.foot { margin: 48px 0 32px; color: var(--muted); font-size: 12px; }

/* org grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.card:hover { color: inherit; border-color: var(--ink); }
.card-head { display: flex; gap: 12px; align-items: center; }
.logo { width: 36px; height: 36px; border-radius: 8px; object-fit: contain; background: #fff; border: 1px solid var(--line); flex: none; }
.logo.big { width: 56px; height: 56px; border-radius: 12px; }
.card h3 { font-size: 15px; }
.card p { margin: 0; color: var(--muted); font-size: 13.5px; }
.meta { font-size: 12.5px; color: var(--muted); }
.card .meta:last-child { margin-top: auto; padding-top: 4px; }
.more { height: 1px; }
.empty { padding: 48px 0; text-align: center; color: var(--muted); }

/* org detail */
.back { display: inline-block; margin: 4px 0 18px; color: var(--muted); font-size: 14px; }
.org-hero { display: flex; gap: 16px; align-items: center; margin-bottom: 28px; }
.org-hero h1 { font-size: 26px; letter-spacing: -.02em; }
.org-hero p { margin: 2px 0 0; color: var(--muted); }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; align-items: start; }
.sec + .sec { margin-top: 28px; }
.sec h2 { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 10px; }
aside .sec { padding-top: 18px; border-top: 1px solid var(--line); }
aside .sec:first-child { padding-top: 0; border-top: 0; }
.prose p { margin: 0 0 10px; }
dl.kv { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.links { display: flex; flex-direction: column; gap: 5px; font-size: 14px; }
.links a { display: flex; align-items: center; gap: 8px; overflow-wrap: anywhere; }
.langbar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; margin: 12px 0 8px; background: var(--soft); }
.langbar i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.src { font-size: 12px; color: var(--muted); margin-top: 8px; }

.year-h { display: flex; align-items: baseline; gap: 10px; margin: 32px 0 4px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.year-h h2 { font-size: 18px; }
details.proj { border-bottom: 1px solid var(--line); }
details.proj summary { list-style: none; cursor: pointer; padding: 12px 0; display: flex; gap: 12px; align-items: center; }
details.proj summary::-webkit-details-marker { display: none; }
details.proj summary:hover b { color: var(--accent); }
.avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; background: var(--soft); object-fit: cover; }
.avatar.lg { width: 48px; height: 48px; }
.ph { display: grid; place-items: center; font-size: 12px; color: var(--muted); font-weight: 600; }
.s-main { min-width: 0; flex: 1; }
.s-main b { display: block; font-weight: 500; }
.s-main span { font-size: 13px; color: var(--muted); }
.s-side { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.proj-body { padding: 4px 0 20px 44px; display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 28px; }
.proj-body h4 { font-size: 13px; color: var(--muted); font-weight: 500; margin: 16px 0 6px; }
.person { display: flex; gap: 12px; align-items: flex-start; }
.person .bio { font-size: 13px; color: var(--muted); margin: 2px 0 4px; }
.soc { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; }
.prs { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.prs li { display: flex; gap: 8px; align-items: baseline; }
.st { font-size: 11px; flex: none; width: 50px; }
.st.merged { color: var(--merged); } .st.open { color: var(--open); } .st.closed { color: var(--closed); }
.warn { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* people table */
.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; min-width: 820px; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { position: sticky; top: 0; background: var(--bg); font-size: 12px; font-weight: 500; color: var(--muted); cursor: pointer; user-select: none; white-space: nowrap; }
th.sorted { color: var(--ink); }
td .who { display: flex; gap: 10px; align-items: center; min-width: 170px; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* insights */
.ins-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 36px 48px; }
.bars { display: flex; flex-direction: column; gap: 5px; }
.bar { display: grid; grid-template-columns: 120px minmax(0, 1fr) 40px; gap: 10px; align-items: center; font-size: 13.5px; }
.bar > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .track { height: 6px; border-radius: 3px; background: var(--soft); overflow: hidden; }
.bar .fill { height: 100%; background: var(--ink); border-radius: 3px; }
.bar .n { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  .detail, .proj-body { grid-template-columns: 1fr; gap: 20px; }
  .proj-body { padding-left: 0; }
}
@media (max-width: 560px) {
  .top-row { gap: 18px; }
  .tabs { gap: 16px; }
  .toolbar select, .seg { flex: 1 1 auto; }
  .seg button { flex: 1; }
  .toolbar { position: relative; }
  .more-f { position: static; }
  .more-f-body { left: 0; right: 0; top: auto; width: auto; margin-top: 6px; }
  .org-hero { align-items: flex-start; }
  .bar { grid-template-columns: 90px minmax(0, 1fr) 36px; }
}
.links .lk { display: inline-flex; align-items: center; gap: 6px; min-width: 92px; color: var(--muted); font-size: 13px; flex: none; }
.rank { width: 22px; flex: none; text-align: right; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.s-side { text-align: right; line-height: 1.45; }
@media (max-width: 560px) {
  details.proj summary { flex-wrap: wrap; }
  .s-side { white-space: normal; text-align: left; flex-basis: 100%; padding-left: 66px; }
}
.seg.progs { height: 30px; flex: none; }
.progs a { display: flex; align-items: center; padding: 0 10px; color: var(--muted); font-size: 13px; }
.progs a + a { border-left: 1px solid var(--line); }
.progs a.on { background: var(--ink); color: var(--bg); }
@media (max-width: 560px) { .brand { display: none; } .seg.progs { flex: none; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
