/* 别造了管理后台 — 单一样式源。所有页面共享这里的变量与组件类。 */
:root {
  --ink: #34332f;
  --ink-soft: #514f49;
  --muted: #756f68;
  --muted-soft: #8b857c;
  --line: #dedbd2;
  --line-soft: #ece9df;
  --brand: #71875e;
  --brand-strong: #667b55;
  --brand-dark: #e6eddc;
  --canvas: #fbf8f1;
  --surface: #fffdf8;
  --tint: #edf2e6;
  --peach: #f8d7c5;
  --peach-soft: #fff0e7;
  --danger: #a14435;
  --danger-soft: #fbe4e0;
  --warn: #8a6a2f;
  --warn-soft: #fdf0dc;
  --ok: #456748;
  --shadow-card: 1px 1px 0 #ece7db;
  --radius: 14px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--canvas); color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand-strong); }
:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 2px; }
.hidden { display: none !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.nowrap { white-space: nowrap; }

/* ── 登录 ───────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(520px, 100%); padding: 34px; background: var(--surface); border: 2px solid var(--ink); border-radius: 24px; box-shadow: 7px 7px 0 #dce6d0; }
.login-brand, .brand-row { display: flex; align-items: center; gap: 16px; }
.brand-art { display: block; background: url("/admin/assets/kaifanla-brand.png") center/cover no-repeat #fffaf2; border: 2px solid var(--ink); box-shadow: 3px 3px 0 #f3cfbb; }
.login-brand .brand-art { width: 78px; height: 78px; flex: 0 0 auto; border-radius: 22px; }
.login-brand h1 { margin: 5px 0 0; font-size: 28px; }
.eyebrow { color: var(--brand-strong); font-size: 12px; font-weight: 900; letter-spacing: .09em; }
.subtle { color: var(--muted); line-height: 1.65; }
.small { font-size: 12px; }
.error { color: var(--danger); font-size: 13px; }
.success { color: var(--ok); font-size: 13px; }

/* ── 基础控件 ───────────────────────────────────────── */
.field { display: grid; gap: 7px; margin: 15px 0; }
.field > span { font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #d5d1c7; border-radius: 10px; padding: 11px 12px; background: #fff; color: var(--ink); }
.field textarea { min-height: 88px; resize: vertical; }
.field small { color: var(--muted); font-size: 11px; line-height: 1.5; }
.button { border: 0; border-radius: 10px; padding: 10px 14px; background: #edf2eb; color: #36573b; font-weight: 800; white-space: nowrap; }
.button.primary { background: var(--brand-strong); color: #fff; }
.button.ghost { background: #fff; border: 1px solid var(--line); }
.button.danger { background: #fff0ed; color: var(--danger); }
.button.tiny { padding: 5px 9px; font-size: 12px; border-radius: 8px; }
.button:disabled { cursor: not-allowed; opacity: .5; }
.switch { display: flex; align-items: flex-start; gap: 9px; margin: 15px 0; color: var(--ink-soft); font-weight: 700; line-height: 1.5; }
.switch input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--brand-strong); }
.search { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; min-width: 220px; }
.search input { border: 0; outline: 0; width: 100%; background: transparent; }
.segmented { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.segmented button { border: 0; background: transparent; border-radius: 8px; padding: 7px 12px; font-weight: 700; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: var(--peach); color: var(--ink); }

/* ── 骨架 ───────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { padding: 24px 14px; background: var(--brand-dark); color: #42533d; border-right: 1px solid #d3dcc9; }
.brand-row { padding: 0 8px 22px; font-weight: 900; }
.brand-row .brand-art { width: 50px; height: 50px; flex: 0 0 auto; border-radius: 15px; }
.brand-row small { display: block; margin-top: 5px; color: #687562; font-size: 11px; font-weight: 500; }
.nav { display: block; }
.nav-group { padding: 14px 6px; border-top: 1px solid #cfd9c6; }
.nav-group:first-child { padding-top: 0; border-top: 0; }
.nav-group-label { padding: 0 6px; color: #687562; font-size: 11px; font-weight: 900; letter-spacing: .09em; }
.nav-group-copy { display: block; margin-top: 4px; color: #7e8878; font-size: 10px; font-weight: 500; letter-spacing: 0; line-height: 1.4; }
.nav-group-items { display: grid; gap: 4px; margin-top: 8px; }
.nav button { width: 100%; border: 0; border-radius: 10px; padding: 11px 12px; background: transparent; color: #52634c; text-align: left; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nav button:hover, .nav button.active { background: var(--peach); color: var(--ink); }
.nav button.active { box-shadow: inset 3px 0 0 var(--brand-strong); font-weight: 800; }
.nav .nav-count { font-size: 11px; color: var(--muted); }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { min-height: 74px; padding: 12px 32px; border-bottom: 1px solid var(--line); background: #fffdf9; display: flex; align-items: center; justify-content: space-between; gap: 16px; position: sticky; top: 0; z-index: 5; }
.top b { font-size: 17px; }
.crumb { margin-top: 4px; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.content { max-width: 1380px; width: 100%; padding: 28px 32px 60px; }
.content h1 { margin: 0; font-size: 27px; letter-spacing: -.5px; }
.nav-toggle { display: none; }

/* ── 卡片与面板 ─────────────────────────────────────── */
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 22px 0; }
.metric { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.metric span { font-size: 12px; color: var(--muted); }
.metric b { display: block; margin-top: 8px; font-size: 29px; }
.metric b.value { font-size: 22px; }
.metric small { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.panel { margin-top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-card); }
.panel-head { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 16px; }
.panel-head .panel-hint { color: var(--muted); font-size: 12px; }
.panel-body { padding: 18px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar.between { justify-content: space-between; }
/* 列表的筛选条：搜索框占主要宽度，筛选和翻页靠右。翻页信息放在两个按钮中间，
   这样"第 1–50 / 共 1234"永远紧贴着你正在点的按钮。 */
.filter-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.filter-bar .search { flex: 1 1 260px; }
.filter-field { display: flex; align-items: center; gap: 7px; }
.filter-field select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.pager { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* ── 内容审核 ───────────────────────────────────────── */
/* 每条内容是一张卡片而不是表格行：审核要读正文、看配图、看它出现在哪个组，
   这些塞不进单元格。卡片左侧一条细线表示状态，扫一眼就知道哪些已经处置过。 */
.moderation-list { display: grid; gap: 12px; padding: 16px; }
.moderation-card { display: grid; gap: 10px; padding: 14px 16px; border: 1px solid var(--line-soft); border-left: 3px solid var(--line); border-radius: 12px; background: var(--surface); }
.moderation-card:has(.tag.danger) { border-left-color: var(--danger); }
.moderation-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.moderation-who { display: grid; gap: 2px; min-width: 150px; }
.moderation-body { display: grid; gap: 8px; }
.moderation-text { margin: 0; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.moderation-media { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.moderation-thumb { width: 84px; height: 84px; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--tint); cursor: zoom-in; }
.moderation-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-full { max-width: 100%; max-height: 70vh; border-radius: 10px; display: block; }
.moderation-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border-top: 1px dashed var(--line-soft); padding-top: 10px; }
.moderation-foot .admin-actions { margin-left: auto; }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── 紧急开关 ───────────────────────────────────────── */
/* 提醒条常驻在内容区上方，用足警示色但不刺眼：它要在每一页都能被看见，
   又不该让日常巡检变成一场警报。 */
.switch-banner { position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 11px 18px; background: var(--danger-soft); border-bottom: 1px solid var(--peach); color: #8a3a2c; font-size: 13px; }
.switch-banner-text { font-weight: 600; }
.switch-banner .button { margin-left: auto; }
.switch-list { display: grid; gap: 12px; }
.switch-card { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border: 1px solid var(--line-soft); border-left: 3px solid var(--brand); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-card); }
.switch-card.danger { border-left-color: var(--danger); background: var(--danger-soft); }
.switch-main { display: grid; gap: 6px; flex: 1; }
.switch-title { display: flex; align-items: center; gap: 10px; }
.switch-main p { margin: 0; }
.switch-action { flex: 0 0 auto; }

/* ── 使用趋势 ───────────────────────────────────────── */
/* 柱子用纯 CSS，不引图表库：一天一根、值写在柱子上方，比任何图表都直白。
   柱底对齐、最小高度 4%——那天为 0 时留一个细底座，不然会看起来像缺了一天。 */
/* 柱状图是内联 SVG。之前用 div + CSS 高度时，零值那天的柱子会被算成 76×76 的方块
   （有值的柱子却完全正确），换过百分比高度和绝对定位都没解决；SVG 的显式用户单位
   没有这个问题。宽度铺满容器，高度固定，柱子横向拉伸不影响观感。 */
.trend-svg { display: block; width: 100%; height: 140px; margin-top: 10px; }
.trend-rect { fill: var(--brand); }
.trend-rect.empty { fill: var(--line); }
.trend-rect:hover { fill: var(--brand-strong); }
.trend-axis { display: flex; justify-content: space-between; gap: 12px; padding: 10px 4px 0; border-top: 1px solid var(--line-soft); margin-top: 8px; }
.pill { padding: 6px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-soft); font-size: 12px; cursor: pointer; }
.pill.active { background: var(--tint); border-color: var(--brand); color: var(--brand-strong); font-weight: 600; }

/* 审计详情：一组小标签，而不是一坨 `key=value` 拼接串。 */
.audit-detail { display: flex; flex-wrap: wrap; gap: 4px 6px; max-width: 340px; }
.audit-detail-item { padding: 2px 7px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--tint); color: var(--ink-soft); font-size: 11px; line-height: 1.5; }
/* id 片段：看起来像可点的东西，但不抢正文的注意力。 */
.id-chip { padding: 2px 7px; border: 1px solid var(--line-soft); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 11px; cursor: copy; }
.id-chip:hover { border-color: var(--line); color: var(--ink-soft); }
.note { padding: 13px 14px; background: var(--tint); border-radius: 10px; color: var(--ok); line-height: 1.6; }
.grid-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.links { display: flex; gap: 10px; flex-wrap: wrap; }
.link-card { flex: 1 1 200px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fffdf8; text-align: left; }
.link-card b { display: block; margin-bottom: 5px; }
.link-card small { color: var(--muted); line-height: 1.5; }

/* ── 表格 ───────────────────────────────────────────── */
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 11px 14px; background: #f8f7f1; color: #627162; font-size: 12px; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
td { padding: 13px 14px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:hover td { background: #fdfcf7; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.task-name { min-width: 190px; font-weight: 800; }
.task-name small { display: block; margin-top: 5px; color: var(--muted); font-weight: 400; line-height: 1.5; }
/* 运营位预览：按客户端那条 banner 的比例和间距做一个近似，让运营在发布前看到
   自己写的标题会不会被截断、副标题有多长，而不是发布后再去手机上看。 */
.banner-preview { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.banner-preview-thumb { width: 64px; height: 64px; flex: 0 0 64px; border-radius: 10px; background: linear-gradient(135deg, #f4f1e8, #e9e5d8); display: grid; place-items: center; color: var(--muted); font-size: 11px; }
.banner-preview-body { min-width: 0; display: grid; gap: 4px; }
.banner-preview-title { font-size: 15px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.banner-preview-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.banner-preview-action { justify-self: start; margin-top: 2px; padding: 5px 11px; border: 1px solid var(--line-strong, #d9d4c6); border-radius: 999px; font-size: 12px; }
.banner-preview-hint { margin: 8px 0 0; font-size: 11px; color: var(--muted); line-height: 1.6; }
.cell-stack { display: grid; gap: 5px; }
.cell-stack small { color: var(--muted); }
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; min-width: 150px; }
.empty { padding: 38px; text-align: center; color: var(--muted); }
/* 概览里的"最近反复出现的错误""体检发现"用紧凑条目列表而不是表格：
   内容本身就是要一眼扫完的几句话，套上行框反而更慢。 */
.plain-list { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 6px; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.plain-list li::marker { color: var(--muted-soft); }
.skeleton { height: 14px; border-radius: 7px; background: linear-gradient(90deg, #f1efe8, #e6e3d9, #f1efe8); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── 标签与状态 ─────────────────────────────────────── */
.tag { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: var(--tint); color: #456c4a; font-size: 12px; white-space: nowrap; }
.tag.muted { background: #f1f0ec; color: #6d776d; }
.tag.peach { background: var(--peach-soft); color: #8a5a42; }
.tag.warning { background: var(--warn-soft); color: var(--warn); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.info { background: #e8eef4; color: #4a6480; }
.status-list { display: grid; gap: 10px; }
.status-row { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fffdf8; }
.status-row.critical { border-color: #e6bdb4; background: #fdf4f2; }
.status-row.warning { border-color: #ecd9b6; background: #fdfaf3; }
.status-row.info { border-color: #dfe3d6; background: #f8f9f4; }
.status-row b { font-size: 13px; }
.status-row p { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.status-row code { font-size: 11px; color: var(--muted); }

/* ── 键值网格 ───────────────────────────────────────── */
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line-soft); }
.kv span { color: var(--muted); font-size: 12px; }
.kv b { font-size: 13px; text-align: right; word-break: break-word; max-width: 62%; }

/* ── 详情页 ─────────────────────────────────────────── */
.detail-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.detail-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.detail-title h1 { margin: 0; }
.timeline { display: grid; gap: 8px; }
.timeline-item { display: flex; gap: 12px; align-items: baseline; padding: 9px 0; border-bottom: 1px dashed var(--line-soft); }
.timeline-item time { color: var(--muted); font-size: 12px; min-width: 150px; }
.back { border: 0; background: transparent; color: var(--brand-strong); font-weight: 700; padding: 6px 0; }
/* 个人资料抬头：头像占位 + 昵称与一行摘要 */
.profile-head { display: flex; align-items: center; gap: 14px; padding: 0 0 14px; margin-bottom: 4px; border-bottom: 1px dashed var(--line-soft); }
.profile-head b { display: block; font-size: 17px; }
.profile-head small { color: var(--muted); }
.avatar { width: 52px; height: 52px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--ink); background: var(--brand-dark); font-weight: 800; font-size: 15px; color: var(--brand-strong); }
.avatar.photo { background: var(--peach); font-size: 12px; color: var(--ink); }

/* ── 抽屉、弹窗、提示 ───────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 20; display: none; background: #19271942; }
.modal.open { display: block; }
.modal-sheet { margin-left: auto; width: min(560px, 100%); height: 100%; padding: 26px; background: var(--surface); box-shadow: -20px 0 50px #1d29201f; overflow: auto; }
.modal-sheet.centered { margin: auto; height: auto; max-height: 90vh; border-radius: 18px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h2 { margin: 0; font-size: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 24px; }
.toast-stack { position: fixed; top: 18px; right: 18px; z-index: 40; display: grid; gap: 10px; max-width: min(420px, 90vw); }
.toast { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 10px 24px #34332f1f; font-size: 13px; line-height: 1.55; }
.toast.error { border-color: #e6bdb4; background: #fdf4f2; color: var(--danger); }
.toast.success { border-color: #cfdcc4; background: #f6faf1; color: var(--ok); }

/* ── 响应式 ─────────────────────────────────────────── */
@media (max-width: 1080px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-two { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 268px; z-index: 30; overflow: auto; transform: translateX(-102%); transition: transform .18s ease; box-shadow: 12px 0 32px #34332f26; }
  .side.open { transform: none; }
  .nav-toggle { display: inline-flex; }
  .top { padding: 10px 16px; }
  .content { padding: 20px 16px 48px; }
  .kv { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-sheet { width: 100%; }
}
@media (max-width: 620px) {
  .metrics { grid-template-columns: 1fr; }
  .content h1 { font-size: 23px; }
  .login-card { padding: 25px; }
  .panel-body { padding: 13px; }
}
