:root {
  --ink: #202941;
  --muted: #596783;
  --paper: #f4f6fb;
  --wash: #eef1fb;
  --green: #3f4795;
  --line: #dce3f0;
}

.directory-filter, .directory-table {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.directory-filter { padding: 16px; }
.directory-filter-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.directory-filter h2 { margin: 0; font-size: 1rem; }
.directory-filter :is(button, select, input), .announcement-select select { border-radius: 7px; }
.directory-filter #reset-search, .directory-open {
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: var(--wash);
  color: var(--green);
  border-radius: 7px;
}
.directory-filter form {
  display: grid;
  grid-template-columns: minmax(150px, 2fr) repeat(3, minmax(100px, 1fr)) auto;
  max-width: none;
  align-items: end;
  margin: 12px 0 0;
}
.directory-tags {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: .65rem;
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.directory-tags div { display: grid; gap: .35rem; min-width: 0; }
.directory-filter .selected-tag { background: var(--wash); color: var(--green); font-weight: 650; }
.directory-filter label { display: grid; gap: 4px; min-width: 0; }
.directory-filter :is(input, select) {
  width: 100%;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}
.directory-filter button[type=submit] { min-height: 44px; }
.directory-table { width: 100%; border-spacing: 0; text-align: left; overflow: hidden; }
.directory-table th, .directory-table td { padding: 12px; vertical-align: top; overflow-wrap: anywhere; }
.directory-table thead { background: var(--wash); }
.directory-table tbody tr + tr > * { border-top: 1px solid var(--line); }
.directory-table tbody tr:hover { background: #f9faff; }
.directory-table small { display: block; color: var(--muted); }
.directory-badge {
  display: inline-block;
  margin: 3px 0 0 5px;
  padding: 2px 6px;
  font-size: .875rem;
  font-weight: 500;
  background: var(--wash);
  color: var(--green);
  border-radius: 6px;
}
.verified-badge { background: #e9f4ef; color: #20684c; }
.neutral-badge { background: #f3f0e7; color: #6f531e; }
.directory-open { white-space: nowrap; }
.announcement-select select { width: 100%; padding: 8px; border: 1px solid var(--line); background: white; }

@media (max-width: 720px) {
  .directory-filter form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .directory-filter form label:first-child { grid-column: 1 / -1; }
  .directory-filter button[type=submit] { min-height: 40px; }
  .directory-table, .directory-table tbody { display: block; }
  .directory-table thead { position: absolute; clip-path: inset(50%); }
  .directory-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 8px; }
  .directory-table tbody tr + tr { border-top: 1px solid var(--line); }
  .directory-table tbody tr + tr > * { border-top: 0; }
  .directory-table tbody th { grid-column: 1 / -1; }
  .directory-table th, .directory-table td { padding: 4px 7px; }
  .directory-table td:nth-child(2)::before, .directory-table td:nth-child(3)::before {
    display: block;
    color: var(--muted);
    font-size: .875rem;
  }
  .directory-table td:nth-child(2)::before { content: "院系与专业"; }
  .directory-table td:nth-child(3)::before { content: "届别与阶段"; }
}

.announcement-select {
  display: grid;
  gap: .45rem;
  margin-block: 1rem;
  color: #334155;
  font-weight: 650;
}

.announcement-select select { width: 100%; min-width: 0; }

.requirements-table { table-layout: fixed; }
.requirements-table thead th:nth-child(1) { width: 15%; }
.requirements-table thead th:nth-child(2) { width: 48%; }
.requirements-table thead th:nth-child(3) { width: 17%; }
.requirements-table thead th:nth-child(4) { width: 20%; }
.requirements-table :is(th, td) { overflow-wrap: anywhere; }
.requirements-table .tag { white-space: normal; }

.announcement-select[hidden] { display: none; }

.scope-note { margin-bottom: .75rem; }
.announcement-original { display: inline-block; margin-top: .45rem; }

@media (max-width: 540px) {
  .requirements-table thead th:nth-child(1) { width: 18%; }
  .requirements-table thead th:nth-child(2) { width: 45%; }
  .requirements-table :is(th, td) { padding-inline: .3rem; font-size: .875rem; }
}

.directory-filter .activity-filter {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-top: .65rem;
  width: fit-content;
  color: var(--green);
}
.directory-filter .activity-filter input { width: auto; }
.directions .activity-entry[aria-pressed="false"] { background: transparent; }
.intake-timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: .55rem;
  margin-bottom: 0;
}
.intake-timeline div { background: var(--wash); border-radius: 8px; padding: .5rem .7rem; }
.intake-timeline dt { color: var(--muted); font-size: .875rem; }
.intake-timeline dd { margin: .2rem 0 0; overflow-wrap: anywhere; }
.requirements-table td:nth-child(2) { white-space: pre-line; }

.advisor-notes {
  margin-block: 1.25rem;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--wash);
}
.advisor-notes summary { cursor: pointer; font-weight: 650; color: var(--green); }
.advisor-notes ul { padding-inline-start: 1.25rem; }
.advisor-notes li + li { margin-top: .5rem; }
