/* =========================================================
   theme-doc.css — 阅读/编辑页专属主题（浅色金融风扩展）
   作用页：default_read.html（阅读）、markdown_edit_template.html（编辑）
   不影响其它页面；配合 theme.css 的设计变量使用（无变量依赖，独立成套）
   ========================================================= */

:root{
    --wd-brand:#1256a0;
    --wd-brand-dark:#0d3d75;
    --wd-brand-soft:#eaf1fb;
    --wd-gold:#c1994c;
    --wd-bg:#f4f6fa;
    --wd-line:#e6ebf3;
    --wd-t1:#16202e;
    --wd-t2:#5b6b82;
    --wd-t3:#93a1b5;
}

/* =============== 阅读页（default_read） =============== */

/* 顶栏 */
.m-manual .manual-head{
    background:#fff !important;
    border-bottom:1px solid var(--wd-line) !important;
    box-shadow:0 1px 4px rgba(16,34,62,.04) !important;
    min-height:56px;
}
.m-manual .manual-head .book-title{
    color:var(--wd-t1) !important;
    font-size:16px !important;
    font-weight:600 !important;
    letter-spacing:.02em;
}
.m-manual .manual-head .slidebar{color:var(--wd-t2) !important;}
.m-manual .manual-head .btn-link,.m-manual .manual-head .btn-light,.m-manual .manual-head .btn-default{
    color:var(--wd-t2) !important;
    background:transparent !important;
    border-color:transparent !important;
    font-size:13px;
    border-radius:6px;
    transition:all .16s ease;
}
.m-manual .manual-head .btn-link:hover,.m-manual .manual-head .btn-light:hover,
.m-manual .manual-head .btn-default:hover,.m-manual .manual-head .btn-link:focus{
    color:var(--wd-brand) !important;
    background:var(--wd-brand-soft) !important;
    border-color:transparent !important;
}

/* 左侧栏 */
.m-manual .manual-left{
    background:#fff;
    border-right:1px solid var(--wd-line);
}
.m-manual .article-search .form-control{
    border-color:var(--wd-line);
    box-shadow:none;
    border-radius:6px 0 0 6px;
}
.m-manual .article-search .form-control:focus{
    border-color:var(--wd-brand);
    box-shadow:0 0 0 2px rgba(18,86,160,.12);
}
.m-manual .article-search .input-group-addon{
    background:#fff;border-color:var(--wd-line);color:var(--wd-t3);
}

/* 目录树 */
.m-manual .article-menu-detail a{
    color:var(--wd-t2);
    font-size:13.5px;
    border-radius:6px;
    transition:all .14s ease;
}
.m-manual .article-menu-detail a:hover{
    color:var(--wd-brand) !important;
    background:var(--wd-brand-soft) !important;
}
.m-manual .article-menu-detail a.jstree-clicked,
.m-manual .article-menu-detail li>a.jstree-clicked{
    color:var(--wd-brand) !important;
    background:var(--wd-brand-soft) !important;
    font-weight:600;
    box-shadow:inset 3px 0 0 var(--wd-brand);
}
.m-manual .m-copyright{
    color:var(--wd-t3) !important;
    font-size:12px;
    border-top:1px solid var(--wd-line);
}
.m-manual .m-copyright a{color:var(--wd-brand) !important;}

/* 文章标题区 */
.m-manual .article-head{
    background:#fff !important;
    border-bottom:1px solid var(--wd-line) !important;
    box-shadow:none !important;
}
.m-manual .article-head h1{
    color:var(--wd-t1) !important;
    font-size:22px !important;
    font-weight:600 !important;
    letter-spacing:.02em;
}

/* 文章正文 */
.m-manual .article-body{
    color:var(--wd-t1);
    font-size:15px;
    line-height:1.9;
    letter-spacing:.01em;
}
.m-manual .article-body h1,
.m-manual .article-body h2,
.m-manual .article-body h3{
    color:var(--wd-t1);
    font-weight:600;
    line-height:1.5;
}
.m-manual .article-body h2{
    font-size:21px;
    margin:34px 0 16px;
    padding-left:12px;
    border-left:4px solid var(--wd-brand);
}
.m-manual .article-body h3{
    font-size:17.5px;
    margin:26px 0 12px;
}
.m-manual .article-body a{color:var(--wd-brand);}
.m-manual .article-body a:hover{color:var(--wd-brand-dark);text-decoration:underline;}
.m-manual .article-body img{
    max-width:100%;
    border-radius:8px;
    box-shadow:0 2px 12px rgba(16,34,62,.08);
}
.m-manual .article-body pre{
    background:#f7f9fc !important;
    border:1px solid var(--wd-line) !important;
    border-radius:8px !important;
}
.m-manual .article-body pre code{
    color:var(--wd-t1) !important;
    background:transparent !important;
}
.m-manual .article-body code{
    background:var(--wd-brand-soft);
    color:var(--wd-brand-dark);
    border-radius:4px;
    padding:2px 6px;
}
.m-manual .article-body blockquote{
    border-left:4px solid var(--wd-gold);
    background:#fdfaf3;
    color:var(--wd-t2);
    border-radius:0 8px 8px 0;
    padding:10px 18px;
}
.m-manual .article-body table{border:1px solid var(--wd-line);}
.m-manual .article-body table th{
    background:var(--wd-brand-soft);
    color:var(--wd-t1);
}
.m-manual .article-body table td,.m-manual .article-body table th{border-color:var(--wd-line) !important;}
.m-manual .article-body hr{border-top:1px solid var(--wd-line);}

/* 阅读进度条 */
.m-manual .manual-progress{background:transparent;}
.m-manual .manual-progress .progress-bar{background:var(--wd-brand) !important;}

/* 右下悬浮工具条 */
.m-manual .bookstack-bars ul li{
    background:#fff !important;
    border:1px solid var(--wd-line) !important;
    box-shadow:0 4px 14px rgba(16,34,62,.10);
}
.m-manual .bookstack-bars ul li a{color:var(--wd-t2) !important;}
.m-manual .bookstack-bars ul li a:hover{color:var(--wd-brand) !important;}

/* =============== 编辑页（markdown_edit_template） =============== */

/* 页面背景：覆盖模板内联的粉紫渐变，统一浅色金融风 */
body{
    background:#f4f6fa !important;
    background-image:none !important;
}

/* 顶部操作栏（覆盖内联配色，统一品牌风；吸顶保证随时可保存/发布） */
body>div.container-fluid>div.row>nav{
    background:#fff !important;
    border-bottom:1px solid var(--wd-line);
    box-shadow:0 1px 4px rgba(16,34,62,.04);
    border-radius:0;
    position:sticky;top:0;z-index:1030;
}
body>div.container-fluid>div.row>nav>ul>li>a{
    color:var(--wd-brand) !important;
    font-size:13.5px !important;
    padding:14px 16px;
    transition:all .16s ease;
    border-radius:0;
}
body>div.container-fluid>div.row>nav>ul>li>a:hover{
    color:var(--wd-brand-dark) !important;
    background:var(--wd-brand-soft) !important;
}
body>div.container-fluid>div.row>nav>ul>li>a .glyphicon{margin-right:5px;}

/* 左侧目录栏 */
.edit-page .sidebar,.container-fluid .sidebar{
    background:#fff !important;
    border:1px solid var(--wd-line) !important;
    border-radius:12px !important;
    box-shadow:0 6px 20px rgba(16,34,62,.07);
}
.sidebar .toggle-btn{
    color:var(--wd-brand) !important;
    background:var(--wd-brand-soft) !important;
    border-radius:8px;
    width:26px;height:26px;line-height:26px;text-align:center;
    font-size:14px;font-weight:600;
    box-shadow:inset 0 0 0 1px rgba(18,86,160,.08);
}
/* 目录栏工具条 */
.sidebar .manual-nav{
    color:var(--wd-t1);
    position:sticky;top:0;z-index:3;
    background:#fff;
    border-bottom:1px solid var(--wd-line);
    padding:8px 10px !important;
}
.sidebar .nav-plus{
    color:#fff !important;
    width:24px;height:24px;line-height:24px;text-align:center;
    border-radius:50%;
    background:linear-gradient(135deg,#2f7cf6,#1256a0);
    box-shadow:0 3px 8px rgba(18,86,160,.28);
    cursor:pointer;
    transition:transform .16s ease,box-shadow .16s ease;
}
.sidebar .nav-plus:hover{transform:translateY(-1px) scale(1.05);box-shadow:0 5px 12px rgba(18,86,160,.34);}
.sidebar .nav-plus i{color:#fff !important;font-size:12px;}
/* 目录栏内搜索框 */
.sidebar input[type="text"],.sidebar .search-input{
    border:1px solid var(--wd-line) !important;
    border-radius:8px !important;
    height:30px;
    font-size:12.5px;
    padding:4px 10px !important;
    background:#f8fafd !important;
    color:var(--wd-t1) !important;
    outline:none;
    transition:all .16s ease;
}
.sidebar input[type="text"]:focus,.sidebar .search-input:focus{
    border-color:var(--wd-brand) !important;
    background:#fff !important;
    box-shadow:0 0 0 3px rgba(18,86,160,.10);
}
/* 目录树（jstree）；长文档名截断防破格 */
.sidebar .manual-tree{padding:4px 0 8px;}
.sidebar .manual-tree a{color:var(--wd-t2) !important;border-radius:8px;}
.sidebar .manual-tree .jstree-anchor{
    padding:4px 8px !important;
    margin:1px 6px;
    border-radius:8px;
    max-width:calc(100% - 12px);
    overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
    transition:background .14s ease,color .14s ease;
}
.sidebar .manual-tree .jstree-anchor:hover{
    color:var(--wd-brand) !important;
    background:#f1f7ff !important;
}
.sidebar .manual-tree .jstree-clicked,.sidebar .manual-tree .jstree-clicked>.jstree-anchor{
    color:#0d3d75 !important;
    -webkit-text-fill-color:#0d3d75 !important;
    background:linear-gradient(90deg,#dfeafc,#f2f8ff) !important;
    font-weight:600;
    text-shadow:none;
    box-shadow:inset 3px 0 0 var(--wd-brand);
}
.sidebar .manual-tree .jstree-clicked *,.sidebar .manual-tree .jstree-clicked>.jstree-anchor *{
    color:#0d3d75 !important;
    -webkit-text-fill-color:#0d3d75 !important;
}
.sidebar .manual-tree .jstree-wholerow-hovered{background:#f4f8ff !important;border-radius:8px;}
.sidebar .manual-tree .jstree-wholerow-clicked{background:transparent !important;}
.sidebar .manual-tree .jstree-icon{opacity:.85;}
.sidebar .manual-tree .jstree-clicked .jstree-icon{opacity:1;}
/* 待审核列表 */
.sidebar .nopermit{
    margin:10px !important;
    padding:10px !important;
    background:#f7f9fc !important;
    border:1px solid #e9eff7 !important;
    border-radius:10px !important;
}
.sidebar .nopermit h2{
    color:var(--wd-t1) !important;
    font-size:13.5px !important;
    font-weight:600;
    margin:0 0 8px !important;
    padding-left:10px;
    border-bottom:0 !important;
    position:relative;
}
.sidebar .nopermit h2:before{
    content:"";position:absolute;left:0;top:3px;bottom:3px;width:3px;border-radius:2px;
    background:linear-gradient(180deg,#2f7cf6,#1256a0);
}
.sidebar .pending-list li{
    background:#fff !important;
    border:1px solid #e9eff7 !important;
    border-left:3px solid #ff9f43 !important;
    border-radius:8px !important;
    margin-bottom:6px !important;
    padding:8px 10px !important;
    font-size:12.5px;
    color:var(--wd-t2) !important;
    transition:all .14s ease;
}
.sidebar .pending-list li:hover{
    background:#fff !important;
    border-color:#ffd8a8 !important;
    border-left-color:#ff9f43 !important;
    box-shadow:0 3px 10px rgba(255,159,67,.16);
    transform:translateX(1px);
}

/* ===== 编辑工作区布局优化：模板辅助、编辑为主 ===== */

/* 模块尺寸可调：由 CSS 变量驱动，拖拽手柄实时改值（JS 见模板内 wd-resize 脚本） */
:root{
    --wd-sidebar-w:250px;
    --wd-tpl-h:190px;
}
.sidebar:not(.collapsed){width:var(--wd-sidebar-w) !important;}
.sidebar.collapsed .wd-resizer-v{display:none;}
.sidebar.collapsed .wd-resizer-sh{display:none;}

/* 模板卡片区：卡片尺寸固定，不随目录栏高度变化 */
@media (min-width:768px){
    .wrapper-2{
        height:auto !important;
        max-height:none !important;
        overflow-y:auto !important;
        grid-template-columns:repeat(6,minmax(0,1fr)) !important;
        grid-gap:12px !important;
        padding:10px !important;
        align-items:start !important;
        align-content:start !important;
        grid-auto-rows:88px !important;
    }
}
@media (min-width:768px) and (max-width:1100px){
    .wrapper-2{
        grid-template-columns:repeat(3,minmax(0,1fr)) !important;
    }
}

/* 工具栏上方拖动条（横向，贴中部区域底缘） */
.wd-resizer-th i{width:36px;height:3px;margin:0;}
.wd-resizer-th{background:transparent;}

/* 拖拽手柄 */
.wd-resizer{z-index:40;border-radius:6px;transition:background .15s ease;opacity:.85;}
.wd-resizer i{display:block;border-radius:2px;background:#c2cede;}
.wd-resizer:hover,.wd-resizer.active{background:rgba(18,86,160,.14);opacity:1;}
.wd-resizer:hover i,.wd-resizer.active i{background:var(--wd-brand);}
/* 侧栏宽度手柄（竖直，贴侧栏右缘中部，避开滚动条） */
.wd-resizer-v{
    position:absolute;top:50%;right:8px;transform:translateY(-50%);
    width:10px;height:54px;cursor:col-resize;
}
.wd-resizer-v i{width:3px;height:30px;margin:12px auto;}
/* 模板卡片区高度手柄（水平，grid 横跨整行 + 容器底部吸附） */
.wd-resizer-h{
    grid-column:1/-1;
    position:sticky;bottom:-2px;
    width:100%;height:12px;cursor:row-resize;
    margin-top:-12px;
}
.wd-resizer-h i{width:36px;height:3px;margin:4px auto;}
/* 拖拽中的全局态 */
body.wd-resizing{user-select:none;}
body.wd-resizing-v,body.wd-resizing-v *{cursor:col-resize !important;}
body.wd-resizing-h,body.wd-resizing-h *{cursor:row-resize !important;}

/* 工具栏：紧凑单行，修复 <i> 斜体；消除按钮组垂直外边距/行高溢出，防止按钮盖住编辑器首行 */
.wrapper-1{height:50px !important;}
.wrapper-1 .manual-head#editormd-tools{align-items:center;}
.wrapper-1 .editormd-group{margin:0 6px !important;}
.wrapper-1 .items{
    margin-top:0 !important;
    font-size:13.5px !important;
    min-width:56px !important;
    line-height:36px !important;
    padding-top:0 !important;
    padding-bottom:0 !important;
}
#editormd-tools i,.wrapper-1 i,#editormd-tools .items{font-style:normal !important;}

/* 编辑器区域：占满视口剩余高度，无需滚动寻编辑器 */
/* 中部工作区（目录栏 + 模板卡片）：高度由目录栏高度变量驱动 */
.container-fluid>.row>#wd-middle{
    height:var(--wd-sidebar-h, calc(100vh - 175px));
    min-height:0 !important;
    margin-top:8px !important;
    padding-bottom:0 !important;
    overflow:hidden !important;
}
.manual-editor-container{height:100% !important;}
.manual-editor-container .manual-editormd{
    bottom:0 !important;top:0 !important;height:100% !important;
}

/* 模板卡片栏（wrapper-2） */
.wrapper-2 .card{
    background:#fff !important;
    border:1px solid var(--wd-line) !important;
    border-radius:8px !important;
    box-shadow:0 1px 6px rgba(16,34,62,.05) !important;
    transition:all .18s ease;
    padding:10px 12px !important;
    margin-bottom:0 !important;
    align-self:stretch !important;
    min-height:0 !important;
    height:auto !important;
}
.wrapper-2 .card:hover{
    border-color:var(--wd-brand) !important;
    box-shadow:0 6px 18px rgba(18,86,160,.14) !important;
    transform:translateY(-2px);
}
/* 卡片更紧凑 */
.wrapper-2 .items{
    padding:10px 12px !important;
    margin-bottom:0 !important;
    break-inside:auto !important;
}
.wrapper-2 .card{
    display:flex !important;
    align-items:center;
    gap:10px;
    cursor:pointer;
    background:linear-gradient(180deg,#fff 0%,#fbfcff 100%) !important;
}
.wrapper-2 .card-title{
    color:var(--wd-t1) !important;
    font-size:13px !important;
    font-weight:600 !important;
    line-height:1.4 !important;
    margin:0 !important;
}
.muban-txt{min-width:0;text-align:left;}
.card-sub{
    display:block;
    margin-top:2px;
    font-size:11px;
    line-height:1.3;
    color:#8898aa;
    white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
/* 卡片图标 */
.muban-ico{
    flex:0 0 34px;
    width:34px;height:34px;
    border-radius:10px;
    display:flex;align-items:center;justify-content:center;
    color:#fff;
    font-size:15px;
    background:linear-gradient(135deg,#2f7cf6,#1256a0);
    box-shadow:0 4px 10px rgba(18,86,160,.22);
    transition:transform .18s ease,box-shadow .18s ease;
}
.muban-ico i{color:#fff !important;font-size:15px;line-height:1;}
.muban-ico.ico-violet{background:linear-gradient(135deg,#8b6cf6,#5b3fd6);box-shadow:0 4px 10px rgba(91,63,214,.22);}
.muban-ico.ico-teal{background:linear-gradient(135deg,#22c3a6,#0e8f7d);box-shadow:0 4px 10px rgba(14,143,125,.22);}
.muban-ico.ico-rose{background:linear-gradient(135deg,#f0659b,#cf2f74);box-shadow:0 4px 10px rgba(207,47,116,.22);}
.muban-ico.ico-indigo{background:linear-gradient(135deg,#4f7df3,#2c50c9);box-shadow:0 4px 10px rgba(44,80,201,.22);}
.muban-ico.ico-amber{background:linear-gradient(135deg,#f7b84b,#d98a07);box-shadow:0 4px 10px rgba(217,138,7,.22);}
.wrapper-2 .card:hover{background:#fff !important;}
.wrapper-2 .card:hover .muban-ico{transform:translateY(-1px) scale(1.06);}

/* markdown 工具栏 */
.wrapper-1 .manual-head#editormd-tools{
    background:#fff !important;
    border:1px solid var(--wd-line) !important;
    border-radius:10px !important;
    box-shadow:0 2px 10px rgba(16,34,62,.05);
}
.wrapper-1 .editormd-group a{
    color:var(--wd-t2) !important;
    border-radius:6px;
    transition:all .14s ease;
    white-space:nowrap !important;
}
.wrapper-1 .editormd-group a:hover{
    color:var(--wd-brand) !important;
    background:var(--wd-brand-soft) !important;
}
.wrapper-1 .editormd-group a .items{color:inherit !important;}

/* 编辑器区域（editor.md）适配 */
.editormd{
    border-color:var(--wd-line) !important;
    border-radius:10px !important;
    box-shadow:0 2px 10px rgba(16,34,62,.05);
}
.editormd-toolbar{
    background:#fff !important;
    border-bottom:1px solid var(--wd-line) !important;
}
.editormd-toolbar a{color:var(--wd-t2) !important;}
.editormd-toolbar a:hover{color:var(--wd-brand) !important;background:var(--wd-brand-soft) !important;}
.editormd-statusbar{
    background:#fbfcfe !important;
    border-top:1px solid var(--wd-line) !important;
    color:var(--wd-t3) !important;
}
.editormd .CodeMirror{
    border-radius:0 0 10px 10px;
}
.editormd .CodeMirror-gutters{
    background:#fbfcfe !important;
    border-right:1px solid var(--wd-line) !important;
}
.editormd .CodeMirror-linenumber{color:var(--wd-t3) !important;}

/* 通用小节滚动条（浅色细滚动条） */
.manual-left ::-webkit-scrollbar,.sidebar ::-webkit-scrollbar,.editormd ::-webkit-scrollbar{width:6px;height:6px;}
.manual-left ::-webkit-scrollbar-thumb,.sidebar ::-webkit-scrollbar-thumb,.editormd ::-webkit-scrollbar-thumb{
    background:#c9d4e4;border-radius:3px;
}
.manual-left ::-webkit-scrollbar-track,.sidebar ::-webkit-scrollbar-track,.editormd ::-webkit-scrollbar-track{
    background:transparent;
}

/* 手机端：Markdown / 卡片表格自适应，避免内容被裁切 */
@media (max-width:767px){
    .editormd-html-preview table,
    .editormd-preview-container table,
    .markdown-body table,
    .article-body table,
    .manual-body table{
        display:block !important;
        width:100% !important;
        max-width:100% !important;
        overflow-x:auto !important;
        -webkit-overflow-scrolling:touch;
        font-size:12px !important;
        table-layout:auto !important;
    }
    .editormd-html-preview table th,
    .editormd-html-preview table td,
    .editormd-preview-container table th,
    .editormd-preview-container table td,
    .markdown-body table th,
    .markdown-body table td{
        padding:6px 8px !important;
        white-space:normal !important;
        word-break:break-word;
        overflow-wrap:anywhere;
    }
    .editormd-html-preview table td code,
    .editormd-html-preview table th code{
        white-space:normal !important;
        word-break:break-all;
    }
}
