/* InnerLens 管理后台样式（独立子域，不依赖主站 CSS） */
:root {
  --primary: #3d5a9c;
  --primary-dark: #2c4276;
  --primary-light: #edf1fa;
  --ink: #2f3542;
  --ink-2: #555e70;
  --ink-3: #8b93a3;
  --line: #e4e0d6;
  --bg: #faf8f3;
  --bg-soft: #f4f1e9;
  --paper: #fffdf9;
  --ok: #2e9e78;
  --warn: #d9a13b;
  --danger: #c9535c;
  --radius: 14px;
  --shadow: 0 4px 24px rgba(60, 50, 30, .06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background-color: var(--bg);
  background-image:
    radial-gradient(rgba(120, 110, 90, .10) 1px, transparent 1px),
    repeating-linear-gradient(45deg, rgba(120, 110, 90, .022) 0 2px, transparent 2px 6px);
  background-size: 22px 22px, auto;
  line-height: 1.6; -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
[hidden] { display: none !important; }

/* ---------- 头部 ---------- */
.adm-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250, 248, 243, .92);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.adm-header-inner {
  max-width: 1180px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 14px;
}
.adm-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; color: var(--ink); }
.adm-brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: var(--primary); display: grid; place-items: center; color: #fff;
}
.adm-brand small { font-weight: 500; font-size: 12px; color: var(--ink-3); margin-left: 2px; }
.adm-badge {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  background: #f3ece0; color: #8a6d3b; border: 1px solid #e8dcc6;
  padding: 2px 8px; border-radius: 6px;
}
.adm-spacer { flex: 1; }
.adm-who { font-size: 12.5px; color: var(--ink-3); }

/* ---------- 布局 ---------- */
.adm-main { max-width: 1180px; margin: 0 auto; padding: 26px 24px 60px; }

/* ---------- 登录 ---------- */
.adm-login-wrap { min-height: calc(100vh - 120px); display: grid; place-items: center; }
.adm-login {
  width: 100%; max-width: 380px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); padding: 32px 28px;
}
.adm-login h1 { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.adm-login p.sub { font-size: 13px; color: var(--ink-3); margin-bottom: 22px; }
.adm-field { margin-bottom: 14px; }
.adm-field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.adm-field input, .adm-field select, .adm-field textarea {
  width: 100%; padding: 11px 13px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  color: var(--ink); outline: none; transition: border-color .2s, background .2s;
}
.adm-field input:focus, .adm-field textarea:focus { border-color: var(--primary); background: var(--paper); }
.adm-err {
  font-size: 12.5px; color: #b23a45; background: #fbeeee;
  border: 1px solid #f0d3d6; border-radius: 9px; padding: 9px 12px; margin-bottom: 12px;
}
.adm-hint { font-size: 11.5px; color: var(--ink-3); margin-top: 14px; line-height: 1.7; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 9px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent; transition: all .18s; font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 5px 14px rgba(61, 90, 156, .22); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: var(--paper); color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { border-color: #cfd4de; color: var(--ink); }
.btn-danger { background: #fdf3f4; color: #b23a45; border-color: #f0d3d6; }
.btn-danger:hover { background: #fbe9ec; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; padding: 12px; font-size: 14.5px; }
.btn.is-busy::before {
  content: ''; width: 12px; height: 12px; border-radius: 50%; display: inline-block;
  border: 2px solid currentColor; border-top-color: transparent; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 标签页 ---------- */
.adm-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; }
.adm-tab {
  padding: 8px 16px; border-radius: 9px; font-size: 13.5px; font-weight: 600;
  color: var(--ink-2); background: transparent; border: 1px solid transparent;
  cursor: pointer; transition: all .18s;
}
.adm-tab:hover { background: var(--bg-soft); }
.adm-tab.active { background: var(--paper); color: var(--primary); border-color: var(--line); box-shadow: var(--shadow); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card-title::before { content: ''; width: 3px; height: 14px; background: var(--primary); border-radius: 2px; }
.card-note { font-size: 12px; color: var(--ink-3); margin-top: 10px; line-height: 1.7; }

/* ---------- 统计卡 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.stat-label { font-size: 11.5px; color: var(--ink-3); margin-bottom: 6px; letter-spacing: .02em; }
.stat-value { font-size: 26px; font-weight: 800; line-height: 1.15; }
.stat-sub { font-size: 11px; color: var(--ink-3); margin-top: 4px; }

/* ---------- 表格 ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-weight: 600; font-size: 11.5px; color: var(--ink-3);
  padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
  letter-spacing: .03em;
}
table.tbl td { padding: 11px 10px; border-bottom: 1px solid #f0ece2; vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr:hover td { background: #fdfbf6; }
.mono { font-variant-numeric: tabular-nums; }
.dim { color: var(--ink-3); }
.nowrap { white-space: nowrap; }

.tag {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 6px; border: 1px solid transparent; white-space: nowrap;
}
.tag-ok { background: #eaf6f1; color: #23785c; border-color: #cfeade; }
.tag-ban { background: #fdeef0; color: #b23a45; border-color: #f4d7db; }
.tag-tone-normal { background: #eaf6f1; color: #23785c; }
.tag-tone-mild { background: #fdf6e7; color: #8a6d3b; }
.tag-tone-moderate { background: #fdf0e7; color: #a45a28; }
.tag-tone-severe, .tag-tone-critical { background: #fdeef0; color: #b23a45; }

/* ---------- 工具条 ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.search-input {
  width: 100%; max-width: 300px; padding: 9px 12px; font-size: 13px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--ink); outline: none;
}
.search-input:focus { border-color: var(--primary); background: var(--paper); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 16px; font-size: 12.5px; color: var(--ink-3); }

/* ---------- 图表 ---------- */
.chart-svg { width: 100%; height: auto; display: block; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 46px; gap: 10px; align-items: center; font-size: 12.5px; margin-bottom: 9px; }
.bar-name { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 9px; background: #f0ece2; border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 6px; }
.bar-val { text-align: right; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 200; background: rgba(47, 53, 66, .34);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 20px; overflow-y: auto;
}
.modal {
  width: 100%; max-width: 560px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 24px 60px rgba(40, 35, 25, .18); padding: 24px;
}
.modal.wide { max-width: 760px; }
.modal h2 { font-size: 17px; font-weight: 800; margin-bottom: 4px; }
.modal .sub { font-size: 12.5px; color: var(--ink-3); margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* 结果内容块 */
.reveal-box { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-top: 12px; font-size: 13.5px; line-height: 1.85; }
.reveal-box h4 { font-size: 12px; color: var(--ink-3); font-weight: 700; margin-bottom: 6px; letter-spacing: .04em; }
.reveal-warn { font-size: 11.5px; color: #a45a28; background: #fdf2e7; border: 1px solid #f3e0cc; border-radius: 8px; padding: 8px 11px; margin-top: 12px; }

/* ---------- 加载遮罩 ---------- */
.page-loader {
  position: fixed; inset: 0; z-index: 300; background: rgba(250, 248, 243, .76);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: opacity .18s, visibility .18s;
}
.page-loader.pl-visible, html.is-loading .page-loader { opacity: 1; visibility: visible; }
.pl-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; overflow: hidden; }
.pl-bar::before {
  content: ''; position: absolute; top: 0; height: 100%; width: 42%;
  background: linear-gradient(90deg, rgba(61,90,156,0), var(--primary) 45%, rgba(61,90,156,0));
  animation: slide 1.15s cubic-bezier(.42,0,.2,1) infinite;
}
@keyframes slide { 0% { left: -42%; } 100% { left: 100%; } }
.pl-box { display: flex; align-items: center; gap: 13px; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 13px 24px 13px 16px; box-shadow: var(--shadow); }
.pl-ring {
  width: 21px; height: 21px; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(61,90,156,.14) 0deg, var(--primary) 310deg, rgba(61,90,156,.14) 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  animation: spin .85s linear infinite;
}
.pl-text { font-size: 14px; color: var(--ink-2); }

.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); font-size: 13px; }

@media (max-width: 640px) {
  .adm-main { padding: 18px 14px 50px; }
  .bar-row { grid-template-columns: 90px 1fr 40px; }
  .stat-value { font-size: 22px; }
}
