:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17211b;
  background: #f4f6f3;
  font-synthesis: none;
}

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

body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; letter-spacing: 0; }
button, select, input { border-radius: 6px; }
button { cursor: pointer; }
a { color: inherit; }

.topbar {
  min-height: 72px;
  padding: 12px clamp(18px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: #fff;
  background: #173f32;
  border-bottom: 4px solid #d5a72f;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px; color: #173f32; background: #f3cb55; font-weight: 800; }
.brand h1 { margin: 0; font-size: 18px; line-height: 1.2; }
.brand p { margin: 3px 0 0; color: #cddbd4; font-size: 12px; }
.topbar nav { display: flex; align-items: center; gap: 8px; }
.download-link, .about-button { padding: 8px 12px; border: 1px solid #7c9b8d; color: #fff; background: transparent; text-decoration: none; }
.about-button { white-space: nowrap; }
.download-link:hover, .about-button:hover { background: #245844; }

main { width: min(1500px, 100%); margin: 0 auto; }
.summary { padding: 28px clamp(18px, 4vw, 56px) 24px; display: flex; justify-content: space-between; align-items: end; gap: 36px; background: #fff; border-bottom: 1px solid #dce2dd; }
.eyebrow { margin: 0 0 6px; color: #8a6012; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.summary h2 { margin: 0; font-size: clamp(24px, 3vw, 38px); line-height: 1.15; }
.metrics { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(90px, 1fr)); border: 1px solid #dce2dd; }
.metrics div { padding: 10px 16px; border-right: 1px solid #dce2dd; }
.metrics div:last-child { border-right: 0; }
.metrics dt { color: #607068; font-size: 11px; white-space: nowrap; }
.metrics dd { margin: 3px 0 0; font-size: 21px; font-weight: 750; }

.workspace { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: calc(100vh - 180px); }
.filters { padding: 24px 20px 40px; background: #e9eeea; border-right: 1px solid #d5ddd7; }
.search-field label, .filter-row label, fieldset legend { display: block; margin-bottom: 7px; color: #46564e; font-size: 12px; font-weight: 700; }
.search-field input, .filter-row select, .sort-control select { width: 100%; border: 1px solid #b8c4bc; background: #fff; color: #17211b; }
.search-field input { height: 40px; padding: 0 11px; }
.search-field input:focus, select:focus { outline: 2px solid #2d7457; outline-offset: 1px; }
fieldset { margin: 24px 0 0; padding: 0; border: 0; }
.segmented { display: grid; gap: 5px; }
.segmented button { padding: 9px 10px; text-align: left; border: 1px solid transparent; color: #31423a; background: transparent; }
.segmented button:hover { background: #dce6df; }
.segmented button.active { color: #fff; background: #276348; border-color: #276348; font-weight: 700; }
.filter-row { margin-top: 22px; }
.filter-row select { height: 38px; padding: 0 8px; }
.check-row { margin-top: 22px; display: flex; align-items: center; gap: 9px; color: #31423a; font-size: 13px; }
.check-row input { width: 17px; height: 17px; accent-color: #276348; }
.reset-button { width: 100%; margin-top: 24px; padding: 9px; border: 1px solid #aebbb3; background: transparent; color: #46564e; }
.reset-button:hover { background: #fff; }

.results { min-width: 0; padding: 22px clamp(16px, 3vw, 40px) 50px; }
.results-head { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid #d8dfda; }
.results-head p { margin: 0; color: #536159; font-size: 13px; }
.sort-control { display: flex; align-items: center; gap: 8px; color: #607068; font-size: 12px; white-space: nowrap; }
.sort-control select { height: 32px; padding: 0 8px; }
.people-list { display: grid; }
.person-row { width: 100%; min-height: 104px; padding: 14px 8px; display: grid; grid-template-columns: 64px minmax(160px, 1.05fr) minmax(170px, 1.4fr) minmax(150px, 1fr); gap: 16px; align-items: center; border: 0; border-bottom: 1px solid #d8dfda; color: inherit; background: transparent; text-align: left; }
.person-row:hover { background: #fff; }
.portrait { width: 56px; height: 70px; object-fit: cover; background: #dce3de; border: 1px solid #cbd5ce; }
.initials { display: grid; place-items: center; color: #52635a; font-size: 15px; font-weight: 800; }
.person-primary strong { display: block; font-size: 16px; }
.person-primary span, .person-position, .term-group-label { color: #607068; font-size: 12px; }
.person-position { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 3; -webkit-box-orient: vertical; line-height: 1.45; }
.term-group { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.term-group + .term-group { margin-top: 7px; }
.term-group-label { width: 46px; }
.badge { padding: 3px 6px; color: #244c3a; background: #dceadf; border: 1px solid #bad2c0; font-size: 11px; line-height: 1; }
.badge.pb { color: #7a4d00; background: #f7e7b8; border-color: #e2c66e; }
.badge.na { color: #284d6a; background: #dceaf2; border-color: #b9d0dd; }
.badge.alt { color: #773c31; background: #f4dfda; border-color: #ddbdb5; }
.empty-state { padding: 72px 12px; text-align: center; color: #64736b; }
.load-more { display: block; margin: 24px auto 0; padding: 10px 20px; border: 1px solid #276348; color: #276348; background: #fff; }
.load-more:hover { color: #fff; background: #276348; }

dialog { padding: 0; border: 0; box-shadow: 0 24px 70px rgb(11 27 19 / 28%); }
dialog::backdrop { background: rgb(18 31 24 / 58%); }
.detail-dialog { width: min(760px, calc(100vw - 28px)); max-height: calc(100vh - 28px); margin: auto 14px auto auto; }
.dialog-close { position: absolute; z-index: 2; top: 12px; right: 12px; width: 34px; height: 34px; border: 1px solid #bdc8c0; color: #33453b; background: #fff; font-size: 22px; line-height: 1; }
.detail-hero { min-height: 220px; padding: 28px 70px 28px 28px; display: grid; grid-template-columns: 130px 1fr; gap: 24px; color: #fff; background: #173f32; }
.detail-hero .portrait { width: 126px; height: 158px; border-color: #668b79; }
.detail-hero h2 { margin: 4px 0 8px; font-size: 28px; }
.detail-hero p { margin: 0; color: #d5e1db; line-height: 1.5; }
.detail-body { padding: 24px 28px 36px; }
.detail-section + .detail-section { margin-top: 25px; }
.detail-section h3 { margin: 0 0 10px; color: #526158; font-size: 12px; text-transform: uppercase; }
.detail-section p { margin: 0; line-height: 1.65; }
.membership-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.membership-grid > div { padding: 13px; background: #f1f4f1; border-left: 3px solid #7c9b8d; }
.membership-grid strong { display: block; margin-bottom: 8px; font-size: 13px; }
.source-link { display: inline-block; margin-top: 14px; color: #1f6047; font-weight: 700; }
.about-dialog { width: min(620px, calc(100vw - 28px)); }
.about-content { padding: 34px; }
.about-content h2 { margin: 0 0 18px; }
.about-content p { color: #46564e; line-height: 1.7; }
.about-links { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 10px; }
.about-links a { padding: 8px 10px; border: 1px solid #b5c2ba; text-decoration: none; }

@media (max-width: 940px) {
  .summary { align-items: stretch; flex-direction: column; }
  .metrics { width: 100%; }
  .workspace { grid-template-columns: 1fr; }
  .filters { position: sticky; z-index: 3; top: 0; padding: 14px 18px; display: grid; grid-template-columns: minmax(180px, 2fr) minmax(150px, 1fr) auto; gap: 12px; align-items: end; border-right: 0; border-bottom: 1px solid #cbd5ce; }
  .filters fieldset { grid-column: 1 / -1; margin: 0; }
  .segmented { grid-template-columns: repeat(4, 1fr); }
  .segmented button { text-align: center; }
  .filter-row, .check-row, .reset-button { margin-top: 0; }
  .reset-button { width: auto; }
  .person-row { grid-template-columns: 58px minmax(160px, 1fr) minmax(170px, 1fr); }
  .person-position { display: none; }
}

@media (max-width: 640px) {
  .topbar { padding: 10px 14px; }
  .brand p, .download-link { display: none; }
  .summary { padding: 20px 16px; gap: 20px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics div:nth-child(2) { border-right: 0; }
  .metrics div:nth-child(-n + 2) { border-bottom: 1px solid #dce2dd; }
  .filters { position: static; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .filters > * { min-width: 0; }
  .search-field { grid-column: 1 / -1; }
  .filters fieldset { width: 100%; max-width: calc(100vw - 36px); overflow-x: auto; }
  .segmented { min-width: 470px; }
  .check-row { font-size: 12px; }
  .results { padding: 14px 12px 40px; }
  .sort-control span { display: none; }
  .person-row { min-height: 96px; padding: 12px 4px; grid-template-columns: 52px minmax(0, 1fr); gap: 11px; }
  .portrait { width: 48px; height: 60px; }
  .person-terms { grid-column: 2; }
  .detail-dialog { width: 100%; max-width: none; max-height: 92vh; margin: auto 0 0; }
  .detail-hero { grid-template-columns: 90px 1fr; padding: 24px 54px 24px 20px; gap: 16px; }
  .detail-hero .portrait { width: 88px; height: 112px; }
  .detail-hero h2 { font-size: 22px; }
  .detail-body { padding: 20px; }
  .membership-grid { grid-template-columns: 1fr; }
}
