/* 后台管理样式 */
:root {
  --primary: #1d4ed8; --primary-dark: #1e40af; --accent: #0ea5e9;
  --bg: #f1f5f9; --panel: #ffffff; --text: #1e293b; --muted: #64748b;
  --border: #e2e8f0; --radius: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--text); font-size: 14px; }
a { text-decoration: none; color: inherit; }
.admin-body { display: flex; min-height: 100vh; background: var(--bg); }

/* 侧栏 */
.side { width: 220px; background: #0f172a; color: #94a3b8; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0; }
.side-logo { color: #fff; font-weight: 700; font-size: 16px; padding: 20px 18px; border-bottom: 1px solid #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.side-nav a { display: block; padding: 10px 12px; border-radius: 8px; margin-bottom: 2px; font-size: 14px; transition: .15s; }
.side-nav a:hover { background: #1e293b; color: #fff; }
.side-nav a.active { background: var(--primary); color: #fff; }
.side-foot { padding: 14px 18px; border-top: 1px solid #1e293b; }
.side-foot a { display: block; padding: 6px 0; font-size: 13px; }
.side-foot a:hover { color: #fff; }

/* 主区 */
.main { flex: 1; padding: 24px 28px; min-width: 0; }
.main-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.main-head h1 { font-size: 22px; }
.head-user { color: var(--muted); font-size: 13px; }

.flashes { margin-bottom: 16px; }
.flash { padding: 11px 16px; border-radius: 10px; margin-bottom: 8px; font-size: 14px; }
.flash-success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.flash-danger { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.flash-warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

/* 面板 */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 20px; }
.panel h2 { font-size: 16px; margin-bottom: 12px; }
.panel-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

/* 仪表盘 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(122px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-box { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; }
.stat-box b { display: block; font-size: 26px; color: var(--primary); }
.stat-box span { color: var(--muted); font-size: 12px; }
.stat-box.hl b { color: #0ea5e9; }
.stat-box.warn b { color: #e11d48; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.list-row .right { margin-left: auto; flex-shrink: 0; }
.more { display: inline-block; margin-top: 10px; color: var(--primary); font-size: 13px; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 18px; }
.form-grid .wide { grid-column: span 2; }
.inline-title { border-top: 1px dashed var(--border); padding-top: 12px; margin-top: 4px; }
.form-field { margin-bottom: 14px; }
.form-field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: #334155; }
.form-field em { color: #e11d48; }
.form-field input, .form-field textarea, .form-field select {
  width: 100%; border: 1px solid var(--border); border-radius: 9px; padding: 9px 12px;
  font-size: 14px; font-family: inherit; background: #f8fafc; transition: .15s;
}
.form-field input:focus, .form-field textarea:focus, .form-field select:focus {
  outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(29, 78, 216, .1);
}
.form-field textarea.code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.inline-select { display: flex; gap: 8px; }
.check-line { display: inline-flex; align-items: center; gap: 6px; margin: 4px 18px 14px 0; font-size: 14px; cursor: pointer; }
.faq-edit { border: 1px dashed var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }

/* 按钮 */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 20px; border-radius: 9px; border: 1px solid transparent; font-size: 14px; cursor: pointer; transition: .15s; font-weight: 500; font-family: inherit; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; }
.btn-primary:hover { opacity: .92; }
.btn-ghost { border-color: var(--border); background: #fff; color: var(--text); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-block { width: 100%; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; padding: 10px 12px; background: #f8fafc; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:hover td { background: #fafcff; }
.row-unread td { background: #fffbeb; }
.ops { display: flex; gap: 4px; align-items: center; }
.ops form { display: inline; }
.link { color: var(--primary); background: none; border: none; cursor: pointer; font-size: 13px; padding: 0; font-family: inherit; }
.link:hover { text-decoration: underline; }
.link.danger { color: #e11d48; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.tag-pub { background: #ecfdf5; color: #059669; }
.tag-draft { background: #f1f5f9; color: var(--muted); }
.tag-imp { background: #fff7ed; color: #c2410c; }
.ok { color: #059669; font-weight: 600; }
.err { color: #e11d48; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 工具栏与分页 */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.tabs { display: flex; gap: 6px; background: #fff; border: 1px solid var(--border); border-radius: 9px; padding: 4px; }
.tabs a { padding: 6px 16px; border-radius: 7px; font-size: 13px; color: var(--muted); }
.tabs a.active { background: var(--primary); color: #fff; }
.pager { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.pager a { padding: 5px 12px; border: 1px solid var(--border); border-radius: 7px; font-size: 13px; background: #fff; }
.pager a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 检测评分 */
.score-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.score { font-size: 32px; font-weight: 800; }
.score span { font-size: 14px; color: var(--muted); font-weight: 500; }
.score-good { color: #059669; }
.score-mid { color: #d97706; }
.score-bad { color: #e11d48; }

/* 登录页 */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #0f172a, #1e3a8a); }
.login-card { background: #fff; border-radius: 16px; padding: 38px 36px; width: min(380px, 92%); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.login-card h1 { font-size: 20px; text-align: center; color: var(--primary); }
.login-sub { text-align: center; color: var(--muted); margin: 8px 0 20px; font-size: 13px; }
.login-card .flash { margin-bottom: 12px; }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .panel-row { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: span 1; }
  .side { width: 64px; }
  .side-logo { font-size: 12px; padding: 20px 8px; }
  .side-nav a { font-size: 12px; padding: 10px 6px; text-align: center; }
  .side-foot a { font-size: 11px; }
}

/* ============ 富文本编辑器 ============ */
.rte { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
.rte-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 7px 9px; border-bottom: 1px solid var(--border); background: #f8fafc; }
.rte-bar-sub { border-bottom: 0; background: #fff; font-size: 13px; }
.rte-btn { border: 1px solid transparent; background: none; border-radius: 7px; padding: 5px 10px; cursor: pointer; font-size: 13px; color: #334155; font-family: inherit; line-height: 1.2; }
.rte-btn:hover { background: #e2e8f0; border-color: #cbd5e1; }
.rte-sep { width: 1px; height: 18px; background: #e2e8f0; margin: 0 5px; }
.rte-area { min-height: 420px; max-height: 70vh; overflow-y: auto; padding: 18px 22px; outline: none; line-height: 1.85; font-size: 15px; }
.rte-area:empty::before { content: attr(data-placeholder); color: #94a3b8; }
.rte-area p { margin: 0 0 10px; }
.rte-area h2 { font-size: 22px; margin: 22px 0 10px; border-left: 4px solid var(--primary); padding-left: 10px; }
.rte-area h3 { font-size: 17px; margin: 16px 0 8px; }
.rte-area ul, .rte-area ol { margin: 0 0 12px; padding-left: 26px; }
.rte-area table { width: 100%; border-collapse: collapse; margin: 10px 0 14px; }
.rte-area th, .rte-area td { border: 1px solid #cbd5e1; padding: 7px 10px; }
.rte-area th { background: #f1f5f9; font-weight: 600; }
.rte-area blockquote { margin: 10px 0; padding: 6px 14px; border-left: 4px solid #cbd5e1; color: #475569; background: #f8fafc; }
.rte-area a { color: var(--primary); text-decoration: underline; }
.rte-area img { max-width: 100%; }
.btn-xs { padding: 4px 12px; font-size: 12px; border-radius: 7px; }
textarea.code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }

/* ============ 排名徽章 / 进度 ============ */
.rank-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.rank-top { background: #ecfdf5; color: #059669; }
.rank-out { background: #fff7ed; color: #c2410c; }
.rank-none { background: #f1f5f9; color: var(--muted); }
.stat-mini { display: flex; gap: 18px; color: var(--muted); font-size: 13px; }
.stat-mini b { font-size: 18px; color: var(--primary); }
.stat-mini b.c-ok { color: #059669; }
.c-ok { color: #059669; }
.c-warn { color: #d97706; }
.run-progress .bar { width: 110px; height: 5px; background: #e2e8f0; border-radius: 99px; margin: 4px 0; overflow: hidden; }
.run-progress .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 99px; }
.manual-box .manual-pop { position: absolute; right: 0; top: 24px; z-index: 40; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.14); width: 230px; display: none; }
.manual-box[open] .manual-pop { display: block; }
.manual-pop input { width: 100%; border: 1px solid var(--border); border-radius: 7px; padding: 6px 9px; margin: 4px 0 10px; font-size: 13px; }
.manual-pop label { display: block; }

/* ============ GEO 收录卡片 ============ */
.geo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.geo-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: #fcfdff; }
.geo-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.geo-card-head b { font-size: 14px; }
.geo-num { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.evi { background: #f8fafc; border: 1px dashed var(--border); border-left: 3px solid var(--accent); border-radius: 8px; padding: 8px 12px; margin: 8px 0 0; color: #475569; white-space: pre-wrap; word-break: break-all; }
.evi-pop { white-space: pre-wrap; word-break: break-word; }
