/* 管理后台样式 */
:root {
  --brand: #6b4eff;
  --brand-dark: #5538e0;
  --brand-soft: #f0edff;
  --ok: #12a150;
  --warn: #d97706;
  --err: #dc2626;
  --text: #1f2430;
  --sub: #6b7280;
  --line: #e5e7eb;
  --bg: #f5f6fa;
  --card: #ffffff;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6;
}
[v-cloak] { display: none; }

/* 布局 */
.lx-app { display: flex; min-height: 100vh; }
.lx-side {
  width: 216px; flex: 0 0 216px; background: #1c1f2b; color: #cfd3dc;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.lx-logo {
  padding: 20px 20px 16px; font-size: 17px; font-weight: 700; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08); letter-spacing: .5px;
}
.lx-logo small { display: block; font-size: 11px; font-weight: 400; color: #8b90a0; margin-top: 2px; }
.lx-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.lx-nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 4px;
  border-radius: 8px; color: #cfd3dc; text-decoration: none; cursor: pointer; font-size: 14px;
}
.lx-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.lx-nav a.active { background: var(--brand); color: #fff; font-weight: 600; }
.lx-nav .badge {
  margin-left: auto; background: var(--err); color: #fff; border-radius: 10px;
  padding: 0 6px; font-size: 11px; line-height: 18px;
}
.lx-user { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.lx-user b { color: #fff; display: block; }
.lx-user span { color: #8b90a0; font-size: 12px; }
.lx-user button {
  margin-top: 8px; width: 100%; background: rgba(255,255,255,.08); color: #cfd3dc;
  border: 0; border-radius: 6px; padding: 6px; cursor: pointer; font-size: 12px;
}
.lx-user button:hover { background: rgba(255,255,255,.14); }

.lx-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lx-top {
  background: var(--card); border-bottom: 1px solid var(--line); padding: 14px 24px;
  display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 10;
}
.lx-top h1 { margin: 0; font-size: 18px; font-weight: 600; }
.lx-top .sp { flex: 1; }
.lx-body { padding: 20px 24px 40px; }

/* 卡片与表格 */
.card { background: var(--card); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(16,24,40,.05); }
.card h3 { margin: 0 0 14px; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card h3 .sp { flex: 1; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; }
th { background: #fafafa; font-weight: 600; color: #4b5563; white-space: nowrap; }
tbody tr:hover { background: #fafbff; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 7px; padding: 7px 14px; font-size: 13px; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: #c7ccd6; background: #fafafa; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: #fff; border-color: #fca5a5; color: var(--err); }
.btn.danger:hover { background: #fef2f2; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* 表单 */
.form-row { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.form-row label { min-width: 96px; color: #4b5563; font-size: 13px; }
input[type=text], input[type=number], input[type=date], select, textarea {
  border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; font-size: 13px;
  font-family: inherit; color: var(--text); background: #fff; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(107,78,255,.12); }
textarea { width: 100%; resize: vertical; line-height: 1.7; }
.field { flex: 1; min-width: 180px; }
.hint { color: var(--sub); font-size: 12px; }

/* 标签 */
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px;
  line-height: 20px; white-space: nowrap;
}
.tag.gray { background: #f3f4f6; color: #6b7280; }
.tag.blue { background: #eff6ff; color: #1d4ed8; }
.tag.green { background: #ecfdf5; color: #047857; }
.tag.orange { background: #fffbeb; color: #b45309; }
.tag.red { background: #fef2f2; color: #b91c1c; }
.tag.purple { background: var(--brand-soft); color: var(--brand-dark); }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--card); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(16,24,40,.05);
}
.stat .k { color: var(--sub); font-size: 12px; margin-bottom: 6px; }
.stat .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 13px; font-weight: 500; color: var(--sub); margin-left: 2px; }
.stat.ok .v { color: var(--ok); }
.stat.err .v { color: var(--err); }
.stat.brand .v { color: var(--brand); }

/* 进度条 */
.bar { height: 8px; background: #eef0f4; border-radius: 4px; overflow: hidden; min-width: 80px; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.bar.ok i { background: var(--ok); }

/* 弹窗 */
.mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 900px;
  box-shadow: 0 20px 50px rgba(0,0,0,.2); overflow: hidden;
}
.modal.wide { max-width: 1100px; }
.modal.narrow { max-width: 520px; }
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px;
}
.modal-head h3 { margin: 0; font-size: 16px; flex: 1; }
.modal-head .x { cursor: pointer; color: var(--sub); font-size: 20px; line-height: 1; padding: 2px 6px; }
.modal-head .x:hover { color: var(--text); }
.modal-body { padding: 18px 20px; max-height: calc(100vh - 220px); overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: #fafafa; }

/* Markdown 预览 */
.md-preview {
  border: 1px solid var(--line); border-radius: 8px; padding: 18px 22px; background: #fff;
  max-height: 520px; overflow-y: auto;
}
.md-preview h2 { font-size: 17px; margin: 22px 0 10px; padding-left: 10px; border-left: 3px solid var(--brand); }
.md-preview h2:first-child { margin-top: 0; }
.md-preview h3 { font-size: 15px; margin: 16px 0 8px; }
.md-preview p { margin: 8px 0; }
.md-preview ul, .md-preview ol { margin: 8px 0; padding-left: 22px; }
.md-preview li { margin: 4px 0; }
.md-preview blockquote { margin: 10px 0; padding: 8px 14px; background: #fafafa; border-left: 3px solid #d1d5db; color: #4b5563; }
.md-preview code { background: #f3f4f6; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.md-preview a { color: var(--brand); }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }

/* 题目编辑 */
.q-item { border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 12px; background: #fff; }
.q-item .q-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.q-item .q-no { font-weight: 700; color: var(--brand); }
.q-opt { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.q-opt input[type=text] { flex: 1; }
.q-opt .k { width: 26px; text-align: center; font-weight: 600; color: #4b5563; }
.q-item .ans { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.q-item .ans .chip {
  border: 1px solid var(--line); border-radius: 6px; padding: 2px 10px; cursor: pointer; font-size: 12px;
}
.q-item .ans .chip.on { background: var(--ok); border-color: var(--ok); color: #fff; }

.empty { text-align: center; padding: 36px 12px; color: var(--sub); font-size: 13px; }
.loading { text-align: center; padding: 28px; color: var(--sub); }
.timeline { border-left: 2px solid var(--line); padding-left: 14px; margin-left: 6px; }
.timeline .tl { position: relative; padding-bottom: 12px; }
.timeline .tl:before {
  content: ''; position: absolute; left: -19px; top: 6px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--brand);
}
.timeline .tl .t { font-size: 12px; color: var(--sub); }
.timeline .tl .c { font-size: 13px; }

/* toast */
.lx-toast {
  position: fixed; left: 50%; top: 24px; transform: translate(-50%, -20px); z-index: 999;
  background: #1f2937; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .25s; max-width: 80vw; box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.lx-toast.show { opacity: 1; transform: translate(-50%, 0); }
.lx-toast.ok { background: var(--ok); }
.lx-toast.err { background: var(--err); }

@media (max-width: 860px) {
  .lx-app { flex-direction: column; }
  .lx-side { width: 100%; flex: none; height: auto; position: static; }
  .lx-nav { display: flex; overflow-x: auto; padding: 8px; }
  .lx-nav a { white-space: nowrap; margin-bottom: 0; }
  .lx-user { display: none; }
  .lx-body { padding: 14px; }
  .lx-top { padding: 12px 14px; }
}
