/* 稼云小说工坊 - 公共样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif; background: #0d0d1a; color: #fff; min-height: 100vh; }

/* 顶部导航 */
.nav { position: sticky; top: 0; z-index: 100; background: rgba(13,13,26,0.88); backdrop-filter: blur(20px); border-bottom: 1px solid rgba(255,255,255,0.06); padding: 0 24px; height: 60px; display: flex; align-items: center; justify-content: space-between; }
.nav-left { display: flex; align-items: center; gap: 20px; overflow-x: auto; }
.logo { font-size: 20px; font-weight: 700; background: linear-gradient(135deg, #6366f1, #ec4899); -webkit-background-clip: text; -webkit-text-fill-color: transparent; white-space: nowrap; text-decoration: none; }
.nav-menu { display: flex; gap: 4px; }
.nav-item { padding: 7px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; color: rgba(255,255,255,0.65); transition: all 0.2s; text-decoration: none; white-space: nowrap; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.06); }
.nav-item.active { color: #fff; background: rgba(99,102,241,0.25); }
.nav-right { display: flex; align-items: center; gap: 10px; }
.token-input { width: 200px; padding: 7px 11px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.15); background: rgba(255,255,255,0.05); color: #fff; font-size: 12px; outline: none; }

/* 按钮 */
.btn { padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; border: none; transition: all 0.2s; font-weight: 500; }
.btn-primary { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; }
.btn-primary:hover { opacity: 0.88; }
.btn-ghost { background: rgba(255,255,255,0.08); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,0.15); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-danger { background: rgba(220,38,38,0.2); color: #fca5a5; }
.btn-accent { background: linear-gradient(135deg, #22c55e, #10b981); color: #fff; }
.btn-accent:hover { opacity: 0.88; }

/* 页面主容器 */
.main { max-width: 1300px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-head h1 { font-size: 24px; }
.page-head p { color: rgba(255,255,255,0.5); font-size: 13px; margin-top: 4px; }

/* 卡片 */
.card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 14px; padding: 20px; margin-bottom: 20px; }
.card h3 { font-size: 15px; margin-bottom: 14px; color: rgba(255,255,255,0.85); display: flex; align-items: center; justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.stat-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 20px; }
.stat { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; padding: 18px; }
.stat .num { font-size: 26px; font-weight: 700; color: #a5b4fc; }
.stat .lb { font-size: 13px; color: rgba(255,255,255,0.5); margin-top: 6px; }

/* 表单 */
label { display: block; font-size: 13px; color: rgba(255,255,255,0.55); margin: 12px 0 6px; }
.input, .select, textarea.input { width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.15); background: rgba(255,255,255,0.05); color: #fff; font-size: 13px; outline: none; font-family: inherit; }
textarea.input { min-height: 120px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, textarea.input:focus { border-color: #6366f1; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; padding: 10px 12px; color: rgba(255,255,255,0.45); font-weight: 500; border-bottom: 1px solid rgba(255,255,255,0.08); }
.table td { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.table tr:hover td { background: rgba(255,255,255,0.02); }

/* 标签 */
.tag { font-size: 11px; padding: 2px 8px; border-radius: 10px; display: inline-block; }
.tag-ok { background: rgba(16,185,129,0.18); color: #6ee7b7; }
.tag-warn { background: rgba(245,158,11,0.18); color: #fcd34d; }
.tag-fail { background: rgba(220,38,38,0.18); color: #fca5a5; }
.tag-info { background: rgba(99,102,241,0.18); color: #a5b4fc; }

/* 工具条 */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .select, .toolbar .input { width: auto; min-width: 140px; }

/* 告警条 */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; font-size: 13px; line-height: 1.6; }
.alert-info { background: rgba(99,102,241,0.12); border: 1px solid rgba(99,102,241,0.25); color: #c7d2fe; }
.alert-warn { background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.25); color: #fde68a; }

/* 空态 */
.empty { color: rgba(255,255,255,0.35); text-align: center; padding: 30px; font-size: 14px; }

/* AI 面板 / 侧栏 */
.side-panel { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; padding: 14px; }
.side-panel h4 { font-size: 13px; color: rgba(255,255,255,0.7); margin-bottom: 10px; }
.warn-line { font-size: 12px; padding: 5px 8px; border-radius: 6px; margin-bottom: 4px; }
.warn-line.warn { background: rgba(245,158,11,0.12); color: #fcd34d; }
.warn-line.info { background: rgba(99,102,241,0.12); color: #a5b4fc; }
.warn-line.ok { background: rgba(16,185,129,0.12); color: #6ee7b7; }

/* Toast */
.xs-toast { position: fixed; left: 50%; bottom: 48px; transform: translateX(-50%); background: rgba(20,20,30,.92); color: #fff; padding: 12px 22px; border-radius: 10px; z-index: 9999; opacity: 0; pointer-events: none; transition: opacity .25s; font-size: 14px; }
.xs-toast.show { opacity: 1; }
.xs-toast.ok { background: rgba(16,140,80,.92); }
.xs-toast.err { background: rgba(200,40,50,.92); }

/* ===== 阅读体验增量（A1/A2/A4/A5）：工具栏 / 字号 / 主题 / 目录抽屉 ===== */

/* 阅读工具栏：readerHead 与 readerBody 之间一行小按钮组（始终深色，不受主题影响） */
.reader-toolbar { display: flex; gap: 8px; align-items: center; padding: 8px 10px; background: rgba(255,255,255,.06); border-radius: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.tb-group { display: flex; gap: 4px; align-items: center; }
.tb-sep { width: 1px; height: 18px; background: rgba(255,255,255,.12); margin: 0 4px; }
.tb-btn { padding: 4px 10px; border-radius: 6px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); color: #fff; font-size: 13px; cursor: pointer; line-height: 1.4; transition: all .15s; }
.tb-btn:hover { background: rgba(255,255,255,.15); }
.tb-btn.on { background: rgba(99,102,241,.35); border-color: rgba(99,102,241,.7); color: #c7d2fe; }

/* 字号三档：挂在 #readerBody，覆盖现有 .reader-body 的 font-size:16px */
#readerBody.fs-s { font-size: 15px; }
#readerBody.fs-m { font-size: 17px; }
#readerBody.fs-l { font-size: 20px; }

/* 主题三档：挂在 #readerBody，同时作用于正文与付费墙 */
#readerBody.theme-night { background: rgba(255,255,255,.02); color: #fff; border-color: rgba(255,255,255,.06); }
#readerBody.theme-day { background: #f7f4ec; color: #3a3630; border-color: rgba(0,0,0,.12); }
#readerBody.theme-parchment { background: #f5ead6; color: #5b4636; border-color: rgba(0,0,0,.1); }

/* 浅色主题下付费墙可读性覆盖（原 .paywall 内 rgba(255,255,255,.6)/#fbbf24 在浅底对比度不足） */
.theme-day .paywall { color: #57534e; }
.theme-day .paywall .big { color: #b45309; }
.theme-day .paywall .btn { border: 1px solid rgba(0,0,0,.15); }
.theme-parchment .paywall { color: #6b5b4d; }
.theme-parchment .paywall .big { color: #92400e; }
.theme-parchment .paywall .btn { border: 1px solid rgba(0,0,0,.15); }

/* 目录抽屉：蒙层 + 右滑面板 */
.drawer-mask { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 900; opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer-mask.show { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(360px, 86vw); background: #16162a; border-left: 1px solid rgba(255,255,255,.08); z-index: 901; transform: translateX(100%); transition: transform .25s; display: flex; flex-direction: column; }
.drawer.show { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.drawer-head h3 { font-size: 15px; color: rgba(255,255,255,.85); margin: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 12px 14px; }
.drawer-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 8px; cursor: pointer; transition: all .15s; margin-bottom: 4px; }
.drawer-item:hover { background: rgba(255,255,255,.05); }
.drawer-item .lock { color: #f87171; font-size: 12px; }
.drawer-item .free { color: #34d399; font-size: 12px; }

/* 续读入口 */
.resume-chip { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-radius: 8px; background: rgba(99,102,241,.15); border: 1px solid rgba(99,102,241,.35); cursor: pointer; transition: all .15s; margin-bottom: 10px; font-size: 13px; color: #c7d2fe; }
.resume-chip:hover { background: rgba(99,102,241,.25); }

/* ===== 订阅转化漏斗（B2）：4 行条形图 ===== */
.funnel-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.funnel-row .name { width: 44px; font-size: 13px; color: rgba(255,255,255,.75); flex: 0 0 auto; }
.funnel-row .num { width: 48px; font-size: 13px; font-weight: 600; color: #fff; flex: 0 0 auto; text-align: right; }
.funnel-row .bar-wrap { flex: 1; }
.funnel-row .rate { width: 56px; font-size: 12px; color: rgba(255,255,255,.55); flex: 0 0 auto; text-align: right; }
.funnel-note { font-size: 12px; color: rgba(255,255,255,.5); margin-top: 10px; line-height: 1.6; }
.funnel-summary { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px dashed rgba(255,255,255,.12); font-size: 12px; color: rgba(255,255,255,.6); }