/* ============================================================
   编者设置：试卷列表、编辑器、复议处理
   ============================================================ */

.setting-main { padding: 96px 0 40px; }

.setting-loading { padding-top: 20px; }
.setting-skeleton { height: 420px; border-radius: 22px; }

.setting-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.setting-header h1 { font-size: 28px; letter-spacing: -.01em; }
.setting-header p { margin-top: 6px; color: var(--muted); font-size: 13px; }

.setting-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.setting-layout {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

/* ---------- 左侧列表 ---------- */
.exam-side {
  position: sticky;
  top: 86px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .82);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-sm);
}

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--navy);
  font-size: 12.5px;
  font-weight: 700;
}

.side-head span { color: var(--muted); font-weight: 400; }

.exam-side-list { display: grid; gap: 5px; max-height: 48vh; overflow-y: auto; margin-bottom: 10px; }

.side-exam {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  transition: .16s ease;
}

.side-exam:hover { background: var(--blue-50); }
.side-exam.is-active { background: var(--blue-100); border-color: var(--blue-200); }

.side-status { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: var(--muted-2); flex: none; }
.side-status.is-published { background: var(--success); }
.side-status.is-draft { background: var(--warning); }

.side-exam-main { min-width: 0; }
.side-exam-title {
  display: block;
  overflow: hidden;
  color: var(--navy);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-exam-sub { display: block; margin-top: 1px; color: var(--muted); font-size: 10.5px; }

.side-divider { height: 1px; margin: 12px 0; background: var(--line-soft); }

.side-actions { display: grid; gap: 6px; }

.side-mini {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
}
.side-mini:hover { border-color: var(--blue-300); color: var(--blue-700); }

/* ---------- 编辑器 ---------- */
.editor-panel {
  border-radius: 20px;
  background: #fff;
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.editor-tabs {
  display: flex;
  gap: 2px;
  padding: 6px 10px 0;
  border-bottom: 1px solid var(--line-soft);
  background: #fbfdff;
  overflow-x: auto;
}

.editor-tab {
  position: relative;
  padding: 12px 16px;
  border: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.editor-tab:hover { color: var(--blue-700); }
.editor-tab.is-active { color: var(--blue-700); background: #fff; }
.editor-tab.is-active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  background: var(--blue-600);
  border-radius: 2px;
}

.editor-tab .count {
  display: inline-block;
  margin-left: 5px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--blue-100);
  color: var(--blue-700);
  font-size: 10.5px;
  line-height: 17px;
}

.editor-body { padding: 26px; min-height: 480px; }

.editor-section-title { margin-bottom: 4px; font-size: 17px; }
.editor-section-desc { margin-bottom: 20px; color: var(--muted); font-size: 12.5px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .col-2 { grid-column: 1 / -1; }

.form-grid .input, .form-grid .select { background: #fff; }

.total-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--blue-50);
  color: var(--muted);
  font-size: 12.5px;
}

.total-hint strong { color: var(--navy); font-size: 18px; }

/* 题目编辑 */
.question-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.add-question { display: flex; gap: 6px; flex-wrap: wrap; }

.q-editor {
  margin-bottom: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: #fbfdff;
  overflow: hidden;
}

.q-editor-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  background: #f4f9ff;
  border-bottom: 1px solid var(--line-soft);
}

.q-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--blue-100);
  color: var(--blue-700);
  font-size: 11.5px;
  font-weight: 700;
}

.q-type-tag { color: var(--muted); font-size: 11.5px; }

.q-editor-head > .select {
  width: 122px;
  min-height: 34px;
  padding: 4px 30px 4px 10px;
  font-size: 12.5px;
  flex: none;
}

.q-score-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.q-score-wrap .input {
  width: 64px;
  min-height: 34px;
  padding: 4px 6px;
  font-size: 12.5px;
  text-align: center;
}

.q-editor-actions { display: flex; gap: 4px; margin-left: auto; }

.q-mini {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
}
.q-mini:hover { border-color: var(--blue-300); color: var(--blue-700); }
.q-mini.is-danger:hover { border-color: #f3b4b4; color: var(--danger); background: var(--danger-bg); }

.q-editor-body { display: grid; gap: 12px; padding: 14px; }

.q-editor.is-collapsed .q-editor-body { display: none; }
.q-editor.is-collapsed .q-editor-head { border-bottom: 0; }

.q-summary {
  display: none;
  flex: 1;
  min-width: 0;
  margin-left: 6px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.q-editor.is-collapsed .q-summary { display: block; }
.q-toggle { font-size: 15px; font-weight: 700; }

@media (max-width: 720px) {
  .q-editor-head { flex-wrap: wrap; }
  .q-summary { width: 100%; margin-left: 33px; }
  .q-editor-actions { margin-left: auto; }
}

.q-editor-body .field > label { font-size: 12px; }
.q-editor-body .input, .q-editor-body .textarea, .q-editor-body .select { font-size: 13.5px; }
.q-editor-body .textarea { min-height: 110px; }

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

.q-answer-hint { color: var(--muted-2); font-size: 11px; }

/* 设置项 */
.setting-list { display: grid; gap: 2px; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 4px;
  border-bottom: 1px solid var(--line-soft);
}

.setting-row:last-child { border-bottom: 0; }
.setting-row-main h3 { font-size: 13.5px; }
.setting-row-main p { margin-top: 3px; color: var(--muted); font-size: 11.5px; }

.switch { position: relative; width: 44px; height: 25px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch i {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #dbe7fb;
  transition: .18s ease;
  pointer-events: none;
}
.switch i::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .2);
  transition: .18s ease;
}
.switch input:checked + i { background: var(--blue-600); }
.switch input:checked + i::after { transform: translateX(19px); }

.number-input { width: 92px; }
.number-input input { min-height: 38px; text-align: center; }

/* 发布 */
.publish-status { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }

.status-option {
  flex: 1;
  min-width: 160px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}

.status-option.is-active { border-color: var(--blue-500); background: #f5faff; box-shadow: 0 0 0 3px rgba(59, 130, 246, .1); }
.status-option strong { display: block; color: var(--navy); font-size: 13.5px; }
.status-option span { color: var(--muted); font-size: 11.5px; }

.check-list { display: grid; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; }
.check-list li { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.check-list li svg { width: 15px; height: 15px; color: var(--success); flex: none; }
.check-list li.is-fail { color: var(--danger); }
.check-list li.is-fail svg { color: var(--danger); }

.publish-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

/* 复议 */
.appeal-admin {
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  margin-bottom: 12px;
  background: #fbfdff;
}

.appeal-admin-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.appeal-admin-head h3 { font-size: 13.5px; }
.appeal-admin-head .badge { margin-left: auto; }
.appeal-admin p { margin-top: 6px; color: var(--muted); font-size: 12.5px; line-height: 1.7; }

/* ---------- 富文本题目编辑器 ---------- */
.rich-field { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: #fff; }
.rich-field:focus-within { border-color: var(--blue-400); box-shadow: 0 0 0 3px rgba(37, 99, 235, .09); }

.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line-soft);
  background: #f8fbff;
}

.rich-toolbar button {
  min-width: 28px;
  height: 27px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #45617f;
  background: transparent;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.rich-toolbar button:hover { border-color: var(--blue-200); color: var(--blue-700); background: #fff; }
.rich-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--line); }

.rich-editor {
  min-height: 92px;
  padding: 12px 14px;
  outline: none;
  color: #22374f;
  font-size: 13px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.rich-editor:empty::before {
  content: attr(data-placeholder);
  color: #9db0c4;
  pointer-events: none;
}

.rich-editor h3 { margin: 8px 0 4px; font-size: 15px; color: var(--navy); }
.rich-editor blockquote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--blue-300); color: #55708e; background: #f6faff; }
.rich-editor pre { margin: 8px 0; padding: 10px 12px; border-radius: 8px; overflow: auto; color: #d8e8ff; background: #14253d; font-size: 12px; }
.rich-editor code { padding: 1px 5px; border-radius: 4px; background: #edf4ff; color: #24539a; font-size: 12px; }
.rich-editor pre code { padding: 0; background: transparent; color: inherit; }
.rich-editor table { width: 100%; margin: 8px 0; border-collapse: collapse; table-layout: fixed; }
.rich-editor th, .rich-editor td { min-width: 48px; padding: 6px 8px; border: 1px solid #c9dbef; vertical-align: top; }
.rich-editor th { background: #f1f7ff; }
.rich-editor img { max-width: 100%; height: auto; margin: 6px 0; border-radius: 7px; }
.rich-editor hr { margin: 12px 0; border: 0; border-top: 1px dashed #c5d7ea; }

.match-editor { display: grid; gap: 8px; margin-bottom: 8px; }
.match-edit-row { display: grid; grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr) 28px; align-items: center; gap: 6px; }
.match-edit-arrow { color: var(--muted-2); text-align: center; }
.match-edit-row .q-mini { justify-self: end; }

.appeal-answer {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 9px;
  background: #fff;
  border: 1px solid var(--line-soft);
}

.appeal-answer span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted-2);
  font-size: 10.5px;
}

.appeal-answer p {
  margin: 0;
  color: #35506f;
  font-size: 12.5px;
  line-height: 1.75;
  white-space: pre-wrap;
}
.appeal-admin .reply-box { display: grid; grid-template-columns: 100px 1fr auto auto; gap: 8px; margin-top: 12px; align-items: center; }
.appeal-admin .input { min-height: 36px; font-size: 12.5px; }

/* ---------- 底栏 ---------- */
.editor-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(10px);
}

.save-state { flex: 1; color: var(--muted); font-size: 11.5px; }
.save-state.is-dirty { color: var(--warning); }
.save-state.is-saved { color: var(--success); }

/* ---------- 权限 / 空态 ---------- */
.setting-gate {
  max-width: 560px;
  margin: 40px auto;
  padding: 44px;
  border-radius: 24px;
  background: #fff;
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow);
  text-align: center;
}

.setting-gate .empty-icon { margin-inline: auto; }
.setting-gate h1 { margin-top: 14px; font-size: 23px; }
.setting-gate p { margin-top: 8px; color: var(--muted); font-size: 13.5px; line-height: 1.8; }
.setting-gate .row { justify-content: center; margin-top: 20px; }

@media (max-width: 980px) {
  .setting-layout { grid-template-columns: 1fr; }
  .exam-side { position: static; }
  .exam-side-list { max-height: 220px; }
  .form-grid { grid-template-columns: 1fr; }
  .q-row { grid-template-columns: 1fr; }
  .appeal-admin .reply-box { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .setting-main { padding-top: 88px; }
  .setting-header { flex-direction: column; align-items: flex-start; }
  .editor-body { padding: 18px; }
  .editor-foot { padding: 12px 14px; }
  .editor-foot .btn { padding: 0 14px; }
  .editor-tabs { padding-inline: 6px; }
  .setting-gate { padding: 28px 22px; }
}
