/* assets/app.css — 知识付费运营后台样式（轻量，无外部依赖） */
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: #1f2329; background: #f5f6f8; }
.muted { color: #8a919f; font-size: 13px; }
.spacer { flex: 1; }
.inline { display: flex; gap: 8px; align-items: center; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 320px; background: #fff; border-radius: 12px; padding: 28px; box-shadow: 0 8px 30px rgba(0,0,0,.08); }
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-card .muted { color: #8a919f; font-size: 12px; margin: 0 0 16px; }
.login-card input { width: 100%; padding: 10px 12px; margin-bottom: 12px; border: 1px solid #dcdfe6; border-radius: 8px; }
.login-card button { width: 100%; padding: 10px; border: 0; border-radius: 8px; background: #4c6ef5; color: #fff; font-size: 15px; cursor: pointer; }
.err { color: #e03131; font-size: 12px; margin-top: 8px; }

/* 框架 */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #1f2329; color: #c9cdd4; padding: 18px 0; flex-shrink: 0; display: flex; flex-direction: column; }
.brand { padding: 0 20px 16px; font-size: 17px; font-weight: 600; color: #fff; border-bottom: 1px solid #333; margin-bottom: 10px; }
.brand small { font-size: 12px; color: #8a919f; font-weight: 400; }
.sidebar nav { flex: 1; overflow-y: auto; }

/* 导航分组 */
.nav-group { margin-bottom: 4px; }
.nav-group-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  font-size: 14px; font-weight: 600; color: #fff;
  cursor: pointer; user-select: none;
}
.nav-group-title:hover { background: #2b3038; }
.nav-group-title .arrow { font-size: 11px; color: #8a919f; transition: transform .2s; }
.nav-group.collapsed .nav-group-title .arrow { transform: rotate(-90deg); }
.nav-group-items { overflow: hidden; transition: max-height .25s ease; }
.nav-group.collapsed .nav-group-items { max-height: 0; }
.sidebar nav a {
  display: block;
  padding: 10px 18px 10px 32px;
  color: #c9cdd4; cursor: pointer; text-decoration: none;
  font-size: 13px;
}
.sidebar nav a:hover { background: #2b3038; }
.sidebar nav a.active { background: #4c6ef5; color: #fff; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 56px; background: #fff; border-bottom: 1px solid #eceef1; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; }
.crumb { font-weight: 600; }
.content { padding: 20px; flex: 1; width: 100%; }

/* 页面容器：平铺满整个内容区 */
.page { width: 100%; max-width: 100%; }
.page h2 { margin: 0 0 12px; font-size: 18px; }

/* 工具栏 */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.btn-primary { background: #4c6ef5; color: #fff; border: 0; padding: 8px 16px; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn-ghost { background: transparent; border: 1px solid #dcdfe6; padding: 6px 12px; border-radius: 8px; cursor: pointer; color: #4b5159; text-decoration: none; }

/* 卡片网格（仪表盘 / 设置中心） */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 14px; }
.card { background: #fff; border: 1px solid #eceef1; border-radius: 10px; padding: 16px; text-decoration: none; color: #1f2329; display: block; transition: .15s; }
.card:hover { border-color: #4c6ef5; box-shadow: 0 4px 14px rgba(76,110,245,.12); }
.card b { display: block; font-size: 15px; margin-bottom: 4px; }
.card span { color: #8a919f; font-size: 12px; }

/* 表格 */
.tbl { width: 100%; background: #fff; border-collapse: collapse; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.04); }
.tbl th, .tbl td { padding: 11px 14px; text-align: left; border-bottom: 1px solid #f0f1f3; }
.tbl th { background: #fafbfc; color: #5b6168; font-weight: 600; font-size: 13px; }
.tbl td { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl tr:hover td { background: #fafbff; }
.loading, .err { padding: 30px; text-align: center; color: #8a919f; }
.lnk { color: #4c6ef5; cursor: pointer; text-decoration: none; margin-right: 8px; }
.lnk.danger { color: #e03131; }
.acts { white-space: nowrap; }

/* 表单（编辑页） */
.form { background: #fff; border: 1px solid #eceef1; border-radius: 10px; padding: 20px; max-width: 720px; }
.f { margin-bottom: 16px; }
.f > label { display: block; margin-bottom: 6px; color: #5b6168; font-weight: 500; }
.f input, .f select, .f textarea { width: 100%; padding: 9px 12px; border: 1px solid #dcdfe6; border-radius: 8px; font: inherit; }
.f textarea { min-height: 90px; resize: vertical; }
.f small { display: block; margin-top: 4px; color: #a0a6b0; font-size: 12px; }

/* 上传组件 */
.upload-box { display: inline-block; position: relative; }
.upload-box input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-preview { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.upload-preview img, .upload-preview audio, .upload-preview video { max-width: 240px; max-height: 140px; border-radius: 8px; }

/* 导航菜单编辑器 */
.nav-editor { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.nav-item-edit { display: flex; gap: 8px; align-items: center; background: #fff; border: 1px solid #eceef1; border-radius: 8px; padding: 10px 12px; }
.nav-item-edit input, .nav-item-edit select { padding: 7px 10px; border: 1px solid #dcdfe6; border-radius: 7px; font: inherit; }
.nav-item-edit input[placeholder="标题"] { width: 120px; }
.nav-item-edit input[placeholder="图标"] { width: 80px; }
.nav-item-edit input[placeholder="目标页/链接"] { flex: 1; }

/* 轻提示（非弹窗） */
.toast { position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%) translateY(20px); background: #1f2329; color: #fff; padding: 10px 18px; border-radius: 8px; opacity: 0; transition: .2s; pointer-events: none; z-index: 80; font-size: 13px; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #e03131; }

/* 隐藏属性兜底 */
[hidden] { display: none !important; }

/* ===== 数据看板 ===== */
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 16px; }
.dash-head h2 { margin: 0 0 4px; }
.dash-time { color: #8a919f; font-size: 13px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.kpi { position: relative; background: #fff; border: 1px solid #eceef1; border-radius: 14px; padding: 18px; overflow: hidden; transition: transform .18s cubic-bezier(.16,1,.3,1), box-shadow .18s, border-color .18s; }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c, #4c6ef5); }
.kpi:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(76,110,245,.14); border-color: transparent; }
.kpi-main { min-width: 0; }
.kpi-val { font-size: 26px; font-weight: 700; letter-spacing: -.5px; color: #1f2329; line-height: 1.15; }
.kpi-foot { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.kpi-label { color: #5b6168; font-size: 13px; font-weight: 600; }
.kpi-sub { color: #a0a6b0; font-size: 12px; margin-top: 2px; }
.kpi-delta { font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 20px; }
.kpi-delta.up { color: #37b24d; background: rgba(55,178,77,.12); }
.kpi-delta.down { color: #e03131; background: rgba(224,49,49,.12); }
.kpi-delta.flat { color: #8a919f; background: #f0f1f3; }

.dash-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.panel { background: #fff; border: 1px solid #eceef1; border-radius: 14px; padding: 18px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-head h3 { margin: 0; font-size: 15px; }
.pad { padding: 24px; text-align: center; }
.spark { width: 100%; height: 200px; display: block; }
.mini-legend { font-size: 12px; color: #5b6168; margin-bottom: 8px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin: 0 4px 0 12px; vertical-align: middle; }
.dot.ord { background: #f59f00; } .dot.usr { background: #37b24d; }
.multi-chart { display: flex; flex-direction: column; gap: 8px; }
.mc-line .spark { height: 120px; }

.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut { width: 140px; height: 140px; flex-shrink: 0; }
.donut-num { font-size: 22px; font-weight: 700; fill: #1f2329; }
.donut-cap { font-size: 11px; fill: #8a919f; }
.legend { display: flex; flex-direction: column; gap: 8px; }
.lg { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #5b6168; }
.lg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg b { margin-left: auto; color: #1f2329; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 13px; }
.bar-label { width: 64px; color: #5b6168; flex-shrink: 0; }
.bar-track { flex: 1; height: 10px; background: #f0f1f3; border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; transition: width .6s cubic-bezier(.16,1,.3,1); }
.bar-row b { width: 36px; text-align: right; color: #1f2329; }

.tag { font-size: 12px; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.tag-0 { color: #e8590c; background: rgba(232,89,12,.12); }
.tag-1 { color: #37b24d; background: rgba(55,178,77,.12); }
.tag-2 { color: #e03131; background: rgba(224,49,49,.12); }

.top-list { display: flex; flex-direction: column; gap: 10px; }
.top-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 10px; transition: background .15s; }
.top-row:hover { background: #fafbff; }
.top-rank { width: 24px; height: 24px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; background: #c9cdd4; flex-shrink: 0; }
.top-rank.r1 { background: #f59f00; } .top-rank.r2 { background: #adb5bd; } .top-rank.r3 { background: #e08e45; }
.top-info { flex: 1; min-width: 0; }
.top-info b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-info small { color: #a0a6b0; font-size: 12px; }
.top-sales { color: #4c6ef5; font-size: 13px; }

@media (max-width: 1024px) { .dash-row { grid-template-columns: 1fr; } }
