/* ===== 易点餐教程中心 - 前台三栏样式（niucloud 文档站风格） ===== */
:root {
    --primary: #2e7fd3;
    --primary-light: #e8f2fc;
    --text: #2c3e50;
    --text-secondary: #5e6d82;
    --text-light: #98a4b3;
    --border: #e4e9f0;
    --bg: #ffffff;
    --bg-soft: #f7f9fb;
    --code-bg: #f6f8fa;
    --header-h: 60px;
    --sidebar-w: 250px;
    --toc-w: 210px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.7;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== 顶栏 ===== */
.site-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: var(--header-h);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 24px;
    gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand-logo {
    width: 34px; height: 34px; border-radius: 8px;
    background: linear-gradient(135deg, #2e7fd3, #1f5fa8);
    color: #fff; font-weight: 700; font-size: 17px;
    display: flex; align-items: center; justify-content: center;
}
.brand-name { font-size: 16px; font-weight: 600; color: var(--text); }
.brand-name small { display: block; font-size: 11px; color: var(--text-light); font-weight: 400; line-height: 1.2; }
.site-nav { display: flex; gap: 4px; margin-left: 8px; }
.site-nav a {
    color: var(--text-secondary); font-size: 14px;
    padding: 6px 12px; border-radius: 6px;
}
.site-nav a:hover { color: var(--primary); background: var(--primary-light); text-decoration: none; }
.site-nav a.active { color: var(--primary); background: var(--primary-light); font-weight: 500; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.search-box { position: relative; }
.search-box input {
    width: 200px; height: 34px;
    border: 1px solid var(--border); border-radius: 17px;
    padding: 0 14px 0 34px; font-size: 13px;
    background: var(--bg-soft); color: var(--text);
    outline: none; transition: .2s;
}
.search-box input:focus { border-color: var(--primary); background: #fff; width: 240px; }
.search-box::before {
    content: ""; position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    width: 14px; height: 14px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a4b3' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E") center/contain no-repeat;
}
.menu-btn { display: none; background: none; border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; cursor: pointer; font-size: 16px; color: var(--text-secondary); }

/* ===== 顶部按钮 ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    height: 34px; padding: 0 16px; border-radius: 8px;
    font-size: 13.5px; font-weight: 500; font-family: inherit;
    border: 1px solid transparent; cursor: pointer; white-space: nowrap;
    text-decoration: none; transition: .2s;
}
.btn:hover { text-decoration: none; }
.btn.small { height: 30px; padding: 0 13px; font-size: 12.5px; border-radius: 6px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn.ghost { background: #fff; border-color: var(--border); color: var(--text-secondary); }
.btn.ghost:hover { border-color: var(--primary); color: var(--primary); }

/* ===== 三栏布局 ===== */
.layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
    gap: 0;
    max-width: 1360px;
    margin: 0 auto;
    padding-top: var(--header-h);
}
.sidebar {
    position: sticky; top: var(--header-h);
    height: calc(100vh - var(--header-h));
    overflow-y: auto;
    padding: 28px 18px 40px 24px;
    border-right: 1px solid var(--border);
}
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: #d5dce4; border-radius: 3px; }
.nav-group { margin-bottom: 26px; }
.nav-group-title {
    font-size: 12px; font-weight: 600; color: var(--text-light);
    text-transform: uppercase; letter-spacing: .5px;
    padding: 0 10px 8px;
}
.nav-link {
    display: block; padding: 7px 10px; margin: 1px 0;
    font-size: 14px; color: var(--text-secondary);
    border-radius: 6px; border-left: 3px solid transparent;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-link:hover { color: var(--primary); background: var(--primary-light); text-decoration: none; }
.nav-link.active { color: var(--primary); background: var(--primary-light); font-weight: 500; border-left-color: var(--primary); }
.nav-empty { font-size: 13px; color: var(--text-light); padding: 6px 10px; }

/* ===== 正文 ===== */
.content { min-width: 0; padding: 32px 48px 80px; }
.doc-title { font-size: 28px; font-weight: 700; line-height: 1.35; margin-bottom: 10px; }
.doc-meta { font-size: 13px; color: var(--text-light); margin-bottom: 28px; padding-bottom: 16px; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 16px; }
.doc-meta a { color: var(--text-light); }
.doc-meta a:hover { color: var(--primary); }
.doc-body h1 { font-size: 26px; margin: 36px 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.doc-body h2 { font-size: 21px; margin: 32px 0 14px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.doc-body h3 { font-size: 17px; margin: 26px 0 10px; }
.doc-body h4 { font-size: 15px; margin: 20px 0 8px; }
.doc-body h1:first-child, .doc-body h2:first-child { margin-top: 0; }
.doc-body p { margin: 12px 0; }
.doc-body strong { color: #1f2d3d; }
.doc-body a { word-break: break-all; }
.doc-body ul, .doc-body ol { margin: 12px 0 12px 24px; }
.doc-body li { margin: 5px 0; }
.doc-body blockquote {
    margin: 16px 0; padding: 10px 16px;
    border-left: 4px solid var(--primary);
    background: var(--primary-light);
    border-radius: 0 6px 6px 0;
    color: var(--text-secondary);
}
.doc-body blockquote p { margin: 4px 0; }
.doc-body code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 13px; background: var(--code-bg);
    padding: 2px 6px; border-radius: 4px; color: #c7254e;
    border: 1px solid #edf0f3;
}
.doc-body pre {
    position: relative;
    background: #f6f8fa; border: 1px solid var(--border);
    border-radius: 8px; padding: 16px 18px; margin: 16px 0;
    overflow-x: auto; line-height: 1.6;
}
.doc-body pre code { background: none; border: none; padding: 0; color: #24292f; font-size: 13px; }
.doc-body img { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 8px; margin: 10px 0; display: block; }
.doc-body table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; display: table; }
.doc-body th, .doc-body td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.doc-body th { background: var(--bg-soft); font-weight: 600; }
.doc-body tr:nth-child(even) td { background: #fafbfc; }
.doc-body hr { border: none; border-top: 1px solid var(--border); margin: 28px 0; }
.doc-body font[style*="background"] { padding: 1px 4px; border-radius: 3px; }
.code-copy {
    position: absolute; top: 8px; right: 8px;
    font-size: 12px; color: var(--text-light);
    background: #fff; border: 1px solid var(--border); border-radius: 5px;
    padding: 3px 10px; cursor: pointer; opacity: 0; transition: .2s;
    font-family: inherit;
}
.doc-body pre:hover .code-copy { opacity: 1; }
.code-copy:hover { color: var(--primary); border-color: var(--primary); }

/* 上下篇 */
.doc-pager { display: flex; gap: 16px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border); }
.doc-pager a {
    flex: 1; padding: 14px 18px; border: 1px solid var(--border); border-radius: 8px;
    color: var(--text); font-size: 14px; transition: .2s;
}
.doc-pager a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.doc-pager a.next { text-align: right; }
.doc-pager .pager-label { display: block; font-size: 12px; color: var(--text-light); margin-bottom: 4px; }
.doc-pager .pager-title { font-weight: 500; }
.doc-pager a.disabled { opacity: .45; pointer-events: none; }

/* ===== 右侧目录 ===== */
.toc {
    position: sticky; top: var(--header-h);
    height: calc(100vh - var(--header-h));
    overflow-y: auto;
    padding: 32px 24px 40px 18px;
}
.toc-title { font-size: 12px; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; }
.toc a { display: block; font-size: 13px; color: var(--text-secondary); padding: 4px 0 4px 12px; border-left: 2px solid var(--border); line-height: 1.5; }
.toc a:hover { color: var(--primary); text-decoration: none; }
.toc a.active { color: var(--primary); border-left-color: var(--primary); font-weight: 500; }
.toc a.lvl-2 { padding-left: 24px; font-size: 12.5px; }
.toc a.lvl-3 { padding-left: 36px; font-size: 12.5px; color: var(--text-light); }
.toc .toc-top { margin-top: 16px; font-size: 12px; color: var(--text-light); }

/* ===== 空状态 / 404 ===== */
.empty-state { text-align: center; padding: 80px 20px; color: var(--text-light); }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h2 { color: var(--text); font-size: 20px; margin-bottom: 8px; }

/* ===== 页脚 ===== */
.site-footer { border-top: 1px solid var(--border); padding: 22px 24px; text-align: center; font-size: 12.5px; color: var(--text-light); }
.site-footer a { color: var(--text-light); }

/* ===== 返回顶部 ===== */
.back-top {
    position: fixed; right: 28px; bottom: 36px; z-index: 90;
    width: 40px; height: 40px; border-radius: 50%;
    background: #fff; border: 1px solid var(--border);
    color: var(--text-secondary); font-size: 18px; cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,.08);
    display: none; align-items: center; justify-content: center;
}
.back-top:hover { color: var(--primary); border-color: var(--primary); }
.back-top.show { display: flex; }

/* ===== 响应式 ===== */
@media (max-width: 1200px) {
    .toc { display: none; }
    .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
}
@media (max-width: 860px) {
    .layout { grid-template-columns: minmax(0, 1fr); }
    .sidebar {
        position: fixed; left: -280px; top: var(--header-h); z-index: 99;
        width: 260px; background: #fff;
        transition: left .25s; height: calc(100vh - var(--header-h));
        box-shadow: 2px 0 12px rgba(0,0,0,.08);
    }
    .sidebar.open { left: 0; }
    .menu-btn { display: block; }
    .content { padding: 24px 20px 60px; }
    .site-nav { display: none; }
    .search-box input { width: 130px; }
    .search-box input:focus { width: 160px; }
    .doc-pager { flex-direction: column; }
}

/* ===== 知识库主页（卡片网格，仿语雀知识库首页） ===== */
.kb-home { max-width: 1200px; margin: 0 auto; padding: calc(var(--header-h) + 36px) 28px 70px; }
.kb-home-head { margin-bottom: 26px; }
.kb-home-head h1 { font-size: 24px; font-weight: 700; }
.kb-home-head p { font-size: 13.5px; color: var(--text-light); margin-top: 6px; }
.kb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.kb-card {
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    overflow: hidden; color: var(--text); transition: transform .18s, box-shadow .18s, border-color .18s;
    display: block;
}
.kb-card:hover { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(30, 80, 150, .13); border-color: #b8d4f0; text-decoration: none; }
.kb-banner {
    position: relative; height: 118px; padding: 16px 20px;
    background: linear-gradient(135deg, #3a8de0 0%, #2e7fd3 55%, #1f5fa8 100%);
    color: #fff; overflow: hidden;
}
.kb-banner .b-brand { display: flex; align-items: center; gap: 7px; font-size: 12.5px; opacity: .92; }
.kb-banner .b-mark {
    width: 20px; height: 20px; border-radius: 5px; background: rgba(255,255,255,.22);
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px;
}
.kb-banner .b-title { font-size: 19px; font-weight: 700; margin-top: 8px; line-height: 1.3; }
.kb-banner .b-sub { font-size: 12px; opacity: .82; margin-top: 3px; letter-spacing: 2px; }
.kb-banner .b-deco {
    position: absolute; right: 6px; bottom: -30px; font-size: 96px; font-weight: 700;
    opacity: .1; line-height: 1; pointer-events: none;
}
.kb-body { padding: 14px 20px 10px; min-height: 66px; }
.kb-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.65; }
.kb-foot {
    padding: 10px 20px 16px; display: flex; justify-content: space-between; align-items: center;
    font-size: 12.5px; color: var(--text-light);
}
.kb-go { color: var(--primary); font-weight: 500; }
.kb-card:hover .kb-go { text-decoration: underline; }

/* ===== 分类页 / 搜索页 ===== */
.cat-page { max-width: 880px; margin: 0 auto; padding: calc(var(--header-h) + 36px) 28px 70px; }
.crumb { font-size: 13px; color: var(--text-light); margin-bottom: 18px; }
.crumb a { color: var(--text-secondary); }
.crumb a:hover { color: var(--primary); }
.crumb span { margin: 0 6px; color: #cbd3dd; }
.cat-head { margin-bottom: 24px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.cat-head h1 { font-size: 24px; font-weight: 700; }
.cat-head p { font-size: 13.5px; color: var(--text-light); margin-top: 6px; }
.cat-list { display: flex; flex-direction: column; gap: 10px; }
.cat-item {
    display: flex; align-items: center; gap: 14px;
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    padding: 15px 18px; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.cat-item:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(46,127,211,.10); text-decoration: none; }
.ci-main { flex: 1; min-width: 0; }
.ci-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ci-cat { font-weight: 400; font-size: 11.5px; }
.ci-desc {
    font-size: 12.5px; color: var(--text-light); margin-top: 4px; line-height: 1.5;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ci-arrow { font-size: 20px; color: #cbd3dd; flex-shrink: 0; }
.cat-item:hover .ci-arrow { color: var(--primary); }
.cat-back { margin-top: 28px; font-size: 13.5px; }
.sidebar-back { padding: 0 10px 14px; margin-bottom: 6px; border-bottom: 1px solid var(--border); font-size: 13px; }
.sidebar-back a { color: var(--text-secondary); }
.sidebar-back a:hover { color: var(--primary); text-decoration: none; }

/* 响应式 */
@media (max-width: 1080px) { .kb-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .kb-grid { grid-template-columns: 1fr; } .kb-home, .cat-page { padding: 24px 16px 50px; } }

/* ===== 单篇密码访问 ===== */
.pwd-gate {
    max-width: 420px; margin: 80px auto; background: #fff;
    border: 1px solid var(--border); border-radius: 12px; padding: 40px 36px; text-align: center;
    box-shadow: 0 6px 24px rgba(30,80,150,.08);
}
.pwd-gate .lock-icon {
    width: 52px; height: 52px; border-radius: 50%; background: var(--primary-light);
    color: var(--primary); font-size: 24px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 16px;
}
.pwd-gate h2 { font-size: 19px; margin-bottom: 6px; }
.pwd-gate .pg-desc { font-size: 13px; color: var(--text-light); margin-bottom: 22px; }
.pwd-gate input {
    width: 100%; height: 40px; border: 1px solid var(--border); border-radius: 8px;
    padding: 0 14px; font-size: 14px; outline: none; margin-bottom: 12px; text-align: center; letter-spacing: 2px;
}
.pwd-gate input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(46,127,211,.12); }
.pwd-gate .pg-btn {
    width: 100%; height: 40px; border: none; border-radius: 8px; background: var(--primary);
    color: #fff; font-size: 14px; cursor: pointer; font-family: inherit;
}
.pwd-gate .pg-btn:hover { background: var(--primary-dark); }
.pwd-gate .pg-err { color: var(--danger); font-size: 13px; margin-bottom: 12px; }
.pwd-gate .pg-back { margin-top: 16px; font-size: 12.5px; }
.lock-badge { color: #f0a020; font-size: 12px; margin-left: 5px; }

/* ===== 二级分类分组标题（分类页 / 搜索结果） ===== */
.subcat-head {
    font-size: 13px; font-weight: 600; color: var(--text-secondary);
    padding: 16px 6px 8px; margin-top: 6px; letter-spacing: .3px;
}
.subcat-head::before {
    content: ""; display: inline-block; width: 3px; height: 13px;
    background: var(--primary); border-radius: 2px; margin-right: 8px; vertical-align: -1px;
}

/* ===== 侧栏二级分组小标题 ===== */
.nav-subtitle {
    font-size: 11.5px; color: var(--text-light); font-weight: 600;
    padding: 10px 14px 4px; letter-spacing: .3px;
}

/* ===== 分类页 / 搜索结果 二级标签 ===== */
.ci-sub {
    display: inline-block; font-size: 11px; line-height: 1; padding: 3px 7px;
    border-radius: 4px; background: #eef4fb; color: #3a7bc8; margin-left: 6px; font-weight: 400; vertical-align: 1px;
}

/* ===== 空白篇占位（已发布但正文为空） ===== */
.blank-doc { text-align: center; padding: 80px 20px; color: var(--text-light); }
.blank-doc .bd-icon { font-size: 44px; margin-bottom: 14px; }
.blank-doc h2 { font-size: 18px; color: var(--text-secondary); margin-bottom: 8px; font-weight: 600; }
.blank-doc p { font-size: 13.5px; max-width: 420px; margin: 0 auto; line-height: 1.7; }
