/* 齐鲁文化版图 · 语料评估 — 视觉系统
   方向：青金石 / 海岱青 — 深青墨底 + 青瓷点缀，避免紫系与奶油陶土风
*/
:root {
  --ink: #0a2229;
  --ink-2: #12343d;
  --mist: #e8eef0;
  --paper: #f7fafb;
  --line: #d3dde1;
  --jade: #1a7a6d;
  --jade-deep: #0f5c52;
  --gold: #b8923a;
  --text: #1c2b30;
  --muted: #5c6f76;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #067647;
  --shadow: 0 10px 30px rgba(10, 34, 41, 0.08);
  --radius: 10px;
  --font-display: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

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

html, body {
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(26, 122, 109, 0.12), transparent 55%),
    radial-gradient(900px 420px at 100% 0%, rgba(184, 146, 58, 0.10), transparent 50%),
    linear-gradient(180deg, #eef4f5 0%, var(--mist) 40%, #e4ecee 100%);
  line-height: 1.6;
}

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

/* ---- 顶栏 ---- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(120deg, var(--ink) 0%, var(--ink-2) 55%, #164a52 100%);
  color: #fff;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 4px 24px rgba(10, 34, 41, 0.28);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.brand .name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.brand .tagline {
  font-size: 12px;
  opacity: 0.78;
  letter-spacing: 0.08em;
}

.nav {
  display: flex;
  gap: 8px;
  align-items: center;
}
.nav a {
  color: rgba(255,255,255,0.88);
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  font-size: 13px;
}
.nav a:hover, .nav a.active {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.22);
  text-decoration: none;
}

.header-meta {
  text-align: right;
  font-size: 12px;
  opacity: 0.8;
}
.header-meta .val { font-size: 13px; opacity: 1; }

/* ---- 布局 ---- */
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 18px 48px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(211, 221, 225, 0.9);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
}
.stat .num {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  color: var(--ink);
}
.stat .label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.t1 .num { color: var(--jade); }
.stat.t2 .num { color: var(--gold); }
.stat.t3 .num { color: var(--danger); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.75);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.toolbar input[type="search"],
.toolbar input[type="text"],
.field input,
.field textarea,
.field select {
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  outline: none;
  width: 100%;
}
.toolbar input[type="search"] { width: min(320px, 100%); }
.toolbar input:focus,
.field input:focus,
.field textarea:focus { border-color: var(--jade); box-shadow: 0 0 0 3px rgba(26,122,109,0.15); }

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--jade);
  color: #fff;
  transition: background .15s, transform .1s;
}
.btn:hover { background: var(--jade-deep); }
.btn:active { transform: translateY(1px); }
.btn.ghost {
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.btn.ghost:hover { background: #fff; }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

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

/* ---- 题目折叠树 ---- */
.q-list { display: flex; flex-direction: column; gap: 10px; }

details.q {
  background: rgba(255,255,255,0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
details.q > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px 14px;
  font-weight: 600;
}
details.q > summary::-webkit-details-marker { display: none; }
details.q > summary::before {
  content: "▸";
  color: var(--muted);
  font-size: 12px;
  transition: transform .15s;
}
details.q[open] > summary::before { transform: rotate(90deg); }
details.q[open] > summary {
  background: linear-gradient(90deg, rgba(26,122,109,0.08), transparent);
  border-bottom: 1px solid var(--line);
}

.qid {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--ink);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}
.dim {
  background: rgba(184, 146, 58, 0.15);
  color: #7a5c14;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}
.qtext { font-weight: 500; color: var(--text); flex: 1; min-width: 200px; }

.qbody { padding: 10px 14px 16px; }
.sec, .sub, .tagsec, .ans, .scoresec {
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.sec > summary, .sub > summary, .tagsec > summary, .ans > summary, .scoresec > summary {
  cursor: pointer;
  list-style: none;
  padding: 9px 12px;
  font-weight: 600;
  display: flex;
  gap: 8px;
  align-items: center;
}
.sec > summary::-webkit-details-marker,
.sub > summary::-webkit-details-marker,
.tagsec > summary::-webkit-details-marker,
.ans > summary::-webkit-details-marker,
.scoresec > summary::-webkit-details-marker { display: none; }
.sec > summary { color: var(--ink-2); font-size: 14px; }
.sub > summary { color: #2f4f57; font-size: 13px; }
.tagsec > summary { color: var(--jade-deep); font-size: 13px; }
.ans > summary { color: #6b3f1a; font-size: 13px; }
.scoresec > summary { color: #6b3f1a; background: #fff8ef; font-size: 13px; }
details[open].scoresec > summary { background: #ffefd9; }
.cnt { color: var(--muted); font-weight: 400; font-size: 12px; }
.sub-score { color: var(--muted); font-weight: 400; font-size: 12px; }

.blk { padding: 8px 12px 12px; }
.blk h4, .ans-block h4 { margin: 8px 0 4px; font-size: 13px; color: #334155; }
.raw {
  white-space: pre-wrap;
  background: var(--paper);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  border-left: 3px solid #7eb8ae;
}
.crit { padding-left: 18px; font-size: 13px; }
.crit li { margin: 4px 0; }
.badge {
  display: inline-block;
  background: rgba(26,122,109,0.12);
  color: var(--jade-deep);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
table.rules, table.score-tbl {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  margin: 6px 0;
}
table.rules th, table.rules td,
table.score-tbl th, table.score-tbl td {
  border: 1px solid var(--line);
  padding: 6px 9px;
  text-align: left;
  vertical-align: top;
}
table.rules th, table.score-tbl th { background: #f0f5f6; font-weight: 600; }
table.score-tbl td.left { max-width: 380px; }
.ans-block { padding: 8px 12px; }
.ans-theme { font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.ans-body {
  white-space: pre-wrap;
  background: var(--paper);
  padding: 10px 12px;
  border-radius: 6px;
  border-left: 3px solid #5aa99c;
  font-size: 13px;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 22px 0 8px;
  align-items: center;
}
.page-info { font-size: 13px; color: var(--muted); }

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

/* ---- 管理页 ---- */
body.admin-page {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.admin-page .app-header { flex-shrink: 0; }

.admin-shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 0;
  max-width: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.admin-side {
  background: rgba(255,255,255,0.92);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.admin-side-top {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.admin-side-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.admin-side-title h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
}
.chip {
  font-size: 11px;
  background: rgba(26,122,109,0.12);
  color: var(--jade-deep);
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.admin-search input {
  width: 100%;
  font: inherit;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.admin-search input:focus {
  outline: none;
  border-color: var(--jade);
  box-shadow: 0 0 0 3px rgba(26,122,109,0.12);
}
.dim-filter {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.dim-chip {
  flex: 0 0 auto;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.dim-chip:hover { border-color: var(--jade); color: var(--jade-deep); }
.dim-chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.admin-side-list {
  flex: 1;
  overflow: auto;
  padding: 8px;
}

.q-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  margin-bottom: 4px;
  transition: background .12s, border-color .12s;
}
.q-item:hover { background: rgba(26,122,109,0.06); }
.q-item.active {
  background: rgba(26,122,109,0.12);
  border-color: rgba(26,122,109,0.28);
}
.q-item-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.q-item-dim {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.q-item .title {
  font-size: 13px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.admin-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(800px 300px at 80% 0%, rgba(26,122,109,0.06), transparent 60%),
    rgba(247,250,251,0.9);
}
.admin-main-empty {
  margin: auto;
  text-align: center;
  max-width: 360px;
  padding: 40px 20px;
  color: var(--muted);
}
.empty-illu {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--jade-deep);
  background: linear-gradient(145deg, rgba(26,122,109,0.15), rgba(184,146,58,0.12));
}
.admin-main-empty h3 {
  font-family: var(--font-display);
  color: var(--ink);
  font-size: 18px;
  margin-bottom: 8px;
}
.admin-main-empty p { font-size: 13px; line-height: 1.6; }

.admin-main-work {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 18px;
  background: rgba(255,255,255,0.92);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.admin-toolbar-left, .admin-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.dirty-badge {
  font-size: 11px;
  font-weight: 600;
  color: #9a3412;
  background: #ffedd5;
  padding: 2px 8px;
  border-radius: 999px;
}
.admin-toolbar kbd {
  font-size: 10px;
  opacity: .75;
  margin-left: 4px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 3px;
  padding: 0 4px;
}
.admin-question-preview {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  background: rgba(255,255,255,0.7);
  border-bottom: 1px solid var(--line);
  line-height: 1.5;
}

.admin-tabs {
  display: flex;
  gap: 2px;
  padding: 0 18px;
  background: rgba(255,255,255,0.85);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  overflow-x: auto;
}
.admin-tab {
  appearance: none;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.admin-tab:hover { color: var(--ink); }
.admin-tab.active {
  color: var(--jade-deep);
  border-bottom-color: var(--jade);
}

.admin-tab-panels {
  flex: 1;
  overflow: auto;
  padding: 16px 18px 32px;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .18s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.panel-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.panel-card-head { margin-bottom: 14px; }
.panel-card-head.row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.panel-card-head h3 {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 4px;
}
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
}
.field textarea { min-height: 96px; resize: vertical; }

.criteria-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.sum-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}
.sum-item.accent {
  border-color: rgba(26,122,109,0.35);
  background: linear-gradient(180deg, rgba(26,122,109,0.08), #fff);
}
.sum-num {
  display: block;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
}
.sum-label { font-size: 12px; color: var(--muted); }

.criteria-list { display: flex; flex-direction: column; gap: 10px; }
.crit-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}
.crit-card.unq { background: #fffaf7; border-color: #f0dcc8; }
.crit-card-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.crit-idx {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--ink);
  color: #fff;
}
.crit-idx.warn { background: #9a3412; }
.crit-move { display: flex; flex-direction: column; gap: 2px; }
.icon-btn {
  width: 26px;
  height: 22px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}
.icon-btn:hover:not(:disabled) { border-color: var(--jade); color: var(--jade-deep); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.crit-card-body textarea {
  width: 100%;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  resize: vertical;
  background: #fff;
}
.crit-card-body textarea:focus {
  outline: none;
  border-color: var(--jade);
  box-shadow: 0 0 0 3px rgba(26,122,109,0.12);
}
.crit-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  gap: 8px;
}
.point-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.point-field input {
  width: 72px;
  font: inherit;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.danger-text { color: var(--danger) !important; }
.empty-inline {
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.rules-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.rule-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  cursor: text;
}
.rule-card .rule-key { font-weight: 600; font-size: 13px; color: var(--ink); }
.rule-card .rule-tip { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.rule-card input {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.rule-card.tone-ok { border-left: 3px solid var(--ok); }
.rule-card.tone-warn { border-left: 3px solid var(--warn); }
.rule-card.tone-danger { border-left: 3px solid var(--danger); }
.rule-card.tone-muted { border-left: 3px solid #94a3b8; }

.confirm-mask {
  position: fixed;
  inset: 0;
  background: rgba(10, 34, 41, 0.45);
  display: grid;
  place-items: center;
  z-index: 200;
  padding: 16px;
}
.confirm-mask[hidden] { display: none !important; }
.confirm-box {
  width: min(400px, 100%);
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.confirm-box h4 {
  font-family: var(--font-display);
  font-size: 17px;
  margin-bottom: 8px;
}
.confirm-box p { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #912018; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  transition: .2s;
  z-index: 100;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }
.toast.err { background: var(--danger); }

@media (max-width: 960px) {
  body.admin-page { height: auto; overflow: auto; }
  .admin-shell { grid-template-columns: 1fr; min-height: calc(100vh - 80px); }
  .admin-side { max-height: 42vh; border-right: none; border-bottom: 1px solid var(--line); }
  .rules-cards { grid-template-columns: 1fr; }
  .criteria-summary { grid-template-columns: 1fr; }
  .crit-card { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .app-header { flex-wrap: wrap; }
}
