/* 后台样式：在 app.css 变量基础上扩展 */
body.admin { background: #f3f3f3; }

.admin-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 216px; flex: 0 0 216px; background: #0b1220; color: #cbd5e1;
    display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh;
}
.sidebar .logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.sidebar .logo span.mark {
    width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
    background: #fff; color: #fff; font-weight: 700; font-size: 15px; padding: 3px; overflow: hidden;
}
.sidebar .logo span.mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sidebar .logo b { color: #fff; font-size: 14px; letter-spacing: .2px; }
.sidebar .logo small { display: block; color: #929292; font-size: 11px; }

.side-nav { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.side-nav a {
    display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 9px;
    color: #94a3b8; font-size: 13.5px;
}
.side-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.side-nav a.is-active { background: #1f2937; color: #fff; font-weight: 600; }
.side-nav .sep { height: 1px; background: rgba(255, 255, 255, .1); margin: 10px 4px; }
.sidebar-foot { margin-top: auto; font-size: 11.5px; color: #828282; padding: 10px 10px 0; line-height: 1.7; }
.sidebar-foot a { color: #94a3b8; }

.admin-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.admin-top {
    display: flex; align-items: center; gap: 14px; padding: 14px 26px;
    background: #fff; border-bottom: 1px solid var(--line);
}
.admin-top h1 { font-size: 17px; }
.admin-top .spacer { flex: 1 1 auto; }
.admin-top .who { font-size: 12.8px; color: var(--muted); }
.admin-top .btn { height: 32px; }

.admin-body { padding: 22px 26px 40px; }

.panel {
    background: #fff; border: 1px solid var(--line); border-radius: 14px;
    box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px;
}
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { font-size: 15.5px; }
.panel-head .spacer { flex: 1 1 auto; }
.panel-sub { color: var(--muted); font-size: 12.5px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat-box { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat-box b { display: block; font-size: 22px; line-height: 1.25; color: var(--ink); }
.stat-box span { font-size: 12.5px; color: var(--muted); }
.stat-box.accent { background: linear-gradient(135deg, #1f2937, #111827); border-color: transparent; }
.stat-box.accent b, .stat-box.accent span { color: #fff; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 36px; padding: 0 16px; border-radius: 9px; border: 1px solid var(--line);
    background: #fff; color: var(--ink-2); font-size: 13.5px; cursor: pointer; font-family: inherit;
    transition: all .16s; text-decoration: none;
}
.btn:hover { border-color: #cbd5e1; color: var(--brand-dark); background: #fafafa; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-danger { color: #b3392b; border-color: #f0d3cf; }
.btn-danger:hover { background: #fdf0ef; border-color: #e6bdb7; color: #97281c; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }

.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.8px; color: var(--ink-2); font-weight: 600; }
.field .hint { font-size: 11.8px; color: var(--muted); }
.field input[type=text], .field input[type=password], .field input[type=number], .field input[type=file],
.field select, .field textarea {
    width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
    font-size: 14px; font-family: inherit; color: var(--ink); background: #fff; outline: none;
    transition: border-color .16s, box-shadow .16s;
}
.field textarea { min-height: 120px; line-height: 1.7; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
    border-color: #94a3b8; box-shadow: 0 0 0 4px rgba(31,41,55, .08);
}
.field.row-inline { flex-direction: row; align-items: center; gap: 10px; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { text-align: left; padding: 10px 10px; border-bottom: 1px solid #f2f2f2; vertical-align: top; }
.table th { font-size: 12.5px; color: var(--muted); font-weight: 600; background: #fafafa; }
.table tr:hover td { background: #fafafa; }
.table .q { color: var(--ink); font-weight: 500; }
.table .q:hover { color: var(--brand-dark); }
.table .actions { display: flex; gap: 6px; flex-wrap: wrap; }
/* 蒸馏操作区：主操作左对齐成一行，搜索靠右，窄屏自动换行 */
.distill-actions { display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; padding:4px 0 14px; }
.distill-actions-main { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.distill-actions form { display:inline-flex; margin:0; }
.distill-search { display:inline-flex; align-items:center; gap:6px; }
.distill-search input[type="text"] {
  width:180px; height:32px; padding:0 10px; border:1px solid #dfe3ee;
  border-radius:7px; font-size:13px; color:var(--ink); outline:none; transition:border-color .15s,box-shadow .15s;
}
.distill-search input[type="text"]:focus { border-color:#9aa8d8; box-shadow:0 0 0 3px rgba(90,110,190,.10); }
@media(max-width:760px){
  .distill-actions { align-items:stretch; }
  .distill-search { width:100%; }
  .distill-search input[type="text"] { flex:1; width:auto; }
}
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 7px; font-size: 11.5px; font-weight: 600; }
.badge-ok { background: var(--brand-soft); color: var(--brand-dark); }
.badge-draft { background: #f2f0ea; color: #8a6d34; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type=text], .toolbar select {
    height: 34px; border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; font-size: 13.5px;
    font-family: inherit; background: #fff; outline: none;
}
.toolbar input[type=text] { min-width: 220px; }

/* 问答管理：多选批量操作栏 */
.bulk-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 14px;
  background: #f8f9fb; border: 1px solid var(--line); border-radius: 11px;
}
.bulk-count { font-size: 12.8px; color: var(--muted); min-width: 62px; white-space: nowrap; }
.bulk-count.has { color: var(--brand-dark); font-weight: 700; }
.bulk-sep { width: 1px; height: 20px; background: var(--line); margin: 0 3px; }
.bulk-move { display: inline-flex; align-items: center; gap: 6px; }
.bulk-select {
  height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink-2); font-size: 12.5px; font-family: inherit; outline: none;
}
.bulk-inline-label { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.bulk-num {
  width: 62px; height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); font-size: 12.5px; font-family: inherit; outline: none;
}
.bulk-num:focus { border-color: #94a3b8; box-shadow: 0 0 0 3px rgba(31,41,55,.08); }
.table input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; vertical-align: middle; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(700px 300px at 50% 0%, #eef1f4, #f6f6f6); }
.login-card {
    width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line);
    border-radius: 18px; padding: 32px 30px; box-shadow: 0 24px 60px rgba(11,18,32, .1);
}
.login-card .mark {
    width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
    background: #fff; color: #fff; font-weight: 700; font-size: 20px; padding: 4px; overflow: hidden;
    margin-bottom: 14px; margin-left: auto;margin-right: auto;
}
.login-card .mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 44px !important; }
.password-toggle {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 30px; height: 30px; border: 0; border-radius: 8px;
    background: transparent; color: var(--muted); cursor: pointer;
    display: grid; place-items: center; padding: 0;
}
.password-toggle:hover { background: #f3f4f6; color: var(--ink); }
.password-toggle svg { width: 17px; height: 17px; display: block; }
.password-toggle .hidden { display: none; }
.login-card h1 { font-size: 19px;text-align: center; }
.login-card p.sub { color: var(--muted); font-size: 13px; margin: 6px 0 22px; text-align: center;}
.login-card .btn-primary { width: 100%; height: 40px; margin-top: 6px; }
.login-tip { margin-top: 18px; font-size: 12px; color: var(--muted); line-height: 1.8; }

.notice { padding: 11px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; border: 1px solid #f3e2c4; background: #fdf7ea; color: #8a5a12; }
.notice-ok { border-color: #cbd5e1; background: var(--brand-soft); color: var(--brand-dark); }
.notice-err { border-color: #f3d2ce; background: #fdf0ef; color: #b3392b; }

.cat-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.cat-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; }
.cat-item b { font-size: 14px; }
.cat-item .meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.cat-item .ops { margin-top: 8px; }

.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }

.progress { font-size: 12.5px; color: var(--muted); }

@media (max-width: 980px) {
    .admin-shell { flex-direction: column; }
    .sidebar { width: 100%; flex-basis: auto; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; }
    .side-nav { flex-direction: row; flex-wrap: wrap; margin-top: 0; }
    .sidebar-foot { display: none; }
    .detail-grid { grid-template-columns: 1fr; }
    .form-grid.two { grid-template-columns: 1fr; }
    .admin-body { padding: 16px 14px 32px; }
    .admin-top { padding: 12px 14px; flex-wrap: wrap; }
}

/* ---------- 导入记录明细页 ---------- */
.badge-warn { background: #fdf3e3; color: #8a5a12; }
.badge-muted { background: #f1f2f4; color: #5a626d; }

.kv-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px 22px; margin-top: 4px;
}
.kv-grid > div { display: flex; flex-direction: column; gap: 4px; }
.kv-grid span { font-size: 12.2px; color: var(--muted); }
.kv-grid b { font-size: 14px; color: var(--ink); font-weight: 600; word-break: break-all; }

.plain-list { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); line-height: 1.9; }

.btn-mini {
  display: inline-flex; align-items: center; justify-content: center;
  height: 26px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: 12.2px; text-decoration: none;
}
.btn-mini:hover { border-color: #cbd5e1; color: var(--brand-dark); background: #fafafa; }

.pager { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.pager-item {
  min-width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  color: var(--ink-2); font-size: 12.5px; text-decoration: none; padding: 0 8px;
}
.pager-item:hover { border-color: #cbd5e1; color: var(--brand-dark); }
.pager-item.is-active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

/* 语义成功色保留：主色转黑后仍保持可辨识 */
.badge-ok { background: #e7f6ee; color: #0a7a45; }
.notice-ok { border-color: #cfe9db; background: #e7f6ee; color: #0a7a45; }
