:root {
  --ink: #17202a;
  --muted: #667085;
  --line: #d9e2ec;
  --brand: #a52121;
  --navy: #173d52;
  --soft: #f5f7fa;
  --warn: #fff3cd;
}

* {
  box-sizing: border-box;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  color: var(--brand);
  font-size: 26px;
}

.topbar p {
  margin-top: 6px;
  color: var(--muted);
}

.status {
  min-width: 220px;
  padding: 10px 12px;
  text-align: center;
  color: var(--navy);
  background: #e7f1f7;
  border: 1px solid #c8ddea;
}

.layout {
  display: grid;
  grid-template-columns: minmax(700px, 1fr) minmax(460px, 520px);
  gap: 16px;
  padding: 16px;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  padding: 16px;
}

.panel h2 {
  margin-bottom: 14px;
  color: var(--navy);
  font-size: 18px;
}

.quick-fill {
  margin-bottom: 16px;
  padding: 14px;
  background: #f8fbfd;
  border: 1px solid #d5e3ec;
  border-left: 4px solid var(--navy);
}

.quick-fill-head {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.quick-fill h3 {
  margin: 0 0 4px;
  color: var(--navy);
  font-size: 16px;
}

.quick-fill p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.quick-example {
  flex: 0 1 520px;
  padding: 10px 12px;
  color: #24445a;
  background: #fff;
  border: 1px solid #d5e3ec;
}

.quick-example strong {
  display: block;
  margin-bottom: 5px;
  color: var(--brand);
  font-size: 13px;
}

.quick-example span {
  display: block;
  font-size: 12px;
  line-height: 1.55;
}

textarea {
  width: 100%;
  min-height: 112px;
  padding: 10px 12px;
  resize: vertical;
  border: 1px solid #b8c7d3;
  border-radius: 4px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  line-height: 1.55;
}

.excel-dropzone {
  position: relative;
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 86px;
  margin-top: 10px;
  padding: 14px;
  color: #24445a;
  background: #fff;
  border: 1px dashed #9fb8c8;
  cursor: pointer;
}

.excel-dropzone::before {
  content: "Excel";
  display: grid;
  place-items: center;
  min-height: 56px;
  color: #fff;
  background: var(--navy);
  font-weight: 700;
}

.excel-dropzone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.excel-dropzone strong {
  display: block;
  margin-bottom: 4px;
  color: var(--navy);
  font-size: 15px;
}

.excel-dropzone p {
  margin: 0;
}

.excel-dropzone-active {
  border-color: var(--brand);
  background: #fffafa;
}

.quick-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.button-secondary {
  color: var(--navy);
  background: #fff;
}

.button-active {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.voice-button {
  min-width: 150px;
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
  font-weight: 700;
}

.voice-button.button-active {
  box-shadow: 0 0 0 3px rgba(165, 33, 33, 0.16);
}

#parseStatus {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

#parseStatus.parse-status-ok {
  color: #175739;
}

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

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 13px;
}

label.wide {
  grid-column: span 3;
}

input,
select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #b8c7d3;
  border-radius: 4px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.checks,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.checks label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checks input {
  width: 16px;
  min-height: 16px;
}

button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--navy);
  border-radius: 4px;
  color: #fff;
  background: var(--navy);
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

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

.metrics div {
  min-height: 86px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid #d6e0ea;
  border-left: 4px solid var(--navy);
}

.metrics strong {
  display: block;
  min-height: 34px;
  margin-bottom: 6px;
  color: var(--brand);
  font-size: clamp(24px, 2.7vw, 34px);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.metrics #gradientCounts {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
  min-height: 34px;
}

.metric-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 8px;
  color: var(--brand);
  background: #fff;
  border: 1px solid #ead1d1;
  font-size: 16px;
  line-height: 1;
}

.metrics span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.warnings {
  min-height: 44px;
  padding: 10px;
  margin-bottom: 14px;
  background: var(--warn);
  border: 1px solid #f0d98c;
  line-height: 1.5;
}

.assessment-workbench {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.workbench-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

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

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

.assessment {
  min-height: 360px;
  padding: 18px;
  color: #1f3445;
  background: #f7fbf9;
  border: 1px solid #bedfcb;
  line-height: 1.58;
}

.assessment-empty,
.assessment-loading,
.assessment-error {
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
  background: #fbfcfd;
  border: 1px dashed #c7d4df;
}

.assessment-loading {
  color: #24445a;
  background: #eef8f3;
  border-style: solid;
}

.assessment-error {
  color: #8a1f11;
  background: #fff0ed;
  border-color: #efb5aa;
}

.assessment-loading-text {
  margin-bottom: 8px;
  color: var(--navy);
  font-size: 18px;
  font-weight: 700;
}

.assessment-report {
  display: grid;
  gap: 14px;
}

.assessment-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 14px;
  padding: 16px;
  background: #fff;
  border: 1px solid #d9eadf;
}

.assessment-kicker {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.assessment-hero h3 {
  margin: 0;
  color: var(--navy);
  font-size: 20px;
  line-height: 1.45;
}

.risk-badge {
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 10px;
  color: #fff;
  background: var(--navy);
}

.risk-badge span {
  margin-bottom: 4px;
  font-size: 12px;
}

.risk-badge strong {
  font-size: 30px;
}

.risk-高 {
  background: #a52121;
}

.risk-中 {
  background: #936312;
}

.risk-低 {
  background: #175739;
}

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

.assessment-meta div {
  padding: 12px;
  background: #fff;
  border: 1px solid #d9eadf;
}

.assessment-meta span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

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

.assessment-section {
  padding: 14px;
  background: #fff;
  border: 1px solid #d9eadf;
}

.assessment-section h4 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 14px;
}

.assessment-section p {
  margin: 0;
}

.argument-list {
  display: grid;
  gap: 8px;
}

.argument-card {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid #e0e8ef;
}

.argument-card span {
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.argument-card p {
  margin: 0;
}

.assessment-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0;
  background: transparent;
  border: 0;
}

.assessment-two-col > div {
  padding: 14px;
  background: #fff;
  border: 1px solid #d9eadf;
}

.assessment-muted {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

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

  .summary-panel {
    order: -1;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .grid,
  .metrics,
  .assessment-hero,
  .assessment-meta,
  .assessment-two-col {
    grid-template-columns: 1fr;
  }

  .quick-fill-head {
    display: grid;
  }

  .excel-dropzone {
    grid-template-columns: 1fr;
  }

  label.wide {
    grid-column: span 1;
  }
}

#rejectReasons {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #475467;
  line-height: 1.7;
}

.admin-tools {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.login-state {
  padding: 9px 10px;
  color: #7a4f00;
  background: #fff8e1;
  border: 1px solid #f0d98c;
  line-height: 1.45;
}

.login-state-ok {
  color: #175739;
  background: #e9f7ef;
  border-color: #abd9bd;
}

.login-state-fail {
  color: #8a1f11;
  background: #fff0ed;
  border-color: #efb5aa;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-row button {
  flex: 1;
  min-width: 120px;
}

.table-wrap {
  margin: 0 16px 20px;
  background: #fff;
  border: 1px solid var(--line);
  overflow: auto;
}

table {
  width: 100%;
  min-width: 1760px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #fff;
  background: var(--navy);
  white-space: nowrap;
  word-break: keep-all;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

th,
td {
  padding: 9px 10px;
  border: 1px solid var(--line);
  vertical-align: top;
}

th {
  height: 54px;
  padding: 0;
  border-color: #bed0dc;
}

.th-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 54px;
  padding: 0 8px;
  text-align: center;
  line-height: 1.2;
}

td {
  background: #fff;
  line-height: 1.45;
  word-break: break-word;
}

td:nth-child(1),
td:nth-child(2),
td:nth-child(3),
td:nth-child(5),
td:nth-child(6),
td:nth-child(8),
td:nth-child(9),
td:nth-child(10),
td:nth-child(11),
td:nth-child(12) {
  text-align: center;
  vertical-align: middle;
}

td:nth-child(13) {
  text-align: left;
  line-height: 1.45;
}

.col-seq {
  width: 56px;
}

.col-gradient {
  width: 62px;
}

.col-code {
  width: 92px;
}

.col-school {
  width: 150px;
}

.col-location {
  width: 82px;
}

.col-major-code {
  width: 82px;
}

.col-major {
  width: 180px;
}

.col-elective {
  width: 82px;
}

.col-plan {
  width: 64px;
}

.col-tuition {
  width: 92px;
}

.col-risk {
  width: 66px;
}

.col-verify {
  width: 118px;
}

.col-note {
  width: 620px;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 2px 6px;
  color: #111827;
  border-radius: 4px;
}

.tag-冲 {
  background: #ffe0e0;
}

.tag-稳 {
  background: #e0f2fe;
}

.tag-保 {
  background: #dcfce7;
}

.tag-垫 {
  background: #fef3c7;
}

.empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

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