:root {
  --ink: #181d26;
  --ink-strong: #0d1218;
  --body: #39414d;
  --muted: #687180;
  --subtle: #9299a4;
  --canvas: #ffffff;
  --surface: #f6f7f9;
  --surface-soft: #fafbfc;
  --line: #e2e5e9;
  --line-strong: #c9ced5;
  --link: #1b61c9;
  --link-soft: #eef4ff;
  --coral: #a83b24;
  --coral-soft: #fff1ec;
  --forest: #17613b;
  --forest-soft: #eaf7ef;
  --cream: #f6eddf;
  --danger: #bf2c2c;
  --warning: #8a5c00;
  --focus: #458fff;
  --shadow-soft: 0 1px 2px rgba(24, 29, 38, 0.05), 0 12px 32px rgba(24, 29, 38, 0.06);
  --shadow-panel: 0 18px 48px rgba(24, 29, 38, 0.1);
  --header-height: 64px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--surface);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--surface);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button {
  border: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

[hidden] {
  display: none !important;
}

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

:focus-visible {
  outline: 3px solid rgba(69, 143, 255, 0.36);
  outline-offset: 2px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: max-content;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.1px;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #fff;
  background: var(--ink);
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  box-shadow: 0 5px 14px rgba(24, 29, 38, 0.16);
}

.brand-mark::after {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: #f28b67;
  border: 2px solid #fff;
  border-radius: 50%;
  content: "";
}

.section-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.primary-action,
.secondary-action {
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 500;
  transition: transform 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.primary-action {
  color: #fff;
  background: var(--ink);
  box-shadow: 0 7px 18px rgba(24, 29, 38, 0.15);
}

.primary-action:active {
  background: var(--ink-strong);
  transform: translateY(1px);
}

.secondary-action {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.secondary-action:active {
  background: var(--surface);
}

/* Entry */

.entry-view {
  min-height: 100vh;
  background: var(--canvas);
}

.entry-header {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  background: var(--canvas);
  border-bottom: 1px solid var(--line);
}

.version-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.version-label > span {
  width: 7px;
  height: 7px;
  background: #39a96b;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(57, 169, 107, 0.1);
}

.entry-main {
  min-height: calc(100vh - 68px);
  padding: 64px 24px 88px;
  background: var(--surface-soft);
}

.entry-shell {
  width: min(1080px, 100%);
  margin: 0 auto;
}

.entry-copy {
  max-width: 760px;
  margin-bottom: 36px;
}

.entry-copy h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(36px, 4.4vw, 52px);
  font-weight: 500;
  line-height: 1.13;
  letter-spacing: -1.5px;
}

.entry-copy > p {
  max-width: 690px;
  margin: 16px 0 0;
  color: var(--body);
  font-size: 17px;
  line-height: 1.75;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 13px;
}

.entry-meta span {
  position: relative;
  padding-left: 15px;
}

.entry-meta span::before {
  position: absolute;
  top: 8px;
  left: 0;
  width: 5px;
  height: 5px;
  background: var(--forest);
  border-radius: 50%;
  content: "";
}

.entry-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.75fr);
  overflow: hidden;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-panel);
}

.entry-form-column {
  padding: 36px 40px 40px;
}

.entry-form-heading {
  margin-bottom: 28px;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 10px;
  color: var(--link);
  background: var(--link-soft);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

.entry-form-heading h2 {
  margin: 13px 0 0;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.35px;
}

.entry-form-heading p {
  margin: 7px 0 0;
  color: var(--muted);
}

.entry-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field-block {
  display: grid;
  gap: 8px;
}

.field-name {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.field-name small {
  margin-left: 6px;
  color: var(--subtle);
  font-size: 12px;
  font-weight: 400;
}

.field-block select,
.field-block input,
.sort-control select {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--canvas);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.field-block select:focus,
.field-block input:focus,
.sort-control select:focus {
  border-color: var(--focus);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(69, 143, 255, 0.16);
}

.rank-input-wrap {
  position: relative;
  display: block;
}

.rank-input-wrap input {
  padding-right: 44px;
  font-variant-numeric: tabular-nums;
}

.rank-input-wrap > span {
  position: absolute;
  top: 50%;
  right: 15px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.preference-fieldset {
  margin-top: 24px;
}

.preference-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 11px;
}

.preference-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  color: var(--body);
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 13px;
  transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.preference-button:active {
  transform: translateY(1px);
}

.preference-button.is-selected {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.preference-button.is-selected::before {
  content: "✓";
  font-size: 11px;
}

.form-error {
  min-height: 20px;
  margin: 14px 0 7px;
  color: var(--danger);
  font-size: 12px;
}

.entry-submit {
  display: flex;
  width: 100%;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  padding-left: 20px;
  font-size: 15px;
}

.action-arrow {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  background: rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  font-size: 17px;
}

.entry-aside {
  display: flex;
  flex-direction: column;
  padding: 36px 30px 30px;
  color: var(--ink);
  background: var(--cream);
  border-left: 1px solid #e9ddca;
}

.entry-aside-label {
  margin: 0;
  color: #745f43;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.entry-benefits {
  display: grid;
  gap: 0;
  margin: 18px 0 28px;
  padding: 0;
  list-style: none;
}

.entry-benefits li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  padding: 17px 0;
  border-bottom: 1px solid rgba(116, 95, 67, 0.17);
}

.entry-benefits li > span {
  color: var(--coral);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.entry-benefits strong,
.entry-benefits small {
  display: block;
}

.entry-benefits strong {
  font-size: 14px;
  font-weight: 600;
}

.entry-benefits small {
  margin-top: 3px;
  color: #6f675d;
  font-size: 12px;
  line-height: 1.6;
}

.entry-footnote {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 18px;
  color: #6f675d;
  border-top: 1px solid rgba(116, 95, 67, 0.17);
  font-size: 12px;
}

.entry-footnote p {
  margin: 0;
  line-height: 1.65;
}

.info-icon {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  background: var(--ink);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
}

/* Workspace */

.workspace-view {
  min-height: 100vh;
  background: var(--surface);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  height: var(--header-height);
  align-items: center;
  padding-right: 16px;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand-inverse {
  min-width: 304px;
  height: 100%;
  padding: 0 24px;
  border-right: 1px solid var(--line);
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
  padding: 0 12px;
}

.app-nav-item {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  border-radius: 9px;
  font-size: 13px;
}

.app-nav-item:active {
  background: var(--surface);
}

.app-nav-item.is-active {
  color: var(--ink);
  background: var(--surface);
  font-weight: 600;
}

.nav-count {
  display: grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  padding: 0 6px;
  color: #fff;
  background: var(--ink);
  border-radius: 999px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.header-action {
  min-height: 40px;
  margin-left: auto;
  padding: 0 14px;
  color: var(--ink);
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
}

.header-action:active {
  background: var(--surface);
}

.workspace-layout {
  display: grid;
  min-height: calc(100vh - var(--header-height));
  grid-template-columns: 304px minmax(0, 1fr);
}

.filter-sidebar {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  background: var(--canvas);
  border-right: 1px solid var(--line);
}

.sidebar-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 26px 24px 22px;
  border-bottom: 1px solid var(--line);
}

.sidebar-heading h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.25px;
}

.mobile-filter-summary,
.mobile-filter-toggle {
  display: none;
}

.workspace-form {
  display: grid;
  gap: 21px;
  padding: 24px;
}

.workspace-form .field-block select,
.workspace-form .field-block input {
  height: 44px;
  background: var(--surface-soft);
}

.sidebar-fieldset {
  display: grid;
  gap: 9px;
}

.preference-options-sidebar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 0;
}

.preference-options-sidebar .preference-button {
  min-height: 38px;
  justify-content: center;
  padding: 7px 8px;
  font-size: 12px;
}

.preference-options-sidebar .preference-button:first-child {
  grid-column: 1 / -1;
}

.compact-segments {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 3px;
  background: #eef0f3;
  border-radius: 9px;
}

.compact-segments button {
  min-height: 36px;
  padding: 7px 5px;
  color: var(--muted);
  background: transparent;
  border-radius: 7px;
  font-size: 12px;
}

.compact-segments button.is-selected {
  color: var(--ink);
  background: var(--canvas);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(24, 29, 38, 0.1);
}

.recalculate-button {
  width: 100%;
  min-height: 50px;
}

.workspace-form .form-error {
  min-height: 0;
  margin: -7px 0 -9px;
}

.sidebar-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 24px 24px;
  padding: 12px 14px;
  color: var(--muted);
  background: var(--cream);
  border-radius: 9px;
  font-size: 11px;
}

.sidebar-note strong {
  color: var(--warning);
  font-weight: 600;
}

.results-main {
  width: 100%;
  min-width: 0;
  max-width: 1480px;
  padding: 36px 36px 56px;
  scroll-margin-top: calc(var(--header-height) + 12px);
}

.results-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.breadcrumb {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  margin: 0 0 10px;
  padding: 4px 10px;
  color: var(--link);
  background: var(--link-soft);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
}

.results-heading h1 {
  margin: 0;
  font-size: clamp(30px, 3.6vw, 40px);
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: -0.8px;
}

.results-description {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.plan-button {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 16px;
  color: #fff;
  background: var(--ink);
  border-radius: 11px;
  font-weight: 500;
  box-shadow: 0 7px 18px rgba(24, 29, 38, 0.14);
}

.plan-button:active {
  transform: translateY(1px);
}

.plan-button span {
  display: grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  padding: 0 6px;
  color: var(--ink);
  background: var(--cream);
  border-radius: 7px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

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

.summary-cell {
  display: flex;
  min-height: 92px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.summary-cell > span {
  display: grid;
  gap: 3px;
  color: var(--body);
  font-size: 13px;
  font-weight: 500;
}

.summary-cell small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.summary-cell strong {
  font-size: 30px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.6px;
}

.summary-chong {
  background: var(--coral-soft);
  border-color: #f0d8d0;
}

.summary-wen {
  background: var(--link-soft);
  border-color: #d7e5ff;
}

.summary-bao {
  background: var(--forest-soft);
  border-color: #d1eadb;
}

.result-panel {
  overflow: hidden;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
}

.result-toolbar {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.result-tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface);
  border-radius: 9px;
}

.result-tab {
  min-width: 70px;
  min-height: 36px;
  padding: 0 13px;
  color: var(--muted);
  background: transparent;
  border-radius: 7px;
  font-size: 13px;
}

.result-tab.is-active {
  color: var(--ink);
  background: var(--canvas);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(24, 29, 38, 0.1);
}

.sort-control {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
}

.sort-control select {
  width: auto;
  min-width: 160px;
  height: 38px;
  padding: 0 30px 0 11px;
  background: var(--canvas);
}

.table-wrap {
  overflow-x: auto;
}

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

.candidate-table th,
.candidate-table td {
  padding: 15px 13px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

.candidate-table th {
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.candidate-table th:nth-child(1) {
  width: 80px;
}

.candidate-table th:nth-child(2) {
  width: 23%;
}

.candidate-table th:nth-child(3) {
  width: 24%;
}

.candidate-table th:nth-child(4) {
  width: 106px;
}

.candidate-table th:nth-child(5) {
  width: 118px;
}

.candidate-table th:nth-child(6) {
  width: 136px;
}

.candidate-table th:nth-child(7) {
  width: 112px;
}

.candidate-table tbody tr {
  transition: background-color 140ms ease;
}

.candidate-table tbody tr:hover {
  background: #fcfcfd;
}

.school-cell strong,
.major-cell strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.school-cell span,
.major-cell span {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-badge {
  display: inline-flex;
  min-width: 48px;
  height: 28px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.track-badge::before {
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  content: "";
}

.track-chong {
  color: var(--coral);
  background: var(--coral-soft);
}

.track-wen {
  color: var(--link);
  background: var(--link-soft);
}

.track-bao {
  color: var(--forest);
  background: var(--forest-soft);
}

.rank-number {
  color: var(--ink);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.rank-relation {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.fit-cell {
  display: grid;
  grid-template-columns: 34px minmax(48px, 1fr);
  align-items: center;
  gap: 9px;
}

.fit-cell strong {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.fit-bar {
  height: 6px;
  overflow: hidden;
  background: #e7e9ed;
  border-radius: 99px;
}

.fit-bar span {
  display: block;
  height: 100%;
  background: var(--link);
  border-radius: inherit;
}

.add-button {
  width: 92px;
  min-height: 38px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  font-size: 12px;
  font-weight: 500;
}

.add-button:active {
  background: var(--surface);
}

.add-button.is-added {
  color: var(--forest);
  background: var(--forest-soft);
  border-color: #b8dcc7;
}

.empty-result {
  padding: 72px 24px;
  text-align: center;
}

.empty-result strong {
  font-size: 18px;
  font-weight: 500;
}

.empty-result p {
  margin: 8px 0 0;
  color: var(--muted);
}

.table-footer {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 11px;
}

/* Drawer, modals and feedback */

.drawer-layer,
.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.drawer-backdrop,
.modal-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(13, 18, 24, 0.46);
  backdrop-filter: blur(2px);
}

.plan-drawer {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  width: min(480px, 100%);
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  background: var(--canvas);
  box-shadow: -18px 0 48px rgba(13, 18, 24, 0.16);
  animation: drawer-in 180ms ease-out;
}

@keyframes drawer-in {
  from { transform: translateX(22px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.drawer-header,
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 28px 22px;
  border-bottom: 1px solid var(--line);
}

.drawer-header h2,
.modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.35px;
}

.drawer-header h2 span {
  color: var(--link);
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--body);
  background: var(--surface);
  border-radius: 10px;
  font-size: 23px;
  line-height: 1;
}

.icon-button:active {
  color: #fff;
  background: var(--ink);
}

.drawer-body {
  overflow-y: auto;
  padding: 18px 24px;
}

.plan-empty {
  margin-top: 22px;
  padding: 52px 18px;
  background: var(--surface-soft);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  text-align: center;
}

.plan-empty strong {
  font-size: 16px;
  font-weight: 500;
}

.plan-empty p {
  margin: 8px auto 0;
  max-width: 290px;
  color: var(--muted);
  font-size: 12px;
}

.plan-list,
.generated-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: plan;
}

.plan-item,
.generated-item {
  position: relative;
  display: grid;
  counter-increment: plan;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.plan-item {
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.plan-item::before,
.generated-item::before {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--ink);
  background: var(--cream);
  border-radius: 8px;
  content: counter(plan);
  font-size: 11px;
  font-weight: 600;
}

.plan-item-main {
  min-width: 0;
}

.plan-item-main strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-item-main span {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-item-actions {
  display: grid;
  grid-template-columns: 30px 30px;
  gap: 5px;
}

.plan-item-actions button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--body);
  background: var(--surface);
  border-radius: 7px;
}

.plan-item-actions button:active:not(:disabled) {
  color: #fff;
  background: var(--ink);
}

.plan-item-actions button:disabled {
  color: var(--line-strong);
  cursor: not-allowed;
}

.remove-plan-button {
  grid-column: 1 / -1;
  width: 65px !important;
  color: var(--danger) !important;
  font-size: 11px;
}

.drawer-error {
  min-height: 18px;
  margin: 0;
  padding: 0 28px 8px;
  color: var(--danger);
  font-size: 12px;
}

.drawer-footer,
.modal-footer {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 9px;
  padding: 17px 24px;
  border-top: 1px solid var(--line);
}

.modal-layer {
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(700px, 100%);
  max-height: min(800px, calc(100vh - 48px));
  overflow-y: auto;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-panel);
  animation: modal-in 160ms ease-out;
}

@keyframes modal-in {
  from { transform: translateY(8px) scale(0.99); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-card-small {
  width: min(560px, 100%);
}

.generated-summary {
  margin: 0;
  padding: 17px 28px;
  color: var(--body);
  background: var(--cream);
  border-bottom: 1px solid #e9ddca;
}

.generated-list {
  padding: 18px 24px;
}

.generated-item {
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
}

.generated-item strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.generated-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.generated-warning {
  margin: 0 24px 18px;
  padding: 13px 14px;
  color: #6f5314;
  background: #fff8e8;
  border: 1px solid #f0dfb5;
  border-radius: 9px;
  font-size: 12px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
}

.modal-footer .primary-action {
  min-width: 140px;
}

.data-copy {
  padding: 24px 28px;
  color: var(--body);
  line-height: 1.75;
}

.data-copy p {
  margin: 0 0 12px;
}

.data-copy p:last-child {
  margin-bottom: 0;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 160;
  min-width: 220px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 13px 16px;
  color: #fff;
  background: var(--ink);
  border-radius: 11px;
  box-shadow: var(--shadow-panel);
  font-size: 13px;
  animation: toast-in 160ms ease-out;
}

@keyframes toast-in {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 1120px) {
  .workspace-layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .brand-inverse {
    min-width: 280px;
  }

  .results-main {
    padding-right: 24px;
    padding-left: 24px;
  }
}

@media (max-width: 900px) {
  .entry-panel {
    grid-template-columns: minmax(0, 1fr) 280px;
  }

  .entry-form-column {
    padding-right: 28px;
    padding-left: 28px;
  }
}

@media (max-width: 820px) {
  :root {
    --header-height: 60px;
  }

  .app-header {
    padding-right: 12px;
  }

  .app-nav {
    display: none;
  }

  .brand-inverse {
    min-width: 0;
    padding: 0 14px;
    border-right: 0;
  }

  .brand-inverse .brand-mark {
    width: 34px;
    height: 34px;
  }

  .workspace-layout {
    display: block;
  }

  .filter-sidebar {
    position: static;
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-heading {
    align-items: center;
    padding: 16px 20px;
  }

  .sidebar-heading .section-label,
  .sidebar-heading h2 {
    display: none;
  }

  .mobile-filter-summary {
    display: block;
    max-width: calc(100vw - 132px);
    margin: 0;
    overflow: hidden;
    color: var(--body);
    font-size: 13px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-filter-toggle {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    gap: 7px;
    padding: 0 11px;
    color: var(--ink);
    background: var(--surface);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
  }

  .mobile-filter-toggle > span:last-child {
    transition: transform 140ms ease;
  }

  .filter-sidebar.is-collapsed .sidebar-content {
    display: none;
  }

  .filter-sidebar.is-collapsed .mobile-filter-toggle > span:last-child {
    transform: rotate(-90deg);
  }

  .workspace-form {
    grid-template-columns: 1fr 1fr;
    padding: 20px;
  }

  .sidebar-fieldset,
  .workspace-form .form-error,
  .recalculate-button {
    grid-column: 1 / -1;
  }

  .preference-options-sidebar {
    grid-template-columns: repeat(4, 1fr);
  }

  .preference-options-sidebar .preference-button:first-child {
    grid-column: auto;
  }

  .sidebar-note {
    margin: 0 20px 20px;
  }

  .results-main {
    padding: 26px 20px 42px;
  }
}

@media (max-width: 720px) {
  .entry-main {
    padding: 40px 16px 64px;
  }

  .entry-copy {
    margin-bottom: 26px;
  }

  .entry-copy h1 {
    font-size: 38px;
  }

  .entry-copy > p {
    font-size: 15px;
  }

  .entry-panel {
    grid-template-columns: 1fr;
  }

  .entry-aside {
    border-top: 1px solid #e9ddca;
    border-left: 0;
  }
}

@media (max-width: 620px) {
  .entry-header {
    min-height: 62px;
    padding: 0 16px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
  }

  .entry-main {
    min-height: calc(100vh - 62px);
    padding: 32px 12px 52px;
  }

  .entry-copy {
    padding: 0 6px;
  }

  .entry-copy h1 {
    font-size: 33px;
    letter-spacing: -0.8px;
  }

  .entry-copy > p {
    line-height: 1.7;
  }

  .entry-meta {
    gap: 7px 16px;
    margin-top: 16px;
    font-size: 12px;
  }

  .entry-form-column {
    padding: 26px 20px 24px;
  }

  .entry-form-heading h2 {
    font-size: 21px;
  }

  .entry-field-row,
  .workspace-form {
    grid-template-columns: 1fr;
  }

  .entry-aside {
    padding: 26px 22px;
  }

  .preference-button {
    min-height: 42px;
  }

  .header-action {
    min-height: 38px;
    padding: 0 11px;
    font-size: 12px;
  }

  .workspace-form {
    gap: 18px;
  }

  .preference-options-sidebar {
    grid-template-columns: 1fr 1fr;
  }

  .results-main {
    padding: 22px 12px 36px;
  }

  .results-heading {
    align-items: flex-start;
    gap: 12px;
  }

  .breadcrumb {
    display: none;
  }

  .results-heading h1 {
    font-size: 30px;
  }

  .results-description {
    display: none;
  }

  .plan-button {
    min-width: auto;
    justify-content: center;
    padding: 9px 10px 9px 12px;
    border-radius: 10px;
    font-size: 12px;
  }

  .plan-button span {
    font-size: 11px;
  }

  .summary-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .summary-cell {
    min-height: 82px;
    padding: 14px;
  }

  .summary-cell strong {
    font-size: 26px;
  }

  .result-toolbar {
    display: grid;
    padding: 10px;
  }

  .result-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }

  .result-tab {
    min-width: 0;
    padding: 0 7px;
  }

  .sort-control {
    justify-content: space-between;
  }

  .sort-control select {
    flex: 1;
  }

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

  .candidate-table thead {
    display: none;
  }

  .candidate-table tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
    background: var(--surface);
  }

  .candidate-table tr {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    padding: 15px;
    background: var(--canvas);
    border: 1px solid var(--line);
    border-radius: 12px;
  }

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

  .candidate-table td::before {
    display: block;
    margin-bottom: 4px;
    color: var(--subtle);
    content: attr(data-label);
    font-size: 10px;
  }

  .candidate-table td:nth-child(1) {
    grid-column: 1 / 4;
    grid-row: 1;
  }

  .candidate-table td:nth-child(1)::before,
  .candidate-table td:nth-child(7)::before {
    display: none;
  }

  .candidate-table td:nth-child(7) {
    grid-column: 4 / 7;
    grid-row: 1;
    text-align: right;
  }

  .candidate-table td:nth-child(2) {
    grid-column: 1 / 7;
    grid-row: 2;
    margin-top: 14px;
  }

  .candidate-table td:nth-child(3) {
    grid-column: 1 / 7;
    grid-row: 3;
    margin-top: 12px;
    padding: 12px;
    background: var(--surface-soft);
    border-radius: 9px;
  }

  .candidate-table td:nth-child(4) {
    grid-column: 1 / 3;
    grid-row: 4;
    margin-top: 14px;
  }

  .candidate-table td:nth-child(5) {
    grid-column: 3 / 5;
    grid-row: 4;
    margin-top: 14px;
  }

  .candidate-table td:nth-child(6) {
    grid-column: 5 / 7;
    grid-row: 4;
    margin-top: 14px;
  }

  .school-cell strong,
  .major-cell strong,
  .school-cell span,
  .major-cell span {
    white-space: normal;
  }

  .school-cell strong {
    font-size: 16px;
  }

  .fit-cell {
    display: block;
  }

  .fit-bar {
    margin-top: 7px;
  }

  .add-button {
    width: 96px;
    min-height: 38px;
  }

  .table-footer {
    display: grid;
    line-height: 1.55;
  }

  .modal-layer {
    align-items: end;
    padding: 0;
  }

  .modal-card {
    width: 100%;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
  }

  .drawer-header,
  .modal-header {
    padding: 22px 20px 18px;
  }

  .drawer-footer {
    grid-template-columns: 92px minmax(0, 1fr);
    padding: 12px 16px;
  }

  .toast {
    right: 16px;
    bottom: 16px;
    left: 16px;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
