:root {
  --bg: #f3f5f8;
  --card: #ffffff;
  --text: #1c2333;
  --muted: #5d6673;
  --line: #e3e7ee;
  --line-strong: #d3d9e3;
  --primary: #1f3c88;
  --primary-hover: #18306e;
  --primary-soft: #eef2fa;
  --ok: #1a7a3c;
  --ok-bg: #e8f6ec;
  --bad: #b42318;
  --bad-bg: #fdecea;
  --warn: #8a6a12;
  --warn-bg: #fbf3d9;
  --info: #1756a8;
  --info-bg: #e8f1fb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  --font: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100%;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }

.app-bar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
}
.app-bar .brand {
  color: var(--primary);
  font-weight: 650;
  font-size: 15px;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.app-bar .brand:hover { text-decoration: none; }
.app-bar .bar-meta {
  color: var(--muted);
  font-size: 13px;
}
.app-bar .bar-actions { display: flex; align-items: center; gap: 10px; }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}
.wrap-narrow {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 72px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
}
.card + .card { margin-top: 16px; }
.card h2 {
  font-size: 16px;
  font-weight: 650;
  margin-bottom: 14px;
}
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.card-head h2 { margin-bottom: 0; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.3;
}
.btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); text-decoration: none; color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--line-strong);
}
.btn.secondary:hover { background: var(--bg); color: var(--text); }
.btn.ghost {
  background: transparent;
  color: var(--primary);
  border-color: transparent;
  padding: 8px 10px;
}
.btn.ghost:hover { background: var(--primary-soft); color: var(--primary); }
.btn.block { width: 100%; }

input[type="text"],
input[type="password"],
input[type="number"],
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 60, 136, 0.12);
}
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }

.banner-error {
  max-width: 720px;
  margin: 20px auto;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--bad-bg);
  color: var(--bad);
}

.status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.6;
  white-space: nowrap;
}
.st-created { background: #eef0f4; color: #445; }
.st-typing { background: var(--info-bg); color: var(--info); }
.st-survey { background: var(--ok-bg); color: var(--ok); }
.st-submitted { background: var(--primary-soft); color: var(--primary); }
.st-stale { background: var(--warn-bg); color: var(--warn); }

/* ----- candidate gate / typing / done ----- */
.center-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 36px;
}
.center-card h1 {
  font-size: 22px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.02em;
}
.center-card .lead { margin-bottom: 24px; }

.type-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
}
.type-meta strong { color: var(--text); font-weight: 650; }

.hint {
  background: var(--primary-soft);
  color: #2a3b66;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 14px;
}

.text-box {
  background: #f8f9fc;
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  padding: 16px 18px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 17px;
  line-height: 1.85;
  white-space: pre-wrap;
  user-select: none;
  -webkit-user-select: none;
}

#inputText {
  width: 100%;
  height: 150px;
  padding: 14px;
  font-size: 16px;
  resize: none;
  margin-bottom: 16px;
}
#inputText[disabled] { background: #f3f4f6; }

/* ----- done page ----- */
.done-wrap { max-width: 800px; margin: 0 auto; padding: 32px 24px 72px; }
.done-hero { text-align: center; padding: 36px 32px 28px; }
.done-hero .kicker {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 650;
  margin-bottom: 10px;
}
.done-hero h1 { font-size: 24px; margin-bottom: 10px; }
.done-hero .lead { margin-bottom: 0; }
.time-display {
  font-size: 36px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--primary);
  margin: 8px 0 6px;
}
.done-card { max-width: 520px; width: 100%; text-align: center; padding: 48px 40px; }
.done-card .kicker {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 650;
  margin-bottom: 10px;
}
.done-card h1 { font-size: 24px; margin-bottom: 10px; }
.done-card .lead { margin-bottom: 28px; }
.summary-list {
  text-align: left;
  border-top: 1px solid var(--line);
}
.summary-list .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.summary-list .row .label { color: var(--muted); font-size: 13px; }
.summary-list .row .value { font-weight: 650; color: var(--text); }

/* ----- survey ----- */
.survey-page .app-bar { margin-bottom: 0; }
.survey-info { margin-bottom: 20px; }
.survey-info p + p { margin-top: 8px; }
.required { color: var(--bad); margin-right: 4px; }
.required-note { color: var(--muted); font-size: 13px; margin-top: 8px; }

.progress-container { margin: 8px 0 18px; }
.question-counter {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.progress-bar {
  height: 6px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
}
.progress {
  height: 100%;
  width: 0;
  background: var(--primary);
  border-radius: 99px;
}

.toggle-question-list {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 12px;
}
.toggle-question-list:hover { background: #fff; }

.question-list { display: none; margin-bottom: 16px; }
.question-list h3 { font-size: 14px; margin-bottom: 10px; }
.question-list-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.question-list-item {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.question-list-item.current { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.question-list-item.answered { border-color: #bad9c4; background: var(--ok-bg); }
.question-list-item.current.answered { border-color: var(--primary); }

.question-container {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 16px;
}
.question-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.question-text { font-size: 16px; font-weight: 600; line-height: 1.65; }
.question-type {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 999px;
}

.options-container { display: flex; flex-direction: column; gap: 8px; }
.option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}
.option:hover { border-color: #c5cfe0; }
.option.selected { border-color: var(--primary); background: var(--primary-soft); }
.option input { margin-top: 3px; }
.option label { font-weight: 400; margin: 0; cursor: pointer; }

.number-input-container { max-width: 280px; }
.number-input-hint { color: var(--muted); font-size: 13px; margin-top: 6px; }
.open-ended-answer { min-height: 140px; resize: vertical; }

.error-message {
  display: none;
  color: var(--bad);
  font-size: 13px;
  margin-top: 10px;
}

.navigation-buttons {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

/* ----- admin table ----- */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.data th, table.data td {
  padding: 11px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.data th {
  color: var(--muted);
  font-weight: 650;
  font-size: 12px;
  background: #f8f9fc;
}
table.data tr:hover td { background: #fafbfe; }
.link-btn { font-weight: 650; white-space: nowrap; }

.login-wrap {
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.login-card { width: 100%; max-width: 400px; }
.login-card h1 { font-size: 20px; margin-bottom: 8px; }
.login-card form { margin-top: 20px; }
.err { color: var(--bad); font-size: 13px; min-height: 1.2em; margin: 4px 0 10px; }

/* ----- admin detail ----- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  margin-bottom: 16px;
  color: var(--muted);
  text-decoration: none;
}
.back-link:hover { color: var(--primary); text-decoration: none; }

.page-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 8px;
}
.page-title h1 { font-size: 22px; font-weight: 650; }

.timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 20px;
}
.timeline .item .label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.timeline .item .value { font-weight: 600; font-size: 14px; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.stat {
  background: #f8f9fc;
  border-radius: 8px;
  padding: 14px 16px;
}
.stat .label { font-size: 12px; color: var(--muted); }
.stat .value { font-size: 20px; font-weight: 650; margin-top: 2px; }

.passage-block, .typed-block {
  background: #f8f9fc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  white-space: pre-wrap;
  line-height: 1.8;
  font-size: 15px;
}
.subhead { font-size: 13px; color: var(--muted); font-weight: 650; margin: 14px 0 8px; }

.qa-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.qa-item:last-child { border-bottom: 0; }
.qa-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.qa-q { font-weight: 600; margin-bottom: 8px; line-height: 1.6; }
.qa-a {
  background: #f8f9fc;
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.65;
}
.qa-a .choice { display: block; padding: 2px 0; }
.qa-a.empty { color: var(--muted); }

.att-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.att-table th, .att-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.att-table th { color: var(--muted); font-size: 12px; font-weight: 650; }
.ok { color: var(--ok); font-weight: 650; }
.bad { color: var(--bad); font-weight: 650; }
.score-line { margin-top: 12px; font-size: 14px; }

@media (max-width: 720px) {
  .app-bar { padding: 0 16px; }
  .wrap, .wrap-narrow { padding: 20px 16px 48px; }
  .center-card, .done-card, .done-hero { padding: 28px 20px; }
  .done-wrap { padding: 20px 16px 56px; }
  .stat-row { grid-template-columns: 1fr; }
  .question-header { flex-direction: column; }
  .navigation-buttons { flex-direction: column; }
  .btn { width: 100%; }
}

/* ----- start form / profile ----- */
.form-stack { margin-top: 8px; }
.form-field { margin-bottom: 14px; }
.form-field .hint-inline {
  display: block;
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
  margin-top: 2px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 60, 136, 0.12);
}
textarea.form-area { min-height: 110px; resize: vertical; }
.profile-list .row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}
.profile-list .row:last-child { border-bottom: 0; }
.profile-list .label { color: var(--muted); font-size: 13px; flex: 0 0 7.5em; }
.profile-list .value { font-weight: 600; text-align: right; white-space: pre-wrap; }
.profile-list .value.block { text-align: left; font-weight: 400; flex: 1; }
.done-actions { margin-top: 20px; text-align: center; }
@media (max-width: 720px) {
  .form-row { grid-template-columns: 1fr; }
}


/* ----- admin list tools / pager / delete ----- */
.list-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 14px;
}
.list-search {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
}
.list-search input[type="search"] {
  min-width: 220px;
  flex: 1;
  max-width: 420px;
  width: auto;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}
.list-search input[type="search"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 60, 136, 0.12);
}
.row-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  white-space: nowrap;
}
.link-btn.danger,
.btn.danger {
  color: var(--bad);
}
.btn.danger {
  background: #fff;
  border-color: #f1c5c1;
}
.btn.danger:hover,
.link-btn.danger:hover {
  background: #fef2f2;
  color: var(--bad);
  border-color: #e8b0ab;
  text-decoration: none;
}
.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
}
.pager[hidden] { display: none; }
.detail-actions { margin: 8px 0 16px; }

@media (max-width: 720px) {
  .list-tools .btn, .pager .btn, .detail-actions .btn { width: auto; }
}

.children-details { margin: 2px 0 14px; }
.children-details[hidden] { display: none !important; }
.child-block { padding: 12px 0 0; }
.child-block + .child-block { border-top: 1px solid var(--line); margin-top: 8px; }
.child-title { font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.child-block .form-field { margin-bottom: 0; }

.form-field[hidden] { display: none !important; }
.profile-list .label { flex: 0 0 10.5em; white-space: normal; }

.form-field .hint-inline.hint-highlight {
  display: inline-block;
  font-weight: 700;
  font-size: 14px;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 4px 8px;
  border-radius: 6px;
  margin: 4px 0 6px;
  line-height: 1.5;
}

.input-with-unit {
  display: flex;
  align-items: center;
  gap: 8px;
}
.input-with-unit input {
  flex: 1;
  min-width: 0;
}
.input-with-unit .input-unit {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.survey-info .survey-highlight {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.65;
  border-radius: 8px;
  border-left: 4px solid var(--primary);
}
.survey-info .survey-highlight + .required-note { margin-top: 12px; }
