:root {
    --bg: #f4f5fb;
    --surface: #ffffff;
    --surface-2: #f8f9fd;
    --border: #e8eaf3;
    --text: #1f2340;
    --text-soft: #6b7196;
    --text-mute: #9aa0c0;
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-soft: #eef0fe;
    --accent: #7c3aed;
    --success: #10b981;
    --danger: #ef4444;
    --warn: #f59e0b;
    --shadow-sm: 0 1px 3px rgba(31, 35, 64, .06), 0 1px 2px rgba(31, 35, 64, .04);
    --shadow: 0 6px 24px rgba(31, 35, 64, .08);
    --shadow-lg: 0 18px 50px rgba(31, 35, 64, .18);
    --radius: 14px;
    --radius-sm: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; border: none; background: none; }

input, textarea, select {
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all .15s;
    white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: var(--surface); color: var(--text-soft); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #fef2f2; color: var(--danger); border: 1px solid #fdd; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Login ---------- */
#login-view {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(rgba(50, 8, 0, .22), rgba(50, 8, 0, .22)),
        url('/img/login-bg.jpg') center / cover no-repeat;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 40px 36px;
    animation: rise .4s ease;
}

@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.login-logo {
    width: 56px; height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; margin: 0 auto 18px;
    box-shadow: 0 8px 20px rgba(99, 102, 241, .35);
}
.login-card h1 { font-size: 22px; text-align: center; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: var(--text-mute); margin-bottom: 28px; font-size: 13px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-soft); margin-bottom: 6px; font-weight: 500; }
.login-card .btn-primary { width: 100%; padding: 12px; margin-top: 8px; font-size: 15px; }
.login-hint { text-align: center; color: var(--text-mute); font-size: 12px; margin-top: 18px; }

/* ---------- App shell ---------- */
.navbar {
    height: 60px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 24px;
    position: sticky; top: 0; z-index: 50;
    box-shadow: var(--shadow-sm);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.brand .logo {
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.nav-tabs { display: flex; gap: 4px; margin-left: 36px; }
.nav-tab {
    padding: 8px 16px; border-radius: 9px; color: var(--text-soft);
    font-size: 14px; font-weight: 500; transition: all .15s;
}
.nav-tab:hover { background: var(--surface-2); color: var(--text); }
.nav-tab.active { background: var(--primary-soft); color: var(--primary-dark); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 600;
}
.role-badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.role-admin { background: #fef3c7; color: #b45309; }
.role-user { background: var(--primary-soft); color: var(--primary-dark); }

.container { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.toolbar h2 { font-size: 20px; margin-right: auto; }
.toolbar-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-box { position: relative; width: 240px; }
.search-box input { padding-left: 34px; }
.search-box .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-mute); pointer-events: none; font-size: 13px; }
.filter-group { display: flex; align-items: center; gap: 8px; }
.toolbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.toolbar select {
    height: 36px;
    min-width: 0;
    max-width: 160px;
    padding: 0 28px 0 12px;
    font-size: 13px;
    border-radius: 10px;
    background-color: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-soft);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239aa0c0' d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color .15s, box-shadow .15s, color .15s, background-color .15s;
}
.toolbar select:hover { border-color: var(--primary); color: var(--text); background-color: var(--surface); }
.toolbar select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); color: var(--text); background-color: var(--surface); outline: none; }

/* ---------- Novel grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px;
    box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s;
    display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card .cover {
    height: 6px; border-radius: 6px; margin: -20px -20px 16px;
    border-radius: var(--radius) var(--radius) 0 0;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}
.card h3 { font-size: 16px; margin-bottom: 6px; line-height: 1.4; }
.card .author { color: var(--text-soft); font-size: 13px; margin-bottom: 10px; }
.card .author::before { content: "✍ "; }
.card .desc {
    color: var(--text-mute); font-size: 13px; margin-bottom: 14px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; min-height: 40px;
}
.card .meta { display: flex; gap: 12px; font-size: 12px; color: var(--text-mute); margin-bottom: 14px; flex-wrap: wrap; }
.card .actions { display: flex; gap: 8px; margin-top: auto; }
.card .actions .btn { flex: 1; }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 80px 20px; color: var(--text-mute); }
.empty .em-icon { font-size: 48px; margin-bottom: 12px; opacity: .6; }

/* ---------- Editor ---------- */
.editor-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.editor-head h2 { font-size: 20px; margin-right: auto; }
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.editor-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.content-area {
    width: 100%; min-height: 460px; resize: vertical; line-height: 1.9;
    font-size: 15px; font-family: "PingFang SC", "Microsoft YaHei", serif;
}
.editor-status { display: flex; align-items: center; gap: 16px; color: var(--text-mute); font-size: 13px; margin-top: 10px; }
.editor-status .dot { color: var(--success); }

/* ---------- Table ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 18px; font-size: 14px; border-bottom: 1px solid var(--border); }
th { background: var(--surface-2); color: var(--text-soft); font-weight: 600; font-size: 13px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
.td-actions { display: flex; gap: 8px; }
.sc-key { display: flex; align-items: center; gap: 6px; }
.sc-key-mask, .sc-key-full { font-family: var(--font-mono, monospace); font-size: 12px; color: var(--text-soft); }
.sc-ua { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-soft); font-size: 12px; }

/* ---------- Modal ---------- */
.modal-mask {
    position: fixed; inset: 0; background: rgba(31, 35, 64, .45);
    display: flex; align-items: center; justify-content: center; z-index: 100;
    padding: 20px; animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: var(--surface); border-radius: 18px; width: 100%; max-width: 460px;
    box-shadow: var(--shadow-lg); animation: rise .2s ease; overflow: hidden;
}
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-head h3 { font-size: 17px; }
.modal-head .close { margin-left: auto; color: var(--text-mute); font-size: 22px; line-height: 1; padding: 0 4px; }
.modal-body { padding: 22px 24px; max-height: 70vh; overflow: auto; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Toast ---------- */
#toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
    background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary);
    border-radius: 10px; padding: 12px 18px; box-shadow: var(--shadow); font-size: 14px;
    min-width: 240px; animation: slideIn .2s ease; display: flex; align-items: center; gap: 10px;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* ---------- File drop ---------- */
.drop-zone {
    display: block;
    border: 2px dashed var(--border); border-radius: var(--radius-sm);
    padding: 28px; text-align: center; color: var(--text-mute); cursor: pointer;
    transition: all .15s; background: var(--surface-2);
}
.drop-zone:hover, .drop-zone.drag { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.drop-zone .dz-icon { font-size: 32px; margin-bottom: 8px; }
.drop-zone .dz-file { color: var(--primary-dark); font-weight: 600; margin-top: 8px; }

@media (max-width: 720px) {
    .editor-grid { grid-template-columns: 1fr; }
    .nav-tabs { margin-left: 16px; }
    .container { padding: 20px 14px 40px; }
    .search-box { width: 100%; }
}

/* ============ App shell (sidebar layout) ============ */
#app-view { display: flex; min-height: 100vh; }
.sidebar {
    width: 232px; flex-shrink: 0; background: #1f2340; color: #c7cbe8;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
/* 菜单区独立滚动:菜单再多也不会把底部用户信息顶出屏幕 */
.sidebar #side-nav { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding-bottom: 10px; }
.sidebar #side-nav::-webkit-scrollbar { width: 6px; }
.sidebar #side-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }
.sidebar #side-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.22); }

/* 站点 Logo(图片版:圆形裁切,默认 /img/logo.jpg,后台上传后覆盖) */
.brand-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.login-logo.has-img { background: none; box-shadow: none; border-radius: 50%; }
.sidebar .side-brand .logo.has-img { background: none; border-radius: 50%; }
.login-card .sub { text-align: center; color: var(--text-mute); margin-bottom: 28px; font-size: 13px; }

/* 登录页底部备案条 */
.login-footer {
    position: absolute; left: 0; right: 0; bottom: 10px;
    text-align: center; font-size: 12px; line-height: 1.8;
    color: rgba(255, 255, 255, .92); text-shadow: 0 1px 4px rgba(0, 0, 0, .45);
    pointer-events: none; padding: 0 16px;
}
.login-footer span { margin: 0 10px; white-space: nowrap; }
.login-footer a { color: inherit; text-decoration: none; pointer-events: auto; }
.login-footer a:hover { text-decoration: underline; }
.sidebar .side-brand {
    display: flex; align-items: center; gap: 10px; padding: 20px 22px;
    font-weight: 700; font-size: 16px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .side-brand .logo {
    width: 32px; height: 32px; border-radius: 9px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex; align-items: center; justify-content: center; font-size: 17px;
}
/* 分组标题可点击折叠 */
.side-group {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 14px 6px; font-size: 11px; letter-spacing: .08em;
    color: #6b7196; text-transform: uppercase;
    cursor: pointer; user-select: none;
}
.side-group:hover { color: #c7cbe8; }
.side-group .arrow { font-size: 10px; line-height: 1; transition: transform .18s ease; }
.side-group.collapsed .arrow { transform: rotate(-90deg); }
.side-item {
    display: flex; align-items: center; gap: 10px; margin: 2px 8px; padding: 10px 14px;
    border-radius: 9px; color: #c7cbe8; font-size: 14px; font-weight: 500; cursor: pointer;
    transition: background .15s, color .15s;
}
.side-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-item.active { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(99,102,241,.4); }
.side-item .ic { width: 18px; text-align: center; }
.side-foot { margin-top: auto; padding: 16px; border-top: 1px solid rgba(255,255,255,.08); }
.side-user { display: flex; align-items: center; gap: 10px; }
.side-user .avatar { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; }
.side-user .meta { line-height: 1.3; overflow: hidden; }
.side-user .meta .nm { color: #fff; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .meta .rl { color: #9aa0c0; font-size: 12px; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: 60px; background: var(--surface); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; padding: 0 28px; position: sticky; top: 0; z-index: 50;
    box-shadow: var(--shadow-sm);
}
.topbar h1 { font-size: 18px; }
.topbar .spacer { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.page-root { padding: 26px 28px 60px; max-width: 1280px; width: 100%; }

/* ============ Status pills / badges ============ */
.pill { display: inline-block; font-size: 12px; padding: 3px 10px; border-radius: 20px; font-weight: 600; line-height: 1.5; }
.pill.gray { background: var(--surface-2); color: var(--text-soft); }
.pill.blue { background: var(--primary-soft); color: var(--primary-dark); }
.pill.green { background: #e7f8f1; color: #0f9d6e; }
.pill.amber { background: #fef3c7; color: #b45309; }
.pill.red { background: #fdecec; color: #dc2626; }
.pill.purple { background: #f3e8ff; color: #7c3aed; }
.pill-dot { display: inline-flex; align-items: center; gap: 6px; }
.pill-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.lock-banner {
    background: #fdecec; border: 1px solid #f5c2c2; color: #b91c1c; border-radius: var(--radius-sm);
    padding: 12px 16px; margin-bottom: 18px; font-size: 13px; display: flex; gap: 10px; align-items: flex-start;
}
.lock-banner b { color: #991b1b; }

/* ============ Stat cards ============ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.stat-card .v { font-size: 26px; font-weight: 700; }
.stat-card .l { color: var(--text-soft); font-size: 13px; margin-top: 4px; }
.stat-card .sub { font-size: 12px; color: var(--text-mute); margin-top: 6px; }
.stat-card.clickable { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
.stat-card.clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--primary); }
.stat-card.clickable:active { transform: translateY(0); }
.modal.wide { max-width: 920px; }
.chapter-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 14px; color: var(--text-soft); font-size: 13px; }
.chapter-meta span { background: var(--surface-2); padding: 4px 10px; border-radius: 8px; }
.chapter-content { white-space: pre-wrap; line-height: 1.9; font-size: 15px; background: var(--surface-2); border-radius: 12px; padding: 16px 18px; max-height: 52vh; overflow: auto; }

/* ============ Panel / section ============ */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px; margin-bottom: 20px; }
.panel h3 { font-size: 16px; margin-bottom: 16px; }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filter-bar .search-box { width: 240px; }
.filter-bar select { width: auto; min-width: 130px; }
.filter-bar .btn { margin-left: auto; }

/* ============ Forms in page ============ */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.checkbox-line { display: flex; align-items: center; gap: 8px; }
.checkbox-line input { width: auto; }

/* ============ Misc ============ */
.tiny { font-size: 12px; color: var(--text-mute); }
.muted { color: var(--text-soft); }
.center-msg { text-align: center; padding: 50px 20px; color: var(--text-mute); }
.cover-thumb { width: 54px; height: 72px; object-fit: cover; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); }
.cover-thumb.lg { width: 96px; height: 128px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--text-soft); }
.kv dd { margin: 0; }
.tag-chip { display: inline-block; background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px; padding: 2px 10px; font-size: 12px; margin: 2px; }
.cover-preview { margin-top: 10px; }
.cover-preview img { width: 96px; height: 128px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.chapter-content-box { white-space: pre-wrap; line-height: 1.9; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; max-height: 360px; overflow: auto; font-size: 14px; }
.word-meter { font-size: 12px; color: var(--text-mute); margin-top: 6px; }
.word-meter b { color: var(--text); }

/* ============ Admin book card list ============ */
.book-list { display: flex; flex-direction: column; gap: 14px; }
.book-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 18px 20px;
    transition: box-shadow .15s, border-color .15s;
}
.book-card:hover { box-shadow: var(--shadow); border-color: #d0d2e0; }

.bc-main { display: flex; align-items: flex-start; gap: 16px; }
.bc-cover {
    width: 52px; height: 68px;
    object-fit: cover; border-radius: 8px;
    flex-shrink: 0; border: 1px solid var(--border);
}
.bc-cover-placeholder { background: var(--surface-2); }
.bc-info { flex: 1; min-width: 0; }
.bc-title-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.bc-id { font-size: 12px; color: var(--text-mute); font-weight: 600; font-variant-numeric: tabular-nums; }
.bc-name { font-size: 16px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.bc-lock { font-size: 13px; flex-shrink: 0; }
.bc-meta { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-soft); margin-bottom: 6px; }
.bc-sep { color: var(--text-mute); }
.bc-cat { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 360px; }
.bc-tags { display: flex; flex-wrap: wrap; gap: 4px; }

.bc-stats { display: flex; gap: 18px; flex-shrink: 0; padding: 8px 14px; background: var(--surface-2); border-radius: var(--radius-sm); }
.bc-stat { display: flex; flex-direction: column; align-items: center; min-width: 48px; }
.bc-stat b { font-size: 17px; font-weight: 700; color: var(--text); line-height: 1.2; }
.bc-stat span { font-size: 11px; color: var(--text-mute); margin-top: 2px; }

.bc-status-row {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    margin-top: 12px; padding: 10px 0; border-top: 1px solid var(--border);
}
.tp-badge {
    font-size: 11px; padding: 2px 9px; border-radius: 20px; font-weight: 600;
}
.tp-on { background: #e7f8f1; color: #0f9d6e; }
.tp-off { background: var(--surface-2); color: var(--text-mute); }
.tp-warn { background: #fef3c7; color: #b45309; }

.bc-actions {
    display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px;
    align-items: center;
}
.bc-act-group {
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 4px 8px;
}
.bc-act-label {
    font-size: 11px; color: var(--text-mute); font-weight: 700;
    letter-spacing: .04em; padding-right: 4px; border-right: 1px solid var(--border);
    margin-right: 2px;
}
.btn-xs { padding: 4px 10px; font-size: 12px; border-radius: 7px; }

/* ---------- Compact card variant ---------- */
.book-card-compact { padding: 12px 16px; }
.book-card-compact .bc-main { gap: 12px; }
.book-card-compact .bc-cover { width: 44px; height: 58px; }
.book-card-compact .bc-name { font-size: 15px; max-width: 360px; }
.book-card-compact .bc-meta { font-size: 12px; margin-bottom: 2px; }
.book-card-compact .bc-stats { gap: 14px; padding: 6px 10px; }
.book-card-compact .bc-stat b { font-size: 15px; }
.book-card-compact .bc-stat span { font-size: 10px; }

.bc-bottom-row {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border);
    gap: 12px;
}
.bc-status-inline {
    display: flex; flex-wrap: wrap; gap: 5px; align-items: center;
}
.bc-actions-inline {
    display: flex; align-items: center; gap: 3px; flex-shrink: 0;
}
.bc-actions-inline .btn-xs {
    padding: 3px 6px; font-size: 13px; min-width: 28px; height: 28px;
    line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.bc-act-sep {
    width: 1px; height: 18px; background: var(--border); margin: 0 2px;
    flex-shrink: 0;
}
.bc-open-hint {
    font-size: 12px; color: #9aa3b2; flex-shrink: 0; white-space: nowrap;
    transition: color .15s;
}
.book-card-compact:hover .bc-open-hint { color: var(--primary); }

/* 书库 - 章节目录与阅读正文 */
.lib-ch-meta { font-size: 13px; color: var(--text-soft); margin-bottom: 12px; }
.lib-ch-list { display: flex; flex-direction: column; gap: 6px; max-height: 56vh; overflow: auto; padding-right: 4px; }
.lib-ch-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    background: var(--surface-2, #f7f8fa); border: 1px solid var(--border);
    border-radius: var(--radius-sm, 8px); cursor: pointer; transition: background .15s, border-color .15s;
}
.lib-ch-item:hover { background: var(--surface-3, #eef1f6); border-color: var(--primary, #4a7dff); }
.lib-ch-seq { flex-shrink: 0; width: 52px; font-size: 12px; color: var(--text-soft); }
.lib-ch-title { flex: 1 1 auto; min-width: 0; font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-ch-tags { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; }
.lib-ch-words { font-size: 12px; color: #9aa3b2; white-space: nowrap; }
.lib-ch-back {
    display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--primary, #4a7dff);
    cursor: pointer; margin-bottom: 12px; user-select: none;
}
.lib-ch-back:hover { text-decoration: underline; }
.lib-ch-title-big { margin: 4px 0 6px; font-size: 18px; color: var(--text); }

.detail-actions { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.detail-actions-title { font-size: 12px; color: #9aa3b2; margin-bottom: 8px; }
.detail-actions-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ============ 站点 Logo 编辑(系统配置页) ============ */
.logo-edit { display: flex; align-items: flex-start; gap: 14px; }
.logo-preview {
    width: 56px; height: 56px; flex-shrink: 0; border-radius: 12px; overflow: hidden;
    background: linear-gradient(135deg, var(--primary, #4a7dff), var(--accent, #8b5cf6));
    display: flex; align-items: center; justify-content: center; font-size: 26px;
    box-shadow: 0 6px 16px rgba(99, 102, 241, .28);
}
.logo-preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo-edit-main { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.logo-edit-main input[type="text"] { width: 250px; }
