/* ============================================================
   暗色模式（深色背景）覆盖样式
   通过 <html data-theme="dark"> 激活，优先级高于各模板内联 <style>
   所有规则带 [data-theme="dark"] 前缀 + !important，确保覆盖硬编码色
   ============================================================ */

/* 基础 */
[data-theme="dark"] body{background:#0f1115 !important;color:#d1d5db !important}
[data-theme="dark"] a{color:#4d8bff !important}
[data-theme="dark"] a:hover{color:#6ea8ff !important}

/* 顶部导航 */
[data-theme="dark"] .header{background:#171a21 !important;box-shadow:0 1px 4px rgba(0,0,0,.5) !important}
[data-theme="dark"] .header-logo{color:#f3f4f6 !important}
[data-theme="dark"] .header-nav a{color:#9ca3af !important}
[data-theme="dark"] .header-nav>a:hover,[data-theme="dark"] .header-nav>.nav-dropdown:hover{background:#23262e !important}
[data-theme="dark"] .nav-sub a{color:#9ca3af !important}
[data-theme="dark"] .nav-sub a:hover{background:#23262e !important;color:#6ea8ff !important}
[data-theme="dark"] .header-search-input{border-color:#2a2e37 !important;background:#23262e !important;color:#e5e7eb !important}
[data-theme="dark"] .header-search-input::placeholder{color:#6b7280 !important}
[data-theme="dark"] .header-user a{color:#9ca3af !important}
[data-theme="dark"] .header-user a:hover{color:#6ea8ff !important}
[data-theme="dark"] .header-user .uname{color:#e5e7eb !important}

/* 通用内容容器 */
[data-theme="dark"] .content{background:#1a1d24 !important;box-shadow:0 1px 4px rgba(0,0,0,.3) !important}
[data-theme="dark"] .page-title,.archive-year,.author-name{color:#f3f4f6 !important}
[data-theme="dark"] .breadcrumb{color:#9ca3af !important}
[data-theme="dark"] .empty{color:#9ca3af !important}

/* 文章卡片 / 小组件 */
[data-theme="dark"] .article-card{background:#1a1d24 !important;box-shadow:0 1px 4px rgba(0,0,0,.3) !important}
[data-theme="dark"] .article-card:hover{box-shadow:0 4px 12px rgba(0,0,0,.5) !important}
[data-theme="dark"] .article-title a{color:#f3f4f6 !important}
[data-theme="dark"] .article-title a:hover{color:#6ea8ff !important}
[data-theme="dark"] .article-meta{color:#8b919e !important}
[data-theme="dark"] .article-excerpt{color:#9ca3af !important}

[data-theme="dark"] .widget{background:#1a1d24 !important;box-shadow:0 1px 4px rgba(0,0,0,.3) !important}
[data-theme="dark"] .widget-title{color:#f3f4f6 !important;border-color:#262a33 !important}
[data-theme="dark"] .tag-item{background:#23262e !important;color:#9ca3af !important}
[data-theme="dark"] .tag-item:hover{background:#165DFF !important;color:#fff !important}
[data-theme="dark"] .category-list li{border-color:#262a33 !important}
[data-theme="dark"] .category-list a{color:#9ca3af !important}
[data-theme="dark"] .category-list a:hover{color:#6ea8ff !important}

/* 作者卡 */
[data-theme="dark"] .author-card{background:#1a1d24 !important;box-shadow:0 1px 4px rgba(0,0,0,.3) !important}
[data-theme="dark"] .author-meta{color:#8b919e !important}
[data-theme="dark"] .author-stats{border-color:#262a33 !important}
[data-theme="dark"] .author-stats .label{color:#8b919e !important}

/* 归档 */
[data-theme="dark"] .archive-item{border-color:#262a33 !important}
[data-theme="dark"] .archive-date,.archive-count{color:#8b919e !important}
[data-theme="dark"] .archive-title a{color:#e5e7eb !important}
[data-theme="dark"] .archive-title a:hover{color:#6ea8ff !important}

/* 文章详情正文 */
[data-theme="dark"] .article-header{border-color:#262a33 !important}
[data-theme="dark"] .article-header a{color:#4d8bff !important}
[data-theme="dark"] .article-body,.article-content{color:#c3c9d4 !important}
[data-theme="dark"] .article-body h1,.article-body h2,.article-body h3,.article-body h4,.article-body h5,.article-body h6,
[data-theme="dark"] .article-content h1,.article-content h2,.article-content h3{color:#f3f4f6 !important}
[data-theme="dark"] .article-body h2{border-color:#262a33 !important}
[data-theme="dark"] .article-body code,
[data-theme="dark"] .markdown-body code{background:#2a2e37 !important;color:#f0a8c0 !important}
[data-theme="dark"] .article-body blockquote,
[data-theme="dark"] .markdown-body blockquote{background:#161b26 !important;color:#9ca3af !important}
[data-theme="dark"] .article-body th,.article-body td,
[data-theme="dark"] .markdown-body th,.markdown-body td{border-color:#2a2e37 !important}
[data-theme="dark"] .article-body th,
[data-theme="dark"] .markdown-body th{background:#23262e !important}
[data-theme="dark"] .article-body hr{border-top-color:#2a2e37 !important}
[data-theme="dark"] .article-body a,
[data-theme="dark"] .markdown-body a{color:#4d8bff !important}
[data-theme="dark"] .article-tags a{background:#23262e !important;color:#9ca3af !important}
[data-theme="dark"] .article-tags a:hover{background:#165DFF !important;color:#fff !important}

/* 评论 */
[data-theme="dark"] .comments-section{border-color:#2a2e37 !important}
[data-theme="dark"] .comment-item{border-color:#262a33 !important}
[data-theme="dark"] .comment-avatar{background:#23262e !important;color:#9ca3af !important}
[data-theme="dark"] .comment-author{color:#e5e7eb !important}
[data-theme="dark"] .comment-time{color:#8b919e !important}
[data-theme="dark"] .comment-content{color:#c3c9d4 !important}
[data-theme="dark"] .comment-form{background:#23262e !important}
[data-theme="dark"] .comment-form input,.comment-form textarea{border-color:#3a3f4b !important;background:#1a1d24 !important;color:#e5e7eb !important}
[data-theme="dark"] .comment-form input:focus,.comment-form textarea:focus{border-color:#4d8bff !important}

/* 分页 / 页脚 */
[data-theme="dark"] .pagination a,.pagination span{background:#1a1d24 !important;box-shadow:0 1px 4px rgba(0,0,0,.3) !important}
[data-theme="dark"] .pagination a{color:#c3c9d4 !important}
[data-theme="dark"] .pagination a:hover{background:#165DFF !important;color:#fff !important}
[data-theme="dark"] .pagination .active{background:#165DFF !important;color:#fff !important}
[data-theme="dark"] .pagination .disabled{color:#5a606b !important}
[data-theme="dark"] .footer{color:#8b919e !important;border-color:#2a2e37 !important}

/* 用户中心 */
[data-theme="dark"] .welcome{background:#1a1d24 !important;box-shadow:0 2px 8px rgba(0,0,0,.3) !important}
[data-theme="dark"] .welcome h2{color:#f3f4f6 !important}
[data-theme="dark"] .welcome p{color:#8b919e !important}
[data-theme="dark"] .stat .lbl{color:#8b919e !important}
[data-theme="dark"] .btn-outline{border-color:#3a3f4b !important;background:#23262e !important;color:#e5e7eb !important}
[data-theme="dark"] .btn-outline:hover{border-color:#4d8bff !important;color:#6ea8ff !important}
[data-theme="dark"] .btn-danger{border-color:#5a2a2a !important;background:#23262e !important;color:#f87171 !important}
[data-theme="dark"] .btn-danger:hover{background:#3a1f1f !important}
[data-theme="dark"] .btn-default{background:#3a3f4b !important;color:#e5e7eb !important}
[data-theme="dark"] .notice{background:rgba(59,130,246,.15) !important;color:#93c5fd !important;border-color:rgba(59,130,246,.35) !important}
[data-theme="dark"] .list-card{background:#1a1d24 !important;box-shadow:0 2px 8px rgba(0,0,0,.3) !important}
[data-theme="dark"] .list-row{border-color:#262a33 !important}
[data-theme="dark"] .list-title{color:#f3f4f6 !important}
[data-theme="dark"] .list-title a{color:#f3f4f6 !important}
[data-theme="dark"] .list-meta{color:#8b919e !important}
[data-theme="dark"] .status-published{background:rgba(16,185,129,.18) !important;color:#34d399 !important}
[data-theme="dark"] .status-pending{background:rgba(245,158,11,.18) !important;color:#fbbf24 !important}
[data-theme="dark"] .status-draft{background:rgba(107,114,128,.25) !important;color:#cbd5e1 !important}

/* 文章编辑 / 表单 */
[data-theme="dark"] .card{background:#1a1d24 !important;box-shadow:0 2px 8px rgba(0,0,0,.3) !important}
[data-theme="dark"] .form-group label{color:#c3c9d4 !important}
[data-theme="dark"] .form-group input[type=text],
[data-theme="dark"] .form-group input[type=url],
[data-theme="dark"] .form-group input[type=email],
[data-theme="dark"] .form-group input[type=password],
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea,
[data-theme="dark"] .form-group input{border-color:#3a3f4b !important;background:#23262e !important;color:#e5e7eb !important}
[data-theme="dark"] .form-group input:focus,.form-group select:focus,.form-group textarea:focus{border-color:#4d8bff !important;box-shadow:0 0 0 3px rgba(77,139,255,.18) !important}
[data-theme="dark"] .form-group input:disabled{background:#1a1d24 !important;color:#6b7280 !important}
[data-theme="dark"] .form-group textarea{background:#1a1d24 !important}
[data-theme="dark"] #markdown-editor{background:#1a1d24 !important;color:#e5e7eb !important}
[data-theme="dark"] .tags{border-color:#3a3f4b !important;background:#23262e !important}
[data-theme="dark"] .tag-opt{border-color:#3a3f4b !important;background:#23262e !important;color:#9ca3af !important}
[data-theme="dark"] .tag-opt.on{border-color:#4d8bff !important;background:rgba(59,130,246,.18) !important;color:#93c5fd !important}
[data-theme="dark"] .tabs{border-color:#2a2e37 !important}
[data-theme="dark"] .tab-item{color:#9ca3af !important}
[data-theme="dark"] .tab-item.active{color:#6ea8ff !important;border-color:#4d8bff !important}
[data-theme="dark"] .markdown-body{color:#c3c9d4 !important}
[data-theme="dark"] .markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4,.markdown-body h5,.markdown-body h6{color:#f3f4f6 !important}
[data-theme="dark"] .markdown-body blockquote{background:#161b26 !important;color:#9ca3af !important}
[data-theme="dark"] .actions{border-color:#262a33 !important}
[data-theme="dark"] .alert-error{background:rgba(239,68,68,.15) !important;color:#fca5a5 !important;border-color:rgba(239,68,68,.35) !important}
[data-theme="dark"] .md-toolbar{background:#23262e !important;border-color:#3a3f4b !important}
[data-theme="dark"] .tb-btn{background:#2a2e37 !important;color:#e5e7eb !important}
[data-theme="dark"] .tb-btn:hover{background:rgba(59,130,246,.18) !important;border-color:rgba(59,130,246,.4) !important;color:#93c5fd !important}
[data-theme="dark"] .tb-btn:disabled{opacity:.5}
[data-theme="dark"] .tb-sep{background:#3a3f4b !important}
[data-theme="dark"] .color-panel{background:#1a1d24 !important;border-color:#3a3f4b !important;box-shadow:0 6px 20px rgba(0,0,0,.5) !important}
[data-theme="dark"] .color-dot{box-shadow:0 0 0 1px #3a3f4b !important}
[data-theme="dark"] #markdown-editor.dragover{outline-color:#4d8bff !important;background:rgba(59,130,246,.12) !important}

/* 登录 / 注册 / 设置 */
[data-theme="dark"] .auth-wrap .auth-card{background:#1a1d24 !important;box-shadow:0 2px 12px rgba(0,0,0,.4) !important}
[data-theme="dark"] .auth-title{color:#f3f4f6 !important}
[data-theme="dark"] .auth-sub{color:#8b919e !important}
[data-theme="dark"] .auth-foot{color:#9ca3af !important}
[data-theme="dark"] .auth-error{background:rgba(239,68,68,.15) !important;color:#fca5a5 !important;border-color:rgba(239,68,68,.35) !important}
[data-theme="dark"] .auth-success{background:rgba(34,197,94,.15) !important;color:#86efac !important;border-color:rgba(34,197,94,.35) !important}
[data-theme="dark"] .divider{background:#262a33 !important}
[data-theme="dark"] .divider-txt{color:#9ca3af !important}
[data-theme="dark"] .form-hint{color:#8b919e !important}

/* 搜索高亮（保留亮黄，暗色下仍清晰） */
[data-theme="dark"] .article-excerpt mark,.article-title mark{background:#fde047 !important;color:#1f2937 !important}

/* 主题切换按钮 */
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;border:1px solid #e5e7eb;border-radius:8px;background:#f3f4f6;color:#374151;font-size:16px;cursor:pointer;flex-shrink:0;line-height:1;transition:background .15s,color .15s,border-color .15s}
.theme-toggle:hover{background:#e5e7eb;color:#165DFF;border-color:#165DFF}
[data-theme="dark"] .theme-toggle{background:#23262e !important;color:#e5e7eb !important;border-color:#3a3f4b !important}
[data-theme="dark"] .theme-toggle:hover{background:#2a2e37 !important;color:#6ea8ff !important;border-color:#4d8bff !important}
