/* Qinglin Server 后台 — 依据 Claude Design「后台管理系统」:cyan 主色 + Manrope/Noto Serif 字体 + 卡片化层级 */
:root {
  --bg: #f7f8f6;
  --surface: #ffffff;
  --sidebar: #fbfbf9;
  --sunken: #f4f5f2;
  --border: #e7eae6;
  --border-2: #eef1ee;

  --text: #1f2926;
  --text-2: #5b645e;
  --text-3: #9aa39d;
  --text-4: #b4bcb6;

  --accent: #0e9ec4;
  --accent-deep: #0c6f97;
  --accent-soft: #e6f7fb;
  --accent-glow: #7fdcef;

  --ok: #1aa86a;        --ok-soft: #e9f6ef;
  --warn: #c08416;      --warn-soft: #fef3e0;
  --danger: #d9512f;    --danger-soft: #fdece8;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(30, 50, 40, 0.04);
  --shadow-pop: 0 0 0 1px rgba(40,55,48,0.05), 0 40px 90px rgba(30,50,40,0.18);
  --sidebar-w: 248px;
  --font: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-num: 'Manrope', var(--font);
  --font-serif: 'Noto Serif SC', serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* ---------- 布局骨架 ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

/* 品牌 */
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 6px 6px; }
.brand-mark {
  width: 38px; height: 38px; flex: none;
  border-radius: 11px; overflow: hidden; position: relative;
  background: radial-gradient(135% 150% at 76% 62%, #34c6e6 0%, #14a6cf 46%, #0c6f97 100%);
  box-shadow: 0 4px 12px rgba(14, 158, 196, 0.26);
}
.brand-mark svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.brand-mark.big { width: 52px; height: 52px; border-radius: 15px; }
.brand-title {
  font-family: var(--font-serif); font-size: 17px; font-weight: 700;
  color: var(--text); line-height: 1.2;
}
.brand-sub { font-size: 11px; color: var(--text-3); font-weight: 600; letter-spacing: 1px; margin-top: 3px; }

.brand-divider { height: 1px; background: var(--border); margin: 16px 6px; }

/* 导航分组 */
.nav { display: flex; flex-direction: column; flex: 1; }
.nav-label {
  font-family: var(--font-num);
  font-size: 10.5px; font-weight: 700; letter-spacing: 1px;
  color: var(--text-4); padding: 14px 12px 8px;
}
.nav-label:first-child { padding-top: 0; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  height: 40px; padding: 0 12px; margin-bottom: 2px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; color: var(--text-2);
  transition: background 140ms, color 140ms;
}
.nav-item svg { flex: none; }
.nav-item:hover { background: var(--sunken); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 19px; padding: 0 6px;
  border-radius: 9px; background: var(--border-2); color: var(--text-2);
  font-size: 11px; font-weight: 600; font-family: var(--font-num);
  display: flex; align-items: center; justify-content: center;
}

/* 底部用户卡 */
.user-card {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 8px; border-radius: 12px; background: var(--sunken);
  margin-top: 8px;
}
.user-avatar {
  width: 34px; height: 34px; flex: none; border-radius: 50%;
  background: linear-gradient(140deg, #1fa6cc, #0c6f97);
  color: #d2f3fb; font-size: 13px; font-weight: 600;
  display: grid; place-items: center;
}
.user-meta { min-width: 0; flex: 1; line-height: 1.3; }
.user-meta strong { font-size: 13px; font-weight: 600; color: var(--text); display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta span { font-size: 11px; color: var(--text-3); }
.user-card form { margin: 0; }
.user-card button {
  border: none; background: none; cursor: pointer; padding: 4px;
  color: var(--text-4); font-size: 12px; border-radius: 6px;
  transition: color 140ms, background 140ms;
}
.user-card button:hover { color: var(--danger); background: var(--danger-soft); }

/* ---------- 主区 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* 顶部页头(类 topbar) */
.page-head {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 28px; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.page-head .head-text { min-width: 0; }
.page-head h1 { font-size: 18px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.page-head p { margin: 2px 0 0; color: var(--text-3); font-size: 12px; }
.page-head .spacer { flex: 1; }
.back { display: inline-block; color: var(--text-3); font-size: 12.5px; margin-bottom: 6px; }
.back:hover { color: var(--accent); }

.content { padding: 24px 28px 30px; }

.flash {
  margin: 18px 28px 0;
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; border: 1px solid transparent;
}
.flash.ok { background: var(--accent-soft); color: var(--accent-deep); border-color: #c7ecf5; }
.flash.err { background: var(--danger-soft); color: var(--danger); border-color: #f6d6cd; }

/* ---------- KPI 统计卡 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.stat-grid.g3 { grid-template-columns: repeat(3, 1fr); }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
}
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { font-size: 13px; color: var(--text-2); }
.stat-icon {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
}
.stat-value {
  font-family: var(--font-num); font-size: 30px; font-weight: 800;
  letter-spacing: -0.5px; margin-top: 10px; color: var(--text);
}
.stat-value.sm { font-size: 20px; }
.stat-foot { margin-top: 8px; font-size: 12px; color: var(--text-3); }

/* ---------- 面板 / 表格 ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-top: 20px; overflow: hidden;
}
.panel-head { display: flex; align-items: center; padding: 18px 22px 12px; }
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.panel-head .muted { font-weight: 400; font-size: 12px; }
.panel-head .more { margin-left: auto; display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; color: var(--accent); font-weight: 500; }

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--text-3);
  padding: 10px 22px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.table td { padding: 13px 22px; border-bottom: 1px solid var(--border-2); font-size: 13.5px; color: var(--text-2); }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background 120ms; }
.table tbody tr:hover { background: var(--sunken); }
.table .strong { color: var(--text); font-weight: 500; }
.row-action { text-align: right; }

.link { color: var(--accent-deep); font-weight: 500; }
.link:hover { text-decoration: underline; }

.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px;
  font-size: 11.5px; font-weight: 600; border-radius: 11px;
  background: var(--accent-soft); color: var(--accent-deep);
}
.tag.muted { background: var(--sunken); color: var(--text-3); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.muted { color: var(--text-3); }

/* 置顶告警条:需要关注的账号一眼可见 */
.alert {
  display: flex; gap: 12px; align-items: flex-start;
  margin: 0 0 18px; padding: 14px 18px; border-radius: var(--radius);
  border: 1px solid var(--border-2); font-size: 13px;
}
.alert.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alert.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 26%, transparent); }
.alert-icon { font-size: 15px; line-height: 1.5; }
.alert.warn .alert-icon { color: var(--warn); }
.alert.ok .alert-icon { color: var(--ok); }
.alert-body { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.alert-body strong { font-size: 13.5px; color: var(--text); }
.alert-line { color: var(--text-2); line-height: 1.7; }
.alert-line b { color: var(--warn); font-weight: 700; font-variant-numeric: tabular-nums; }
.alert-line a { margin: 0 8px 0 2px; }

/* 各领域记录数小徽章:紧凑成排,0 记录淡出 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: baseline; gap: 4px;
  padding: 2px 9px; border-radius: 11px;
  background: var(--sunken); color: var(--text-2); font-size: 11.5px; line-height: 1.7;
}
.chip b { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.chip.zero { opacity: 0.45; }
.chip.zero b { color: var(--text-3); font-weight: 550; }

/* 各领域下钻:summary 是紧凑徽章,点开看每域最近变更时间(纯 <details>,无 JS) */
.drill > summary { cursor: pointer; list-style: none; }
.drill > summary::-webkit-details-marker { display: none; }
.drill-hint { display: inline-block; margin-top: 6px; font-size: 11px; color: var(--text-3); user-select: none; }
.drill[open] .drill-hint { color: var(--accent-deep); }
.drill[open] .drill-hint::first-letter { display: inline-block; transform: rotate(180deg); }
.mini { border-collapse: collapse; margin: 10px 0 2px; width: auto; }
.mini td { padding: 4px 16px 4px 0; border: none; font-size: 12.5px; color: var(--text-2); }
.mini td.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.mini td.ago { color: var(--text-3); }
.mini tr.dim td { color: var(--text-3); }

.stat-of { font-size: 16px; font-weight: 500; color: var(--text-3); }

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

/* ---------- 表单 ---------- */
.create-form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 4px 22px 20px; }
.create-form input[type="text"], .create-form input[type="password"] { flex: 1; min-width: 180px; }
input[type="text"], input[type="password"] {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: inherit; background: var(--surface); color: var(--text);
  transition: border-color 140ms, box-shadow 140ms;
}
input[type="text"]:focus, input[type="password"]:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); white-space: nowrap; }

.btn-primary {
  padding: 9px 20px; border: none; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff; font-size: 13.5px; font-weight: 600; cursor: pointer;
  box-shadow: 0 5px 14px rgba(14, 158, 196, 0.28);
  transition: background 140ms, transform 80ms;
}
.btn-primary:hover { background: var(--accent-deep); }
.btn-primary:active { transform: translateY(1px); }

/* ---------- 详情页 ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.detail-grid .panel { margin-top: 0; }
.kv { margin: 0; padding: 4px 22px 14px; }
.kv > div { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border-2); }
.kv > div:last-child { border-bottom: none; }
.kv dt { color: var(--text-3); font-size: 13px; margin: 0; }
.kv dd { margin: 0; font-weight: 550; font-size: 13.5px; color: var(--text); }

.inline-form { display: flex; gap: 8px; padding: 12px 22px; border-bottom: 1px solid var(--border-2); align-items: center; }
.inline-form:last-child { border-bottom: none; }
.inline-form input { flex: 1; }
.inline-form button {
  padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); font-size: 13px; font-weight: 550; cursor: pointer; color: var(--text);
  transition: background 140ms, border-color 140ms, color 140ms; white-space: nowrap;
}
.inline-form button:hover { background: var(--sunken); }
.inline-form button.ghost { width: 100%; }
.inline-form button.danger { width: 100%; color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }
.inline-form button.danger:hover { background: var(--danger); color: #fff; }

.preview {
  margin: 0; padding: 18px 22px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px; line-height: 1.6; color: var(--text-2);
  white-space: pre-wrap; word-break: break-all; max-height: 420px; overflow: auto;
}

.sync-cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  padding: 4px 22px 18px;
}
.sync-card {
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  padding: 14px; background: var(--sunken);
}
.sync-card strong { display: block; margin-top: 10px; font-size: 14px; }
.sync-card p { margin: 4px 0 0; color: var(--text-2); font-size: 12.5px; }
.audit-list {
  margin: 0; padding: 0 22px 16px 40px; color: var(--warn); font-size: 12.5px;
}
.field-list {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 0 22px 18px; font-size: 12.5px;
}
.field-list code {
  background: var(--sunken); border: 1px solid var(--border-2);
  border-radius: 7px; padding: 3px 7px; color: var(--text-2);
}

/* ---------- 登录页 ---------- */
.login-body {
  display: grid; place-items: center; min-height: 100vh;
  background: radial-gradient(120% 120% at 80% 10%, #e6f7fb 0%, #f7f8f6 45%);
}
.login-card {
  width: 360px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow-pop); padding: 34px 32px;
}
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 22px; }
.login-brand .brand-title { font-size: 19px; margin-top: 12px; letter-spacing: 1px; }
.login-brand .brand-sub { letter-spacing: 0.5px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.login-card .btn-primary { margin-top: 4px; padding: 12px; }

@media (max-width: 760px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .sync-cards { grid-template-columns: 1fr; }
  .content { padding: 20px 16px; }
  .sidebar { display: none; }
}

/* ---------- 分页 ---------- */
.pagenav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 14px 18px; border-top: 1px solid var(--border-2);
  font-size: 13px;
}
.pagenav-links { display: flex; align-items: center; gap: 10px; }
.pagenav-link {
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px;
  color: var(--accent-deep); text-decoration: none; background: var(--surface);
  transition: background-color 120ms ease, border-color 120ms ease;
}
.pagenav-link:hover { background: var(--accent-soft); border-color: var(--accent-glow); }
.pagenav-link.disabled {
  color: var(--text-4); background: var(--sunken);
  border-color: var(--border-2); cursor: default;
}
.pagenav-page { min-width: 56px; text-align: center; }

@media (max-width: 760px) {
  .pagenav { flex-direction: column; align-items: stretch; gap: 10px; }
  .pagenav-links { justify-content: space-between; }
}
