:root {
  color-scheme: light;
  --ink: #14202b;
  --ink-soft: #243447;
  --muted: #667386;
  --muted-2: #8793a3;
  --line: #d8e1e8;
  --line-soft: #e8eef3;
  --paper: #eef3f6;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --teal-soft: #e5f4f1;
  --blue: #2554a4;
  --blue-soft: #eaf1ff;
  --amber: #a16207;
  --amber-soft: #fff6d8;
  --coral: #c2410c;
  --coral-soft: #fff1e8;
  --shadow: 0 18px 48px rgba(20, 32, 43, 0.08);
  --shadow-soft: 0 10px 24px rgba(20, 32, 43, 0.06);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 144px;
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0) 280px),
    var(--paper);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 76px;
  padding: 14px clamp(18px, 3vw, 42px);
  border-bottom: 1px solid rgba(216, 225, 232, 0.92);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--ink);
  color: white;
  font-size: 19px;
  font-weight: 900;
}

.brand h1,
.brand p,
.panel h3,
.hero-band h2,
.eyebrow {
  margin: 0;
}

.brand h1 {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.2;
}

.brand p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

nav a {
  min-height: 34px;
  padding: 8px 10px;
  border-radius: var(--radius);
  text-decoration: none;
  white-space: nowrap;
}

nav a:hover {
  background: var(--teal-soft);
  color: var(--teal-dark);
}

main {
  width: min(100%, 1460px);
  margin: 0 auto;
  padding: 28px clamp(16px, 3vw, 40px) 56px;
}

.hero-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 560px);
  gap: clamp(20px, 3vw, 36px);
  align-items: end;
  min-width: 0;
  padding: 24px 0 28px;
}

.hero-content {
  min-width: 0;
}

.eyebrow {
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-band h2 {
  max-width: 840px;
  margin-top: 12px;
  color: var(--ink);
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.hero-copy {
  max-width: 900px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.hero-card {
  box-shadow: var(--shadow-soft);
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.stat-card,
.stat-strip > div {
  min-width: 0;
  padding: 16px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.stat-card:nth-last-child(-n + 2),
.stat-strip > div:nth-last-child(-n + 2) {
  border-bottom: 1px solid var(--line-soft);
}

.stat-card:nth-child(2n),
.stat-strip > div:nth-child(2n) {
  border-right: 1px solid var(--line-soft);
}

.stat-card:nth-child(3n),
.stat-strip > div:nth-child(3n) {
  border-right: 0;
}

.stat-card:nth-last-child(-n + 3),
.stat-strip > div:nth-last-child(-n + 3) {
  border-bottom: 0;
}

.stat-value,
.stat-strip span {
  display: block;
  min-width: 0;
  color: var(--ink);
  font-size: clamp(20px, 2vw, 27px);
  font-weight: 900;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.stat-card label,
.stat-strip label {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  margin-top: -42px;
  padding-top: 64px;
}

.section-shell,
.workspace {
  scroll-margin-top: 144px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.data-summary {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: clamp(16px, 2vw, 20px);
}

.data-summary h3 {
  margin: 5px 0 0;
  font-size: 19px;
  line-height: 1.25;
}

.data-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.data-summary-item {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.data-summary-item span,
.data-summary-item strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.data-summary-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.data-summary-item strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.form-panel,
.results-panel,
.section-shell {
  padding: clamp(18px, 2vw, 24px);
}

.panel-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  min-width: 0;
  margin-bottom: 18px;
}

.panel-title > div {
  min-width: 0;
}

.panel-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.panel h3 {
  margin-top: 5px;
  color: var(--ink);
  font-size: 21px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--teal);
  color: white;
  cursor: pointer;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 10px 20px rgba(15, 118, 110, 0.18);
}

button:hover {
  background: var(--teal-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.secondary-button {
  border: 1px solid rgba(37, 84, 164, 0.2);
  background: white;
  color: var(--blue);
  box-shadow: none;
}

.secondary-button:hover {
  background: var(--blue-soft);
}

.status {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: var(--radius);
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.status.error {
  border-color: rgba(194, 65, 12, 0.24);
  background: var(--coral-soft);
  color: var(--coral);
}

.search-status {
  flex: 0 1 auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

label,
legend {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  display: block;
  width: 100%;
  min-width: 0;
  height: 42px;
  margin-top: 7px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
}

input::placeholder {
  color: var(--muted-2);
}

input:focus,
select:focus {
  border-color: var(--teal);
  outline: 3px solid rgba(15, 118, 110, 0.14);
}

fieldset {
  min-width: 0;
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.check-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  overflow-wrap: anywhere;
}

.check-grid input {
  flex: 0 0 auto;
  width: auto;
  height: auto;
  margin: 0;
  accent-color: var(--teal);
}

.hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.rank-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  margin: -2px 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(37, 84, 164, 0.18);
  border-radius: var(--radius);
  background: var(--blue-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.rank-card strong {
  color: var(--ink);
  font-size: 14px;
}

.rank-card span,
.rank-card a {
  min-width: 0;
  overflow-wrap: anywhere;
}

.rank-card a {
  color: var(--blue);
  font-weight: 900;
}

.warning-list {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.warning-item {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(194, 65, 12, 0.22);
  border-radius: var(--radius);
  background: var(--coral-soft);
  color: #9a3412;
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.bucket-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.bucket {
  min-width: 0;
}

.bucket h4 {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 16px;
  line-height: 1.3;
}

.bucket.rush h4 {
  background: var(--coral-soft);
  color: var(--coral);
}

.bucket.steady h4 {
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.bucket.safe h4 {
  background: var(--amber-soft);
  color: var(--amber);
}

.program-card {
  min-width: 0;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 8px 20px rgba(20, 32, 43, 0.04);
}

.program-card strong {
  display: block;
  min-width: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.program-card .meta,
.program-card .reason,
.program-card .history {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.program-card .meta {
  margin: 6px 0 0;
}

.program-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.program-metrics span {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.metric-label {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.metric-value {
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.program-card a {
  display: inline-flex;
  margin-top: 2px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

#search,
#universities,
#coverage,
#majorProfiles,
#sources {
  margin-top: 24px;
}

.coverage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.control-row {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(160px, 220px) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  margin-bottom: 14px;
}

.control-row input,
.control-row select {
  margin-top: 0;
}

#sourceControls {
  grid-template-columns: minmax(260px, 1fr) auto;
}

.coverage-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--muted);
  border-radius: var(--radius);
  background: white;
}

.coverage-card.imported {
  border-left-color: var(--teal);
}

.coverage-card.source_registered {
  border-left-color: var(--blue);
}

.coverage-card.manual_download_required,
.coverage-card.discovery_pending,
.coverage-card.not_published {
  border-left-color: var(--amber);
}

.coverage-card.query_only,
.coverage-card.blocked_official_access {
  border-left-color: var(--coral);
}

.coverage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.coverage-head strong {
  min-width: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.coverage-head span {
  flex: 0 1 auto;
  min-width: 0;
  padding: 3px 7px;
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-align: right;
}

.coverage-card p {
  min-width: 0;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.coverage-card a {
  display: inline-block;
  margin-top: 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.searchbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(120px, 150px) minmax(100px, 130px) auto;
  gap: 10px;
  align-items: end;
  min-width: 0;
}

#universityForm {
  grid-template-columns: minmax(220px, 1fr) minmax(120px, 150px) auto;
}

#majorProfileForm {
  grid-template-columns: minmax(210px, 1fr) minmax(170px, 240px) minmax(130px, 160px) minmax(96px, 120px) auto;
}

.searchbar input,
.searchbar select {
  margin-top: 0;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  min-width: 0;
  padding: 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

th {
  position: sticky;
  top: 0;
  background: var(--panel-soft);
  color: var(--muted);
  font-weight: 900;
  white-space: nowrap;
}

td a {
  color: var(--blue);
  font-weight: 900;
}

.major-profile-summary {
  min-width: 0;
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.review-status-cell {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.review-status-cell small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.review-status-badge {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.review-status-badge.is-imported {
  border-color: rgba(15, 118, 110, 0.18);
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.review-status-badge.is-review {
  border-color: rgba(194, 65, 12, 0.22);
  background: var(--amber-soft);
  color: var(--amber);
}

.recommendation-major-profile {
  display: grid;
  gap: 7px;
  min-width: 0;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(37, 84, 164, 0.16);
  border-radius: var(--radius);
  background: var(--blue-soft);
}

.recommendation-major-profile strong {
  font-size: 13px;
}

.tag-list,
.profile-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.tag-list span {
  min-width: 0;
  padding: 3px 7px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: var(--radius);
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.profile-link-row a {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.major-recommendation-panel {
  display: grid;
  grid-column: 1 / -1;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(37, 84, 164, 0.16);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--blue-soft), #ffffff);
}

.major-recommendation-panel.is-muted {
  border-color: rgba(194, 65, 12, 0.18);
  background: var(--amber-soft);
}

.major-recommendation-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.major-recommendation-header h4,
.major-recommendation-panel h4 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.35;
}

.major-recommendation-header span {
  flex: 0 0 auto;
  padding: 3px 8px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: var(--radius);
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
}

.major-recommendation-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.major-recommendation-item {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.major-recommendation-item strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.major-recommendation-item p,
.major-recommendation-source,
.major-recommendation-panel.is-muted p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

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

.source-item {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.source-item strong {
  display: block;
  min-width: 0;
  margin-bottom: 6px;
  color: var(--ink);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.source-item p {
  min-width: 0;
  margin: 4px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.source-item a {
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

.empty {
  min-width: 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

@media (max-width: 1180px) {
  .hero-band,
  .workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .bucket-grid,
  .source-list,
  .major-recommendation-list {
    grid-template-columns: 1fr;
  }

  .data-summary {
    grid-template-columns: 1fr;
  }

  .data-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .searchbar,
  #universityForm,
  #majorProfileForm {
    grid-template-columns: minmax(0, 1fr) minmax(120px, 170px) auto;
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 16px;
  }

  nav {
    justify-content: flex-start;
    width: 100%;
  }

  nav a {
    padding: 7px 8px;
  }

  main {
    padding: 20px 14px 40px;
  }

  .hero-band {
    padding-top: 12px;
  }

  .hero-band h2 {
    font-size: 28px;
    line-height: 1.18;
  }

  .stat-strip,
  .data-summary-grid,
  .form-grid,
  .bucket-grid,
  .major-recommendation-list,
  .coverage-grid,
  .source-list,
  .control-row,
  #sourceControls,
  .searchbar,
  #universityForm,
  #majorProfileForm {
    grid-template-columns: 1fr;
  }

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

  .stat-card,
  .stat-strip > div,
  .stat-card:nth-child(3n),
  .stat-strip > div:nth-child(3n) {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .stat-card:nth-child(odd),
  .stat-strip > div:nth-child(odd) {
    border-right: 1px solid var(--line-soft);
  }

  .stat-card:nth-last-child(-n + 2),
  .stat-strip > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .stat-card:last-child,
  .stat-strip > div:last-child {
    border-bottom: 0;
  }

  .panel-title {
    align-items: flex-start;
  }

  .panel-title button,
  .control-row button,
  .searchbar button {
    width: 100%;
  }

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

  .program-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .program-metrics span {
    padding: 8px 6px;
  }
}

@media (max-width: 430px) {
  .brand {
    align-items: flex-start;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .check-grid,
  .program-metrics {
    grid-template-columns: 1fr;
  }

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

  table {
    min-width: 760px;
  }
}
