.funding-directory-page {
  background: #f5f7fa;
}

.funding-directory-page [hidden] {
  display: none !important;
}

.funding-directory-page .nav a.active {
  color: var(--accent);
  border-color: var(--accent);
}

.funding-directory-page .language-switch a.is-disabled {
  opacity: 0.42;
  pointer-events: none;
}

.directory-shell {
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
}

.directory-hero {
  padding: 66px 0 58px;
  background: #eef5ff;
  border-bottom: 1px solid #d7e4f5;
}

.directory-hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 64px;
  align-items: end;
}

.directory-hero h1 {
  max-width: 760px;
  margin: 8px 0 14px;
  color: #172033;
  font-size: 44px;
  line-height: 1.15;
  letter-spacing: 0;
}

.directory-hero p:not(.eyebrow) {
  max-width: 760px;
  margin: 0;
  color: #47566f;
  font-size: 17px;
  line-height: 1.75;
}

.directory-overview {
  display: grid;
  grid-template-columns: repeat(3, 130px);
  margin: 0;
  border: 1px solid #c8d7ea;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  overflow: hidden;
}

.directory-overview div {
  padding: 16px 18px;
  border-right: 1px solid #d8e2ef;
}

.directory-overview div:last-child {
  border-right: 0;
}

.directory-overview dt {
  color: #6a7689;
  font-size: 12px;
  font-weight: 800;
}

.directory-overview dd {
  margin: 4px 0 0;
  color: #172033;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.3;
}

.category-band {
  padding: 44px 0 48px;
  background: #ffffff;
  border-bottom: 1px solid #e0e5ec;
}

.directory-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 24px;
}

.directory-section-head h2 {
  margin: 5px 0 0;
  color: #1c2433;
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: 0;
}

.directory-section-head > p {
  max-width: 440px;
  margin: 0;
  color: #687386;
  font-size: 14px;
  text-align: right;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.category-button {
  --category-color: #49637f;
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 3px 12px;
  min-height: 94px;
  padding: 17px 18px 15px 20px;
  color: #273348;
  text-align: left;
  background: #ffffff;
  border: 1px solid #dce2ea;
  border-left: 4px solid var(--category-color);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.category-button:hover,
.category-button.is-active {
  border-color: var(--category-color);
  background: #f9fbfd;
  box-shadow: 0 10px 24px rgba(28, 42, 64, 0.08);
}

.category-button.is-active::after {
  position: absolute;
  right: 12px;
  bottom: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--category-color);
  content: "";
}

.category-button span {
  align-self: end;
  font-size: 16px;
  font-weight: 850;
  line-height: 1.3;
}

.category-button strong {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: start;
  color: var(--category-color);
  font-size: 22px;
  line-height: 1;
}

.category-button small {
  color: #778294;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}

.category-all { --category-color: #46566d; }
.category-rd { --category-color: #175cd3; }
.category-incubation { --category-color: #087f8c; }
.category-talent { --category-color: #16794a; }
.category-market { --category-color: #a15c00; }
.category-industrial { --category-color: #b54747; }
.category-health { --category-color: #9a4b76; }
.category-university { --category-color: #5d5f9d; }
.category-finance { --category-color: #7b5c16; }
.category-public { --category-color: #3f6670; }

.directory-section {
  padding: 48px 0 84px;
}

.directory-results-head {
  margin-bottom: 18px;
}

.directory-results-head > p strong {
  color: #175cd3;
  font-size: 18px;
}

.directory-toolbar {
  display: grid;
  grid-template-columns: minmax(250px, 1.45fr) repeat(4, minmax(150px, 0.7fr)) 46px;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #dfe4eb;
  border-radius: 8px;
}

.directory-toolbar label {
  display: grid;
  gap: 6px;
}

.directory-toolbar label > span {
  color: #526075;
  font-size: 12px;
  font-weight: 800;
}

.directory-toolbar input,
.directory-toolbar select {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  color: #263349;
  background: #ffffff;
  border: 1px solid #cfd7e3;
  border-radius: 5px;
  outline: 0;
}

.directory-toolbar input:focus,
.directory-toolbar select:focus {
  border-color: #175cd3;
  box-shadow: 0 0 0 3px rgba(23, 92, 211, 0.12);
}

.reset-filter {
  display: grid;
  place-items: center;
  width: 46px;
  height: 44px;
  color: #3d4a5f;
  background: #eef2f7;
  border: 1px solid #d4dbe5;
  border-radius: 5px;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.reset-filter:hover {
  color: #175cd3;
  border-color: #175cd3;
}

.directory-table-wrap {
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #dfe4eb;
  border-radius: 8px;
}

.directory-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.directory-table th {
  padding: 13px 12px;
  color: #566276;
  background: #f0f3f7;
  border-bottom: 1px solid #d8dee7;
  font-size: 12px;
  font-weight: 850;
  text-align: left;
}

.directory-table th:nth-child(1) { width: 48px; }
.directory-table th:nth-child(2) { width: 28%; }
.directory-table th:nth-child(3) { width: 12%; }
.directory-table th:nth-child(4) { width: 17%; }
.directory-table th:nth-child(5) { width: 15%; }
.directory-table th:nth-child(6) { width: 13%; }
.directory-table th:nth-child(7) { width: 72px; }

.directory-table td {
  padding: 17px 12px;
  color: #344055;
  border-bottom: 1px solid #e7ebf0;
  font-size: 13px;
  line-height: 1.5;
  vertical-align: middle;
}

.directory-table tbody tr:last-child td {
  border-bottom: 0;
}

.directory-table tbody tr:hover {
  background: #f8fafc;
}

.compare-check {
  display: grid;
  place-items: center;
}

.compare-check input {
  width: 18px;
  height: 18px;
  accent-color: #175cd3;
  cursor: pointer;
}

.programme-name-button {
  display: block;
  width: 100%;
  padding: 0;
  color: #172033;
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.programme-name-button strong {
  display: block;
  color: #172033;
  font-size: 15px;
  line-height: 1.4;
}

.programme-name-button span {
  display: block;
  margin-top: 4px;
  color: #778294;
  font-size: 12px;
  line-height: 1.4;
}

.programme-name-button:hover strong {
  color: #175cd3;
}

.category-tag,
.status-tag,
.type-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.3;
}

.category-tag {
  color: #344055;
  background: #edf1f6;
}

.status-tag::before {
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.status-open {
  color: #16794a;
  background: #eaf7f0;
}

.status-periodic {
  color: #8a5a00;
  background: #fff4da;
}

.status-mixed {
  color: #8b4770;
  background: #f8eaf2;
}

.status-institution {
  color: #3f5f8a;
  background: #eaf1fa;
}

.status-closed {
  color: #a13f3f;
  background: #fbecec;
}

.status-reference {
  color: #5f6672;
  background: #eef0f3;
}

.amount-cell strong {
  display: block;
  color: #21324d;
  font-size: 13px;
}

.amount-cell span {
  display: block;
  margin-top: 3px;
  color: #7a8495;
  font-size: 11px;
}

.detail-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 34px;
  color: #175cd3;
  background: #edf4ff;
  border: 1px solid #cfe0f8;
  border-radius: 5px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
}

.detail-open:hover {
  color: #ffffff;
  background: #175cd3;
  border-color: #175cd3;
}

.directory-empty {
  padding: 64px 24px;
  color: #6a7587;
  text-align: center;
}

.directory-empty strong {
  display: block;
  color: #273348;
  font-size: 17px;
}

.directory-empty p {
  margin: 5px 0 0;
}

.directory-note {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 18px;
  margin-top: 16px;
  padding: 16px 18px;
  color: #687386;
  background: #eef1f5;
  border-left: 4px solid #7b8798;
}

.directory-note strong {
  color: #344055;
}

.directory-note p {
  margin: 0;
  font-size: 13px;
}

.drawer-backdrop,
.compare-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(15, 23, 36, 0.45);
}

.programme-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 31;
  width: min(560px, 100%);
  height: 100vh;
  padding: 34px 34px 48px;
  overflow-y: auto;
  color: #2c384b;
  background: #ffffff;
  border-left: 1px solid #d9e0e8;
  box-shadow: -18px 0 50px rgba(17, 29, 48, 0.16);
}

.drawer-close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-left: auto;
  color: #455268;
  background: #eef2f6;
  border: 1px solid #d5dce5;
  border-radius: 50%;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
}

.drawer-close:hover {
  color: #ffffff;
  background: #25334a;
}

.drawer-agency {
  margin: 22px 0 6px;
  color: #175cd3;
  font-size: 12px;
  font-weight: 850;
}

.programme-drawer h2 {
  margin: 0;
  color: #172033;
  font-size: 30px;
  line-height: 1.3;
  letter-spacing: 0;
}

.drawer-summary {
  margin: 14px 0 20px;
  color: #5a6678;
  font-size: 15px;
  line-height: 1.75;
}

.drawer-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 0 24px;
  border: 1px solid #dce2e9;
  border-radius: 7px;
  overflow: hidden;
}

.drawer-meta div {
  padding: 13px 15px;
  border-right: 1px solid #e1e6ec;
  border-bottom: 1px solid #e1e6ec;
}

.drawer-meta div:nth-child(2n) { border-right: 0; }
.drawer-meta div:nth-last-child(-n + 2) { border-bottom: 0; }

.drawer-meta dt {
  color: #778294;
  font-size: 11px;
  font-weight: 800;
}

.drawer-meta dd {
  margin: 4px 0 0;
  color: #243149;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.drawer-section {
  padding: 21px 0;
  border-top: 1px solid #e3e7ed;
}

.drawer-section h3 {
  margin: 0 0 9px;
  color: #253149;
  font-size: 16px;
}

.drawer-section p,
.drawer-section ul {
  margin: 0;
  color: #5e697b;
  font-size: 14px;
  line-height: 1.75;
}

.drawer-section ul {
  padding-left: 20px;
}

.drawer-official {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  margin-top: 22px;
  padding: 0 20px;
  color: #ffffff;
  background: #175cd3;
  border-radius: 6px;
  font-weight: 800;
}

.drawer-official:hover {
  background: #114aa9;
}

.compare-tray {
  position: fixed;
  right: 24px;
  bottom: 24px;
  left: 24px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 960px;
  min-height: 70px;
  margin: 0 auto;
  padding: 12px 14px 12px 20px;
  color: #ffffff;
  background: #202b3e;
  border: 1px solid #34435c;
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(12, 20, 34, 0.24);
}

.compare-tray > div:first-child {
  min-width: 0;
}

.compare-tray strong {
  display: block;
  font-size: 13px;
}

.compare-tray span {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: #c9d3e1;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.compare-clear,
.compare-open {
  min-height: 42px;
  padding: 0 15px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 800;
}

.compare-clear {
  color: #d8e0eb;
  background: transparent;
  border: 1px solid #637188;
}

.compare-open {
  color: #172033;
  background: #ffffff;
  border: 1px solid #ffffff;
}

.compare-modal-backdrop {
  display: grid;
  place-items: center;
  padding: 28px;
}

.compare-modal {
  width: min(1120px, 100%);
  max-height: calc(100vh - 56px);
  overflow: auto;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(12, 20, 34, 0.24);
}

.compare-modal > header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 26px;
  background: #ffffff;
  border-bottom: 1px solid #dfe4ea;
}

.compare-modal h2 {
  margin: 3px 0 0;
  font-size: 24px;
  letter-spacing: 0;
}

.compare-table-wrap {
  overflow-x: auto;
  padding: 0 26px 28px;
}

.compare-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
}

.compare-table th,
.compare-table td {
  padding: 15px 14px;
  border-bottom: 1px solid #e1e6ec;
  border-right: 1px solid #e1e6ec;
  text-align: left;
  vertical-align: top;
}

.compare-table th:last-child,
.compare-table td:last-child {
  border-right: 0;
}

.compare-table th {
  color: #273348;
  background: #f4f6f9;
  font-size: 13px;
}

.compare-table th:first-child {
  width: 130px;
  color: #657084;
}

.compare-table td {
  color: #536075;
  font-size: 13px;
  line-height: 1.6;
}

.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;
}

body.has-overlay {
  overflow: hidden;
}

@media (max-width: 1120px) {
  .directory-hero-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .directory-overview {
    width: min(100%, 520px);
    grid-template-columns: repeat(3, 1fr);
  }

  .directory-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .directory-toolbar .search-field {
    grid-column: span 2;
  }

  .reset-filter {
    grid-column: 2;
    justify-self: end;
  }

  .directory-table th:nth-child(3),
  .directory-table td:nth-child(3) {
    display: none;
  }
}

@media (max-width: 800px) {
  .directory-shell {
    width: min(100% - 32px, 1320px);
  }

  .directory-hero {
    padding: 46px 0 42px;
  }

  .directory-hero h1 {
    font-size: 34px;
  }

  .directory-overview {
    width: 100%;
  }

  .directory-overview div {
    padding: 13px 12px;
  }

  .directory-overview dd {
    font-size: 15px;
  }

  .category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .directory-section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .directory-section-head > p {
    text-align: left;
  }

  .directory-table thead {
    display: none;
  }

  .directory-table,
  .directory-table tbody,
  .directory-table tr,
  .directory-table td {
    display: block;
    width: 100%;
  }

  .directory-table tr {
    position: relative;
    padding: 18px 54px 18px 50px;
    border-bottom: 1px solid #dfe4eb;
  }

  .directory-table tr:last-child {
    border-bottom: 0;
  }

  .directory-table td {
    padding: 0;
    border: 0;
  }

  .directory-table td.compare-column {
    position: absolute;
    top: 20px;
    left: 16px;
    width: 22px;
  }

  .directory-table td:nth-child(3) {
    display: inline-block;
    width: auto;
    margin: 11px 6px 0 0;
  }

  .directory-table td:nth-child(4) {
    margin-top: 10px;
    color: #657084;
  }

  .directory-table td:nth-child(4)::before {
    content: "适合对象：";
    font-weight: 800;
  }

  .directory-table td:nth-child(5) {
    margin-top: 8px;
  }

  .directory-table td:nth-child(6) {
    display: inline-block;
    width: auto;
    margin-top: 11px;
  }

  .directory-table td:nth-child(7) {
    position: absolute;
    top: 18px;
    right: 12px;
    width: 42px;
  }

  .amount-cell span {
    display: inline;
    margin-left: 6px;
  }
}

@media (max-width: 560px) {
  .directory-hero h1 {
    font-size: 30px;
  }

  .directory-overview {
    grid-template-columns: 1fr;
  }

  .directory-overview div,
  .directory-overview div:nth-child(2) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-right: 0;
    border-bottom: 1px solid #d8e2ef;
  }

  .directory-overview div:last-child {
    border-bottom: 0;
  }

  .directory-overview dd {
    margin: 0;
  }

  .category-grid {
    grid-template-columns: 1fr;
  }

  .category-button {
    min-height: 78px;
  }

  .directory-toolbar {
    grid-template-columns: 1fr;
  }

  .directory-toolbar .search-field,
  .reset-filter {
    grid-column: 1;
  }

  .reset-filter {
    justify-self: stretch;
    width: 100%;
  }

  .directory-note {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .programme-drawer {
    padding: 22px 20px 40px;
  }

  .programme-drawer h2 {
    font-size: 25px;
  }

  .drawer-meta {
    grid-template-columns: 1fr;
  }

  .drawer-meta div,
  .drawer-meta div:nth-child(2n),
  .drawer-meta div:nth-last-child(-n + 2) {
    border-right: 0;
    border-bottom: 1px solid #e1e6ec;
  }

  .drawer-meta div:last-child {
    border-bottom: 0;
  }

  .compare-tray {
    right: 12px;
    bottom: 12px;
    left: 12px;
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .compare-actions,
  .compare-actions button {
    flex: 1;
  }

  .compare-modal-backdrop {
    padding: 10px;
  }

  .compare-modal {
    max-height: calc(100vh - 20px);
  }

  .compare-modal > header {
    padding: 18px;
  }

  .compare-table-wrap {
    padding: 0 18px 22px;
  }
}
