:root {
  color-scheme: light;
  --bg: #f5f3ed;
  --ink: #1e2528;
  --muted: #667075;
  --line: #d9d4c8;
  --panel: #fffdf8;
  --panel-strong: #ffffff;
  --accent: #0f766e;
  --accent-dark: #0b5d56;
  --gold: #b7791f;
  --red: #b42318;
  --green: #16784c;
  --blue: #2f5f98;
  --shadow: 0 18px 44px rgba(51, 43, 25, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0 24px;
}

.top-actions,
.board-actions,
.plan-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 20px;
  letter-spacing: 0;
}

.workspace {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.input-panel,
.analysis-block,
.plan-board,
.notice,
.summary-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.input-panel {
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
}

.panel-heading p,
.notice,
#familySummary {
  color: var(--muted);
  line-height: 1.75;
}

.panel-heading.compact {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.panel-heading.compact h2 {
  font-size: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #354044;
  font-size: 13px;
  font-weight: 700;
}

.wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--ink);
  padding: 8px 10px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

.toggle-field {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.toggle-field input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.toggle-field span {
  color: #354044;
  font-size: 13px;
  font-weight: 800;
}

.postgraduate-tabs {
  margin-bottom: 12px;
  flex-wrap: wrap;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.score-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.primary-button,
.ghost-button,
.ghost-link,
.tab,
.row-button,
.icon-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
}

.candidate-title {
  align-items: end;
}

.candidate-table {
  min-width: 1860px;
}

.candidate-table th:nth-child(11),
.candidate-table td:nth-child(11) {
  min-width: 260px;
  line-height: 1.65;
}

.rank-score-card {
  margin-top: 12px;
}

.rank-score-slider-field {
  display: grid;
  grid-template-columns: 72px 132px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: 10px 0 6px;
  color: #354044;
  font-size: 12px;
  font-weight: 800;
}

.rank-score-slider-field input[type="number"] {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0 9px;
  color: var(--ink);
}

.rank-score-slider-field input[type="range"] {
  width: 100%;
  min-height: 22px;
  border: 0;
  background: transparent;
  padding: 0;
  accent-color: #1f68bc;
}

.rank-score-slider-field input[type="range"]:focus {
  box-shadow: none;
}

.candidate-filter-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0;
  overflow-x: auto;
}

.search-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.search-field input {
  width: min(360px, 100%);
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0 12px;
  color: var(--ink);
}

.compact-search input {
  width: 280px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 52px;
  color: var(--muted);
  font-size: 13px;
}

.icon-button:disabled,
.row-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.tag-待核验,
.tag-高冲 {
  background: #687378;
}

.status-badge,
.basis-badge {
  display: inline-flex;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px 6px;
  background: #f5f3ed;
  color: #465156;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.status-eligible,
.basis-major {
  border-color: #a7d2bd;
  background: #edf8f2;
  color: #12633f;
}

.status-blocked {
  border-color: #e0aaa4;
  background: #fff1ef;
  color: #9b2117;
}

.status-new,
.basis-new {
  border-color: #c4cbd0;
  background: #f2f4f5;
  color: #4b575d;
}

.status-special,
.basis-school {
  border-color: #dfc28c;
  background: #fff7e8;
  color: #8a5a0d;
}

.plans-shell {
  width: min(1680px, 100%);
}

.detail-shell {
  width: min(1120px, 100%);
}

.detail-profile {
  padding: 24px;
}

.plan-query-panel {
  padding: 20px;
}

.plan-batch-tabs {
  margin: 12px 0;
  overflow-x: auto;
}

.query-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.plan-query-table table {
  min-width: 1380px;
}

.plan-query-table td:nth-child(1),
.plan-query-table td:nth-child(2) {
  min-width: 190px;
}

.plan-query-table td:nth-child(5) {
  min-width: 360px;
  max-width: 520px;
}

.restriction-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 7px;
}

.restriction-tag-list span {
  border: 1px solid #dfc28c;
  border-radius: 4px;
  background: #fff7e8;
  color: #80520c;
  padding: 3px 6px;
  font-size: 11px;
  font-weight: 800;
}

.plan-query-table details summary {
  color: var(--accent-dark);
  cursor: pointer;
  font-weight: 800;
}

.plan-query-table details p {
  margin: 8px 0;
  color: #465156;
  line-height: 1.65;
}

.year-count-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(70px, 1fr));
  gap: 5px;
  min-width: 250px;
}

.year-count-grid span {
  display: grid;
  gap: 2px;
  border-left: 2px solid var(--line);
  padding-left: 6px;
  color: var(--muted);
  font-size: 11px;
}

.year-count-grid b {
  color: var(--ink);
}

.trend-badge {
  display: inline-flex;
  margin-top: 7px;
  border-radius: 4px;
  background: #f1f2f2;
  color: var(--muted);
  padding: 3px 6px;
  font-size: 11px;
  font-weight: 800;
}

.trend-up {
  background: #edf8f2;
  color: #12633f;
}

.trend-down {
  background: #fff1ef;
  color: #9b2117;
}

.trend-unknown {
  background: #fff6dc;
  color: #785a08;
}

.trend-highlight {
  box-shadow: inset 0 0 0 1px currentColor;
}

.plan-count-reference {
  display: grid;
  justify-items: start;
  gap: 3px;
  margin-top: 6px;
  min-width: 190px;
}

.plan-count-years {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  white-space: nowrap;
}

.history-match-note {
  display: block;
  margin-top: 5px;
  max-width: 280px;
  color: var(--muted);
  line-height: 1.45;
}

.source-footnote {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.primary-button {
  margin-top: 4px;
  background: var(--accent);
  color: white;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.ghost-button {
  background: #fff;
  color: var(--accent-dark);
  border-color: var(--line);
  padding: 0 14px;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  background: #fff;
  color: var(--accent-dark);
  border: 1px solid var(--line);
  padding: 0 14px;
  text-decoration: none;
}

.ghost-button.full {
  width: 100%;
}

.ghost-button.small {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.result-panel {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.notice {
  padding: 14px 16px;
}

.notice.subtle {
  box-shadow: none;
  background: #fff9ec;
  border-color: #e4c58e;
}

.notice strong {
  color: var(--ink);
  margin-right: 8px;
}

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

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

.rule-strip article {
  border: 1px solid #c8e1dc;
  border-radius: 8px;
  background: #f0fbf8;
  padding: 12px;
}

.rule-strip strong,
.rule-strip span {
  display: block;
}

.rule-strip strong {
  margin-bottom: 6px;
  color: var(--accent-dark);
}

.rule-strip span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

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

.summary-card {
  padding: 16px;
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.score-release-sprint {
  border-color: #d8e5e1;
  background: #fbfdfc;
}

.sprint-dashboard {
  display: grid;
  gap: 14px;
}

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

.sprint-card strong {
  font-size: 22px;
}

.sprint-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.5;
}

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

.sprint-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.sprint-panel h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.sprint-panel ul {
  margin: 0;
  padding-left: 18px;
  color: #465156;
  font-size: 13px;
  line-height: 1.7;
}

.sprint-focus-table {
  margin-top: 0;
}

.analysis-block {
  padding: 18px;
  min-width: 0;
}

.plan-board {
  padding: 18px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.section-title h2 {
  margin-bottom: 0;
}

.section-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

#riskBadge {
  flex: none;
  border-radius: 999px;
  background: #e8f3f1;
  color: var(--accent-dark);
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 800;
}

.tab-group {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  background: #eee9df;
  border-radius: 8px;
}

.tab {
  min-height: 32px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
}

.tab.active {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.score-rank-card {
  border: 1px solid #d9d4c8;
  border-radius: 12px;
  background: #eeeeea;
  color: #354044;
  padding: 14px 16px;
  box-shadow: 0 14px 32px rgba(51, 43, 25, 0.08);
}

.score-rank-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.score-rank-eyebrow {
  margin: 0 0 6px;
  color: #354044;
  font-size: 15px;
  font-weight: 900;
}

.score-current {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.score-current strong {
  color: #1f68bc;
  font-size: 34px;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
}

.score-stage {
  display: inline-flex;
  width: max-content;
  margin: 0;
  border-radius: 6px;
  background: #fffdf8;
  color: #354044;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
}

.rank-average-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(112px, 1fr));
  gap: 10px;
  justify-items: end;
  min-width: 260px;
}

.rank-average-panel div {
  display: grid;
  gap: 2px;
  justify-items: end;
}

.rank-average-panel span {
  color: #354044;
  font-size: 13px;
  font-weight: 900;
}

.rank-average-panel strong {
  color: #1f68bc;
  font-size: 24px;
  line-height: 1.05;
  white-space: nowrap;
}

.score-slider-field {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: 10px 0 6px;
  color: #354044;
  font-size: 12px;
  font-weight: 800;
}

.score-slider-field input {
  width: 100%;
  min-height: 22px;
  border: 0;
  background: transparent;
  padding: 0;
  accent-color: #1f68bc;
}

.score-slider-field input:focus {
  box-shadow: none;
}

.score-rank-summary {
  margin: 6px 0 10px;
  color: #667075;
  font-size: 12px;
  line-height: 1.6;
}

.score-rank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.rank-year-card {
  min-height: 74px;
  border-radius: 8px;
  background: #fffdf8;
  padding: 12px 14px;
}

.rank-year-card span,
.rank-year-card em {
  display: block;
  color: #354044;
  font-style: normal;
  font-weight: 800;
}

.rank-year-card span {
  margin-bottom: 6px;
  font-size: 13px;
}

.rank-year-card strong {
  display: block;
  color: #1f68bc;
  font-size: 20px;
  line-height: 1.05;
}

.rank-year-card em {
  margin-top: 4px;
  color: #667075;
  font-size: 11px;
}

.rank-color-1 strong {
  color: #3f8d22;
}

.rank-color-2 strong {
  color: #a76207;
}

.muted-card strong {
  color: #8f8d86;
}

.school-lookup-bar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.school-lookup-summary {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.compact-table table {
  min-width: 920px;
}

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

th,
td {
  border-bottom: 1px solid #ebe6dc;
  padding: 12px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  background: #f7f3ea;
  color: #3a4549;
  font-size: 12px;
  letter-spacing: 0;
}

tr:last-child td {
  border-bottom: 0;
}

.tag,
.risk {
  display: inline-flex;
  min-width: 34px;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  color: white;
  font-size: 12px;
  font-weight: 900;
}

.info-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-left: 6px;
  border: 1px solid #bcdacb;
  border-radius: 999px;
  background: #f4fbf7;
  color: var(--accent-dark);
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  vertical-align: middle;
}

.tag-冲 {
  background: var(--gold);
}

.tag-稳 {
  background: var(--blue);
}

.tag-保 {
  background: var(--green);
}

.risk-高 {
  background: var(--red);
}

.risk-中 {
  background: var(--gold);
}

.risk-低 {
  background: var(--green);
}

.muted {
  color: var(--muted);
}

.empty-table {
  color: var(--muted);
  text-align: center;
  padding: 22px;
  font-weight: 800;
}

.import-panel {
  display: grid;
  gap: 12px;
}

.data-status {
  border: 1px solid #c8e1dc;
  border-radius: 8px;
  background: #f0fbf8;
  padding: 10px;
}

.data-status strong,
.data-status span {
  display: block;
}

.data-status strong {
  margin-bottom: 4px;
  color: var(--accent-dark);
}

.data-status span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.file-field {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.file-field input {
  min-height: auto;
  border: 0;
  padding: 0;
  background: transparent;
}

.template-links {
  display: flex;
  gap: 12px;
  font-size: 13px;
}

.template-links a {
  color: var(--accent-dark);
  font-weight: 800;
}

.admin-shell {
  max-width: 1280px;
}

.admin-grid {
  display: grid;
  gap: 16px;
}

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

.import-grid.single-row {
  grid-template-columns: minmax(280px, 1fr);
}

.compact-status-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 12px 0;
}

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

.settings-grid label {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.settings-grid input,
.settings-grid select {
  min-height: 36px;
}

.rule-explain-grid,
.gap-dashboard,
.rule-impact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.compact-title {
  margin-top: 18px;
}

.rule-impact-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
}

.impact-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.impact-card.active {
  border-color: #8bc8bd;
  background: #f0fbf8;
}

.impact-card > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.impact-card > strong {
  display: block;
  margin: 8px 0 10px;
  font-size: 28px;
}

.impact-bars {
  display: grid;
  gap: 7px;
}

.impact-bar-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 38px;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.impact-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #eee9df;
}

.impact-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

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

.gap-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.gap-card span,
.gap-card em {
  display: block;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
}

.gap-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 26px;
}

.gap-card.high {
  border-color: #efb7b2;
  background: #fff4f2;
}

.gap-card.medium {
  border-color: #e4c58e;
  background: #fff9ec;
}

.gap-card.low {
  border-color: #bcdacb;
  background: #f4fbf7;
}

.row-button {
  min-height: 32px;
  padding: 0 10px;
  background: #ecf7f5;
  color: var(--accent-dark);
  border-color: #c8e1dc;
  white-space: nowrap;
}

.row-button.secondary {
  background: #fff;
  color: #465156;
  border-color: var(--line);
}

.row-actions {
  display: grid;
  gap: 6px;
  min-width: 76px;
}

.profile-drawer-shell {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(560px, 46vw);
  visibility: hidden;
  pointer-events: none;
}

.profile-drawer-shell.open {
  visibility: visible;
  pointer-events: auto;
}

.profile-drawer-backdrop {
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(30, 37, 40, 0.34);
  opacity: 0;
  cursor: default;
}

.profile-drawer-shell.open .profile-drawer-backdrop {
  opacity: 1;
}

.profile-drawer {
  height: 100vh;
  overflow: hidden;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 44px rgba(30, 37, 40, 0.16);
  transform: translateX(100%);
}

.profile-drawer-shell.open .profile-drawer {
  transform: translateX(0);
}

.profile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 92px;
  border-bottom: 1px solid var(--line);
  padding: 18px 20px;
}

.profile-drawer-header h2,
.profile-drawer-header p {
  margin-bottom: 0;
}

.ghost-link.small {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.profile-drawer-content {
  height: calc(100vh - 92px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 20px 40px;
}

.drawer-open {
  overflow: hidden;
}

.profile-loading,
.profile-section {
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

.profile-loading {
  color: var(--muted);
  font-weight: 800;
}

.profile-section:first-child {
  padding-top: 0;
}

.profile-section:last-child {
  border-bottom: 0;
}

.profile-section h3,
.profile-section h4 {
  margin: 0 0 10px;
  letter-spacing: 0;
}

.profile-section h3 {
  font-size: 18px;
}

.profile-section h4 {
  font-size: 14px;
}

.profile-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-section-title span {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f5f3ed;
  color: var(--muted);
  padding: 3px 6px;
  font-size: 11px;
  font-weight: 800;
}

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

.profile-facts span {
  display: grid;
  gap: 4px;
  min-width: 0;
  border-left: 2px solid #c8e1dc;
  padding: 7px 9px;
  background: #f8faf8;
  color: #465156;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.profile-facts b,
.profile-copy b,
.career-grid b {
  color: var(--ink);
  font-size: 12px;
}

.profile-columns,
.career-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.profile-columns > div,
.career-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.profile-section ul {
  margin: 0;
  padding-left: 18px;
  color: #465156;
  font-size: 13px;
  line-height: 1.7;
}

.profile-copy {
  margin-top: 12px;
}

.profile-copy p,
.career-grid p,
.career-grid small,
.profile-policy,
.profile-muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.profile-copy p,
.career-grid p {
  margin: 5px 0 10px;
}

.profile-table-wrap {
  margin-top: 8px;
  overflow-x: auto;
}

.profile-history-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 420px;
  font-size: 13px;
}

.profile-history-table th,
.profile-history-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}

.profile-history-table th {
  background: #f6f2ea;
  color: var(--muted);
  font-size: 12px;
}

.profile-policy {
  margin: 12px 0 0;
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}

.profile-warning {
  color: #8a5a0d;
}

.plan-health {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.strategy-panel {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f5ef;
  padding: 12px;
}

.strategy-fields {
  display: grid;
  grid-template-columns: repeat(3, 92px);
  gap: 8px;
}

.strategy-fields label {
  grid-template-columns: 20px 1fr;
  align-items: center;
}

.strategy-fields input {
  min-height: 36px;
}

.strategy-summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.strategy-summary strong {
  white-space: nowrap;
}

.strategy-summary strong.invalid {
  color: var(--red);
}

.strategy-summary span {
  color: var(--muted);
  font-size: 12px;
}

.health-card.info {
  border-color: #b8cadb;
  background: #f3f7fb;
}

.quality-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.health-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.health-card strong,
.health-card span {
  display: block;
}

.health-card strong {
  margin-bottom: 6px;
}

.health-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.health-card.ok {
  border-color: #bcdacb;
  background: #f4fbf7;
}

.health-card.warn {
  border-color: #e4c58e;
  background: #fff9ec;
}

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

.plan-item,
.empty-plan {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  border: 1px solid #e7e0d2;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.empty-plan {
  display: block;
  color: var(--muted);
}

.plan-rank {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f0eadf;
  font-weight: 900;
}

.plan-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  line-height: 1.35;
}

.plan-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.icon-button {
  width: 30px;
  min-height: 30px;
  background: #f6f2ea;
  border-color: var(--line);
  color: var(--ink);
}

.plan-detail-button {
  min-height: 30px;
  padding: 0 10px;
  border-color: #bcd8d2;
  background: #f0faf7;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.plan-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .input-panel {
    position: static;
  }

  .summary-grid,
  .sprint-card-grid,
  .rule-strip,
  .admin-status-grid,
  .import-grid,
  .settings-grid,
  .rule-explain-grid,
  .rule-impact-grid,
  .gap-dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .plan-health {
    grid-template-columns: 1fr;
  }

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

  .strategy-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .strategy-summary {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .score-rank-head {
    grid-template-columns: 1fr;
  }

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

  .rank-average-panel {
    min-width: 0;
    justify-items: stretch;
  }

  .rank-average-panel div {
    justify-items: start;
  }

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

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

  .plan-item {
    grid-template-columns: 34px minmax(0, 1fr);
  }

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

  .profile-drawer-backdrop {
    display: none;
  }

  .profile-drawer {
    grid-column: 1;
    border-left: 0;
  }

  .plan-risk,
  .plan-actions {
    grid-column: 2;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .board-actions {
    flex-wrap: wrap;
  }

  .candidate-filter-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .rank-score-slider-field {
    grid-template-columns: 1fr;
  }

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

  .candidate-filter-row .tab-group,
  .plan-batch-tabs {
    width: 100%;
  }

  .compact-search input,
  .plan-search input {
    width: 100%;
  }

  .query-stats {
    grid-template-columns: 1fr;
  }

  .score-row,
  .school-lookup-bar,
  .summary-grid,
  .sprint-card-grid,
  .rule-strip,
  .score-rank-grid,
  .admin-status-grid,
  .import-grid,
  .settings-grid,
  .rule-explain-grid,
  .rule-impact-grid,
  .gap-dashboard,
  .quality-grid {
    grid-template-columns: 1fr;
  }

  .score-rank-card {
    padding: 14px;
  }

  .score-current strong {
    font-size: 30px;
  }

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

  .rank-average-panel strong {
    font-size: 20px;
  }

  .score-slider-field {
    grid-template-columns: 1fr;
  }

  .profile-drawer-header {
    min-height: 112px;
    align-items: flex-start;
  }

  .profile-drawer-content {
    height: calc(100vh - 112px);
    padding: 14px 14px 32px;
  }

  .profile-facts,
  .profile-columns,
  .career-grid {
    grid-template-columns: 1fr;
  }

}

/* iOS Safari mobile upload patch: keep the whole page scrollable and expose result/actions. */
@media (max-width: 760px) {
  html {
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
    scroll-padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  body {
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .app-shell {
    width: 100%;
    padding: 10px 10px calc(88px + env(safe-area-inset-bottom));
  }

  .topbar {
    gap: 10px;
    padding: 10px 0 12px;
  }

  .top-actions,
  .board-actions,
  .plan-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  .top-actions > *,
  .board-actions > *,
  .plan-actions > * {
    width: 100%;
    min-width: 0;
    padding-left: 8px;
    padding-right: 8px;
    white-space: normal;
    text-align: center;
  }

  .workspace {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .input-panel {
    position: static;
    order: 1;
    max-height: none;
    overflow: visible;
    overflow-y: visible;
    overscroll-behavior: auto;
    padding: 14px;
  }

  .result-panel {
    order: 2;
    display: grid;
    gap: 12px;
    min-width: 0;
  }

  .form-grid {
    gap: 12px;
  }

  .form-grid,
  .score-row,
  .profile-metrics {
    grid-template-columns: 1fr;
  }

  input,
  select,
  textarea,
  button {
    font-size: 16px;
  }

  .primary-button.wide {
    position: sticky;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 20;
    min-height: 52px;
    border-radius: 10px;
    box-shadow: 0 10px 26px rgba(15, 118, 110, 0.26);
  }

  .analysis-block,
  .plan-board,
  .notice,
  .summary-card,
  .score-rank-card {
    box-shadow: 0 8px 22px rgba(51, 43, 25, 0.08);
  }

  .section-title {
    gap: 8px;
  }

  .candidate-filter-row,
  .strategy-panel,
  .school-lookup-bar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .candidate-filter-row .tab-group,
  .tab-group,
  .plan-batch-tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-wrap {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }

  table,
  .candidate-table,
  .plan-query-table table,
  .compact-table table {
    min-width: 980px;
  }

  th {
    top: 0;
  }

  .score-rank-head,
  .rank-average-panel,
  .score-rank-grid,
  .summary-grid,
  .rule-strip,
  .sprint-card-grid,
  .sprint-columns {
    grid-template-columns: 1fr;
  }

  .rank-average-panel,
  .rank-average-panel div {
    justify-items: start;
  }

  .score-current {
    flex-wrap: wrap;
  }

  .score-current strong {
    font-size: 28px;
  }

  .rank-score-slider-field,
  .score-slider-field,
  .strategy-fields {
    grid-template-columns: 1fr;
  }

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

  .profile-drawer {
    width: 100%;
    height: 100dvh;
    border-left: 0;
  }

  .profile-drawer-header {
    min-height: auto;
    padding: 14px 14px 12px;
  }

  .profile-drawer-content {
    height: calc(100dvh - 92px);
    padding: 14px 14px calc(36px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
  }

  .drawer-open {
    overflow: hidden;
  }
}
