:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #657184;
  --line: #d9e1ea;
  --paper: #f6f8fb;
  --panel: #ffffff;
  --brand: #176b87;
  --brand-strong: #0d4b63;
  --accent: #b64b3f;
  --gold: #b9812f;
  --green: #2f7d5c;
  --shadow: 0 18px 50px rgba(18, 33, 47, 0.1);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Noto Sans CJK SC",
    Arial,
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(23, 107, 135, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(182, 75, 63, 0.12), transparent 30%),
    var(--paper);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.topbar h1 {
  margin: 4px 0 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.08;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

.ghost-link,
button {
  border-radius: 8px;
  min-height: 42px;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  color: var(--brand-strong);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
}

.notice {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 14px;
  padding: 16px 18px;
  margin-bottom: 20px;
  border: 1px solid #f0d6b2;
  background: #fff7ea;
  border-radius: 8px;
}

.notice.compact {
  grid-template-columns: 120px 1fr;
}

.notice strong {
  color: #8a5416;
}

.notice p {
  margin: 0;
  color: #5f4a2e;
  line-height: 1.7;
}

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  align-items: start;
}

.side-panel,
.candidate-panel,
.questions-panel,
.submit-panel,
.result-panel,
.admin-controls,
.metric-grid > article,
.charts-grid > article,
.table-panel,
dialog {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(217, 225, 234, 0.92);
  box-shadow: var(--shadow);
  border-radius: 8px;
}

.side-panel {
  position: sticky;
  top: 18px;
  padding: 20px;
}

.progress-ring {
  display: grid;
  place-items: center;
  width: 164px;
  height: 164px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 58%, transparent 59%),
    conic-gradient(var(--brand) var(--progress, 0deg), #e7edf3 0);
}

.progress-ring span {
  font-size: 30px;
  font-weight: 800;
}

.progress-copy {
  display: grid;
  gap: 4px;
  text-align: center;
  margin-bottom: 18px;
}

.progress-copy span,
.muted {
  color: var(--muted);
}

.mini-bars {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.mini-bars:empty {
  display: none;
}

.mini-bar {
  display: grid;
  gap: 6px;
}

.mini-bar header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.track {
  height: 9px;
  border-radius: 999px;
  background: #e8edf2;
  overflow: hidden;
}

.track i {
  display: block;
  width: var(--value, 0%);
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--green));
}

.side-actions,
.export-actions,
.admin-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.assessment {
  display: grid;
  gap: 20px;
}

.candidate-panel,
.questions-panel,
.submit-panel,
.result-panel,
.table-panel {
  padding: 22px;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.section-heading span {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: var(--brand);
  font-weight: 800;
  font-size: 13px;
}

.section-heading h2 {
  margin: 0;
  font-size: 22px;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(23, 107, 135, 0.24);
  outline-offset: 2px;
}

.consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  color: var(--ink);
  line-height: 1.6;
}

.consent input {
  width: 18px;
  min-height: 18px;
  margin-top: 3px;
}

.scale-head,
.question-row {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) repeat(5, 126px);
  gap: 8px;
  align-items: center;
}

.scale-head {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 0 10px 10px;
}

.scale-head::before {
  content: "";
}

.scale-head span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  line-height: 1.35;
  white-space: nowrap;
}

.question-row {
  padding: 14px 10px;
  border-top: 1px solid #edf1f5;
}

.question-text {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: start;
  line-height: 1.65;
}

.question-text b {
  color: var(--brand);
}

.choice {
  display: grid;
  place-items: center;
}

.choice input {
  width: 22px;
  min-height: 22px;
  accent-color: var(--brand);
}

.primary,
.secondary {
  border: 0;
  padding: 0 16px;
  font-weight: 800;
}

.primary {
  color: #fff;
  background: var(--brand);
}

.primary:hover {
  background: var(--brand-strong);
}

.secondary {
  color: var(--brand-strong);
  background: #e8f3f6;
}

.secondary:hover {
  background: #d8ecf1;
}

.submit-panel {
  display: flex;
  align-items: center;
  gap: 14px;
}

.submit-panel p {
  margin: 0;
  color: var(--muted);
}

.hidden {
  display: none;
}

.result-panel {
  margin-top: 22px;
}

.result-hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.result-hero h2 {
  margin: 6px 0;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1;
}

.result-hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.stamp {
  display: grid;
  place-items: center;
  min-width: 118px;
  height: 118px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-size: 28px;
  font-weight: 900;
}

.dimension-grid,
.report-grid,
.metric-grid,
.charts-grid {
  display: grid;
  gap: 14px;
}

.dimension-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 18px 0;
}

.dimension-card,
.report-grid article,
.metric-grid > article,
.charts-grid > article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.dimension-card h3,
.report-grid h3,
.charts-grid h2 {
  margin: 0 0 10px;
}

.axis-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
}

.report-grid {
  grid-template-columns: 1.2fr 0.8fr;
}

.report-grid p,
.report-grid li {
  color: var(--muted);
  line-height: 1.75;
}

.export-actions {
  margin-top: 16px;
}

.admin-controls {
  padding: 16px;
  align-items: end;
  margin-bottom: 18px;
}

.inline-admin-controls {
  box-shadow: none;
  border: 0;
  padding: 0;
  margin-bottom: 10px;
}

.login-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
  padding: 28px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(217, 225, 234, 0.92);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 6px 0 10px;
  font-size: 34px;
}

.login-card p {
  color: var(--muted);
  line-height: 1.7;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.admin-controls label {
  flex: 1 1 220px;
}

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

.metric-grid strong {
  display: block;
  font-size: 30px;
}

.metric-grid span {
  color: var(--muted);
}

.charts-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

.dist-list {
  display: grid;
  gap: 10px;
}

.dist-row {
  display: grid;
  grid-template-columns: 90px 1fr 54px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

.dist-row strong {
  color: var(--ink);
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  padding: 12px 10px;
  border-top: 1px solid #edf1f5;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
}

td {
  line-height: 1.5;
}

.row-action {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand-strong);
  font-weight: 700;
}

dialog {
  width: min(860px, calc(100% - 28px));
  border: 1px solid var(--line);
  padding: 0;
}

dialog::backdrop {
  background: rgba(8, 18, 28, 0.46);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  margin: 0;
}

.icon-close {
  width: 38px;
  min-height: 38px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 24px;
}

pre {
  max-height: 70vh;
  overflow: auto;
  margin: 0;
  padding: 18px;
  white-space: pre-wrap;
  line-height: 1.6;
}

code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #f0f3f6;
}

@media (max-width: 900px) {
  .layout,
  .dimension-grid,
  .report-grid,
  .metric-grid,
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: static;
  }

  .scale-head {
    display: none;
  }

  .question-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .choice {
    display: flex;
    justify-content: flex-start;
    min-height: 38px;
    padding-left: 52px;
  }

  .choice label {
    display: flex;
  }

  .choice::after {
    content: attr(data-label);
    margin-left: 10px;
    color: var(--muted);
    font-size: 13px;
  }
}

@media (min-width: 901px) and (max-width: 1180px) {
  .scale-head,
  .question-row {
    grid-template-columns: minmax(300px, 1fr) repeat(5, minmax(86px, 1fr));
  }

  .scale-head {
    font-size: 12px;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .topbar,
  .result-hero,
  .submit-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .notice,
  .notice.compact,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .stamp {
    min-width: 94px;
    width: 94px;
    height: 94px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .notice,
  .layout,
  .export-actions {
    display: none;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .result-panel {
    display: block !important;
    box-shadow: none;
    border: 0;
  }
}
