/* ========== 基础重置 & 变量 ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #f8f9fa;
    --surface:   #ffffff;
    --text:      #2c3e50;
    --text-dim:  #6c757d;
    --border:    #dee2e6;
    --primary:   #3498db;
    --primary-h: #2980b9;
    --danger:    #e74c3c;
    --danger-h:  #c0392b;
    --success:   #27ae60;
    --warning:   #f39c12;
    --radius:    8px;
    --shadow:    0 2px 8px rgba(0,0,0,.08);
    /* 浅色主题语义色 */
    --code-bg:        #f0f0f0;
    --code-color:     #d63384;
    --blockquote-bg:  #f0f7ff;
    --blockquote-c:   #4a6f8c;
    --stripe-bg:      #f8f9fa;
    --hover-bg:       #e9ecef;
    --badge-bg:       #e8f4fd;
    --badge-c:        #2980b9;
    --vote-bg:        #f8f9fa;
    --vote-like-bg:   #eafaf1;
    --vote-dislike-bg:#fdedec;
    --toolbar-bg:     #f1f3f5;
    --toc-active-bg:  #eef6ff;
    --divider:        #f0f0f0;
    --mark-bg:        #fff3a8;
}

/* ========== 暗色主题 ========== */
[data-theme="dark"] {
    --bg:        #1a1a2e;
    --surface:   #16213e;
    --text:      #e0e0e0;
    --text-dim:  #9e9eae;
    --border:    #2a2a4a;
    --primary:   #5dade2;
    --primary-h: #85c1e9;
    --shadow:    0 2px 12px rgba(0,0,0,.35);
    /* 暗色语义色 */
    --code-bg:        #2a2a3e;
    --code-color:     #f48fb1;
    --blockquote-bg:  #1a2740;
    --blockquote-c:   #90b8d4;
    --stripe-bg:      #1c2840;
    --hover-bg:       #243050;
    --badge-bg:       #1a3050;
    --badge-c:        #85c1e9;
    --vote-bg:        #1c2840;
    --vote-like-bg:   #1a3028;
    --vote-dislike-bg:#301c20;
    --toolbar-bg:     #1c2840;
    --toc-active-bg:  #1a3050;
    --divider:        #2a2a4a;
    --mark-bg:        #5a5020;
    /* 暗色下调整特定元素 */
    color-scheme: dark;
}

/* 暗色下 input/textarea/select 适配 */
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background: #1c2840;
    color: var(--text);
    border-color: var(--border);
}
[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus {
    box-shadow: 0 0 0 3px rgba(93,173,226,.2);
}

/* 暗色下块引用 */
[data-theme="dark"] .post-content blockquote {
    background: var(--blockquote-bg);
    color: var(--blockquote-c);
}

/* 暗色下导航栏 */
[data-theme="dark"] .navbar {
    background: #0f1a2e;
    border-bottom-color: var(--border);
}

/* 暗色下页脚 */
[data-theme="dark"] .footer {
    background: #0f1a2e;
    border-top-color: var(--border);
}

/* 暗色下 Hero 遮罩加深 */
[data-theme="dark"] .hero-has-bg::before {
    background: rgba(0,0,0,.65);
}

/* 暗色下表格头不变（本来就是深色） */
[data-theme="dark"] .admin-table tr:hover td {
    background: var(--hover-bg);
}

/* 暗色下弹窗 */
[data-theme="dark"] .modal-overlay {
    background: rgba(0,0,0,.7);
}

/* 暗色下切换按钮 */
.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
    margin-left: 12px;
    transition: all .2s;
}
.theme-toggle:hover {
    background: var(--hover-bg);
}

/* 暗色下 Alert 降低饱和度 */
[data-theme="dark"] .alert-success { background: #1a3a28; color: #8fd4a0; border-color: #2a5a38; }
[data-theme="dark"] .alert-error   { background: #3a1a20; color: #f09098; border-color: #5a2a30; }
[data-theme="dark"] .alert-warning { background: #3a3010; color: #e0c860; border-color: #5a4a20; }
[data-theme="dark"] .alert-info    { background: #102a38; color: #80c8e0; border-color: #204a58; }

/* 暗色下 drag-over 上传高亮 */
[data-theme="dark"] #content.drag-over {
    background: #1a3050 !important;
    border-color: var(--primary) !important;
}

/* 暗色下 logo 占位区 */
[data-theme="dark"] .logo-preview {
    background: var(--bg);
    border-color: var(--border);
}

/* 暗色下 nav-search 输入框 */
[data-theme="dark"] .nav-search input {
    background: #1c2840;
}

body {
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-h); }

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========== 导航栏 ========== */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}
.brand {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text) !important;
    display: flex;
    align-items: center;
    gap: 10px;
}
.nav-logo {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: contain;
}
.nav-links a {
    margin-left: 22px;
    font-size: 0.95rem;
    color: var(--text-dim);
}
.nav-links a:hover { color: var(--primary); }

/* ========== 主内容区 ========== */
main { flex: 1 1 auto; padding: 32px 0 48px; margin-top: 5px; }

/* ========== 首页双栏 ========== */
.home-layout {
    display: flex;
    gap: 28px;
    align-items: flex-start;
}
.home-main { flex: 1; min-width: 0; }
.home-sidebar { flex: 0 0 260px; }

.section-title {
    font-size: 1.15rem;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
}

.sidebar-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.sidebar-card h3 {
    font-size: 0.95rem;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.sidebar-list { list-style: none; padding: 0; margin: 0; }
.sidebar-list li {
    padding: 7px 0;
    border-bottom: 1px solid var(--divider);
    font-size: 0.88rem;
}
.sidebar-list li:last-child { border-bottom: none; }
.sidebar-list a {
    color: var(--text);
    transition: color .15s;
}
.sidebar-list a:hover { color: var(--primary); }
.sidebar-views {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-left: 6px;
}
.sidebar-empty {
    color: var(--text-dim);
    font-size: 0.85rem;
}

/* 窄屏回退 */
@media (max-width: 768px) {
    .home-layout { flex-direction: column; }
    .home-sidebar { flex: 1; width: 100%; }
}

/* ========== Hero ========== */
.hero {
    text-align: center;
    padding: 48px 20px 32px;
    position: relative;
    overflow: hidden;
    margin: 5px 0;
}
.hero-has-bg {
    padding: 80px 20px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: var(--radius);
    margin-bottom: 8px;
}
.hero-has-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    border-radius: inherit;
}
.hero-inner {
    position: relative;
    z-index: 1;
}
.hero-has-bg .hero-inner h1,
.hero-has-bg .hero-inner p { color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.5); }
.hero h1 { font-size: 2rem; margin-bottom: 8px; }
.hero p  { color: var(--text-dim); font-size: 1.1rem; }
.hero-has-bg .hero-inner p { color: rgba(255,255,255,.85); }

/* ========== 文章卡片 ========== */
.post-list { margin-bottom: 24px; }
.post-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 28px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    transition: transform .15s;
}
.post-card:hover { transform: translateY(-2px); }
.post-card.has-thumb {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}
.post-thumb {
    flex: 0 0 200px;
    height: 130px;
    overflow: hidden;
    border-radius: 6px;
    display: block;
}
.post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}
.post-thumb:hover img {
    transform: scale(1.05);
}
.post-body { flex: 1; min-width: 0; }
.post-card h2 { font-size: 1.25rem; margin-bottom: 6px; }
.post-card h2 a { color: var(--text); }
.post-card h2 a:hover { color: var(--primary); }
.post-meta {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    align-items: center;
}
.post-stats {
    display: flex;
    gap: 8px;
}
.stat-like   { color: #27ae60; }
.stat-dislike { color: #e74c3c; }

/* ========== 分类标签 ========== */
.cat-badge {
    display: inline-block;
    padding: 1px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--badge-bg);
    color: var(--badge-c) !important;
    transition: background .15s;
}
.cat-badge:hover { background: var(--primary); color: #fff !important; }

/* 文章标签 */
.post-tags {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.tag-badge {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 14px;
    font-size: 0.78rem;
    font-weight: 500;
    background: #f0f0f0;
    color: #666 !important;
    transition: all .15s;
}
.tag-badge:hover {
    background: var(--primary);
    color: #fff !important;
}
[data-theme="dark"] .tag-badge {
    background: #2a2a4a;
    color: #b0b0c0 !important;
}
[data-theme="dark"] .tag-badge:hover {
    background: var(--primary);
    color: #fff !important;
}

/* 标签云 */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    line-height: 1.8;
}
.tag-item {
    display: inline-block;
    color: var(--text-dim) !important;
    transition: color .15s;
    white-space: nowrap;
}
.tag-item:hover {
    color: var(--primary) !important;
}
.tag-item sup {
    font-size: 0.7em;
    color: var(--text-dim);
    margin-left: 1px;
}

.cat-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--bg);
    cursor: pointer;
}
.cat-select:focus { outline: none; border-color: var(--primary); }
.post-summary {
    color: var(--text-dim);
    line-height: 1.6;
    margin-bottom: 10px;
}
.read-more {
    font-size: 0.9rem;
    font-weight: 600;
}

/* ========== 文章详情 ========== */
/* 双栏布局（正文 + TOC） */
.post-layout {
    display: flex;
    gap: 28px;
    align-items: flex-start;
}
.post-layout .post-detail {
    flex: 1;
    min-width: 0;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 36px 32px;
}
/* 无 TOC 时保持原单栏样式 */
.post-layout:not(.has-toc) .post-detail {
    max-width: 100%;
}

.post-header { border-bottom: 2px solid var(--border); padding-bottom: 16px; margin-bottom: 24px; }
.post-header h1 { font-size: 1.8rem; margin-bottom: 8px; }
.post-content { font-size: 1.05rem; }
.post-content p { margin-bottom: 1.2em; }
.post-image {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 20px auto;
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0,0,0,.10);
}

/* Markdown 完整渲染样式 */
/* 标题 */
.post-content h1 { font-size: 1.8rem; margin: 1.5em 0 0.6em; padding-bottom: 8px; border-bottom: 2px solid var(--border); }
.post-content h2 { font-size: 1.5rem; margin: 1.4em 0 0.5em; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.post-content h3 { font-size: 1.25rem; margin: 1.3em 0 0.5em; }
.post-content h4 { font-size: 1.1rem; margin: 1.2em 0 0.4em; }
.post-content h5, .post-content h6 { font-size: 1rem; margin: 1em 0 0.4em; }

/* 列表 */
.post-content ul, .post-content ol {
    margin: 0.8em 0 1.2em;
    padding-left: 2em;
}
.post-content li { margin-bottom: 0.25em; line-height: 1.7; }
.post-content ul ul, .post-content ol ol,
.post-content ul ol, .post-content ol ul {
    margin: 0.3em 0;
}

/* 代码块 */
.post-content pre {
    background: #282c34;
    color: #abb2bf;
    padding: 16px 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.88rem;
    line-height: 1.6;
    margin: 1.2em 0;
    tab-size: 4;
}
.post-content pre code {
    background: none;
    padding: 0;
    font-size: inherit;
    color: inherit;
    border-radius: 0;
}
/* 代码块语言标签（可选增强） */
.post-content pre code[class*="language-"] {
    display: block;
}
.post-content code {
    background: var(--code-bg);
    color: var(--code-color);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: "Cascadia Code", "Fira Code", "JetBrains Mono", "Consolas", monospace;
}

/* 引用块 */
.post-content blockquote {
    margin: 1.2em 0;
    padding: 12px 20px;
    border-left: 4px solid var(--primary);
    background: var(--blockquote-bg);
    border-radius: 0 6px 6px 0;
    color: var(--blockquote-c);
}
.post-content blockquote p:last-child { margin-bottom: 0; }

/* 表格 */
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.2em 0;
    font-size: 0.92rem;
}
.post-content th, .post-content td {
    border: 1px solid var(--border);
    padding: 10px 14px;
    text-align: left;
}
.post-content th {
    background: #2c3e50;
    color: #fff;
    font-weight: 600;
}
.post-content tr:nth-child(even) td {
    background: var(--stripe-bg);
}

/* 水平分隔线 */
.post-content hr {
    border: none;
    border-top: 2px solid var(--border);
    margin: 2em 0;
}

/* 正文链接 */
.post-content a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.post-content a:hover {
    color: var(--primary-h);
}

/* 图片（通用） */
.post-content img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 20px auto;
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0,0,0,.10);
}

/* 任务列表 */
.post-content input[type="checkbox"] {
    margin-right: 6px;
    cursor: default;
}
.post-actions { margin-top: 16px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ========== 文章目录 TOC ========== */
.post-toc {
    flex: 0 0 240px;
    position: sticky;
    top: 72px;  /* 导航栏高度 + 间距 */
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}
.toc-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
}
.toc-title {
    font-size: 0.95rem;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.toc-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.toc-nav li {
    padding: 4px 0;
    font-size: 0.85rem;
    line-height: 1.5;
    border-left: 2px solid transparent;
    padding-left: 10px;
    transition: all .15s;
}
/* 嵌套层级缩进 */
.toc-nav li ul {
    padding-left: 12px;
}
.toc-nav li ul li {
    font-size: 0.8rem;
}
/* 当前活跃项 */
.toc-nav li:has(.toc-active),
.toc-nav .toc-active {
    border-left-color: var(--primary);
    background: var(--toc-active-bg);
    border-radius: 0 4px 4px 0;
}
.toc-nav a {
    color: var(--text-dim);
    text-decoration: none;
    display: block;
    transition: color .15s;
}
.toc-nav a:hover {
    color: var(--primary);
}
.toc-nav a.toc-active {
    color: var(--primary);
    font-weight: 600;
}

/* TOC 滚动条 */
.post-toc::-webkit-scrollbar { width: 4px; }
.post-toc::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* 窄屏：隐藏 TOC */
@media (max-width: 900px) {
    .post-layout {
        flex-direction: column;
    }
    .post-toc {
        flex: 1;
        position: static;
        max-height: none;
        width: 100%;
    }
}

/* ========== 评价区 ========== */
.post-vote {
    margin-top: 32px;
    padding: 20px 24px;
    background: var(--vote-bg);
    border-radius: var(--radius);
    text-align: center;
}
.vote-info { margin-bottom: 12px; }
.vote-notice { font-size: 0.95rem; color: var(--text-dim); }
.vote-buttons { display: flex; gap: 16px; justify-content: center; }
.vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 28px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 1rem;
    cursor: pointer;
    transition: all .2s;
    user-select: none;
}
.vote-btn:disabled { cursor: not-allowed; opacity: 0.7; }
.vote-btn:not(:disabled):hover { transform: translateY(-2px); }
.vote-like:not(:disabled):hover, .vote-like.voted {
    border-color: var(--success);
    background: var(--vote-like-bg);
    color: var(--success);
}
.vote-dislike:not(:disabled):hover, .vote-dislike.voted {
    border-color: var(--danger);
    background: var(--vote-dislike-bg);
    color: var(--danger);
}

/* ========== 按钮 ========== */
.btn {
    display: inline-block;
    padding: 8px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all .15s;
}
.btn:hover { background: var(--hover-bg); color: var(--text); }
.btn-primary { background: var(--primary); color: #fff !important; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-h); }
.btn-danger  { background: var(--danger); color: #fff !important; border-color: var(--danger); }
.btn-danger:hover  { background: var(--danger-h); }
.btn-sm { padding: 4px 12px; font-size: 0.82rem; }
.btn-export { background: var(--success); color: #fff !important; border-color: var(--success); }
.btn-export:hover { background: #219a52; color: #fff !important; }
.btn-block { display: block; width: 100%; padding: 10px; font-size: 1rem; }

/* ========== 表单 ========== */
.login-box {
    max-width: 520px;
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
}
.login-box h2 { margin-bottom: 20px; text-align: center; }

.edit-page {
    width: 100%;
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 36px;
    box-shadow: var(--shadow);
}
.edit-page h1 { margin-bottom: 20px; }

.edit-page textarea {
    font-size: 1rem;
    line-height: 1.8;
    min-height: 400px;
}

.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 0.9rem; }
.required { color: var(--danger); }

input[type="text"],
input[type="password"],
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color .15s;
    background: var(--bg);
}
input:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(52,152,219,.15); }

.form-check label { font-weight: 400; cursor: pointer; }
.form-check input { margin-right: 6px; }

.form-actions { display: flex; gap: 12px; margin-top: 24px; }

/* ========== 编辑页统计 ========== */
.stats-fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 18px;
}
.stats-fieldset legend {
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0 8px;
    color: var(--text-dim);
}
.stats-row { display: flex; gap: 16px; }
.stats-item { flex: 1; }
.stats-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    text-align: center;
    transition: border-color .15s;
    background: var(--bg);
}
.stats-input:focus { outline: none; border-color: var(--primary); }

.login-hint { text-align: center; margin-top: 18px; font-size: 0.9rem; }

/* ========== 验证码 ========== */
.captcha-row {
    display: flex;
    gap: 12px;
    align-items: center;
}
.captcha-input {
    flex: 1;
    font-size: 1.1rem !important;
    letter-spacing: 4px;
    text-transform: uppercase;
    font-weight: 700;
}
.captcha-img {
    height: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color .15s;
}
.captcha-img:hover {
    border-color: var(--primary);
}
.captcha-hint {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 4px;
    display: inline-block;
}

/* ========== 图片上传工具栏 ========== */
.upload-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding: 8px 12px;
    background: var(--toolbar-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
}
.upload-hint {
    font-size: 0.82rem;
    color: var(--text-dim);
}
.upload-hint code {
    background: var(--hover-bg);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.8rem;
}
.upload-status { font-size: 0.82rem; margin-left: auto; }
.upload-status.uploading { color: var(--primary); }
.upload-status.success   { color: var(--success); }
.upload-status.error     { color: var(--danger); }

/* 拖拽上传高亮 */
#content.drag-over {
    border-color: var(--primary) !important;
    background: #eef6ff !important;
    box-shadow: 0 0 0 3px rgba(52,152,219,.25) !important;
}

/* ========== LOGO 设置 ========== */
.logo-section {
    display: flex;
    align-items: center;
    gap: 20px;
}
.logo-preview {
    width: 80px;
    height: 80px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--bg);
}
.logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.logo-placeholder {
    font-size: 0.78rem;
    color: var(--text-dim);
    text-align: center;
    padding: 4px;
}
.logo-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ========== Hero 背景图预览 ========== */
.hero-bg-preview {
    width: 100%;
    height: 120px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hero-bg-placeholder {
    color: var(--text-dim);
    font-size: 0.85rem;
}

/* ========== 弹窗 ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.modal-box {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 28px 32px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0,0,0,.20);
}
.modal-box h3 { margin-bottom: 8px; }

/* ========== 后台仪表盘 ========== */
.dash-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.dash-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 18px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform .15s;
}
.dash-card:hover { transform: translateY(-2px); }
.dash-num {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}
.dash-num small {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-dim);
}
.dash-label {
    font-size: 0.82rem;
    color: var(--text-dim);
    margin-top: 6px;
}

/* 双列面板 */
.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 8px;
}
.dash-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
}
.dash-panel h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.dash-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.dash-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 7px 0;
    border-bottom: 1px solid var(--divider);
    font-size: 0.9rem;
    gap: 10px;
}
.dash-list li:last-child { border-bottom: none; }
.dash-list a {
    color: var(--text);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dash-list a:hover { color: var(--primary); }
.dash-meta {
    font-size: 0.78rem;
    color: var(--text-dim);
    white-space: nowrap;
    display: flex;
    gap: 8px;
    align-items: center;
}
.dim { color: var(--text-dim); font-size: 0.85rem; }

@media (max-width: 640px) {
    .dash-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .dash-grid {
        grid-template-columns: 1fr;
    }
    .dash-num { font-size: 1.5rem; }
}

/* ========== 管理表格 ========== */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.admin-header h1 { font-size: 1.6rem; }

.admin-search {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    align-items: center;
}
.admin-search .search-input {
    flex: 1;
    max-width: 420px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: var(--surface);
    color: var(--text);
}
.admin-search .search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(52,152,219,.15); }
.admin-search .search-input::placeholder { color: var(--text-dim); }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.admin-table th {
    background: #2c3e50;
    color: #fff;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
}
.admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #f1f3f5; }

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
}
.badge-pub   { background: #d4edda; color: #155724; }
.badge-draft { background: #fff3cd; color: #856404; }

.actions { display: flex; gap: 8px; }
.actions form { display: inline; }

/* ========== 分页 ========== */
.pagination {
    text-align: center;
    padding: 20px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}
.page-info { color: var(--text-dim); font-size: 0.9rem; }

/* ========== 排序栏 ========== */
.sort-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.sort-label { font-size: 0.9rem; color: var(--text-dim); }
.sort-btn {
    padding: 5px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-dim);
    transition: all .15s;
}
.sort-btn:hover { border-color: var(--primary); color: var(--primary); }
.sort-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ========== 提示 ========== */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius);
    margin: 16px 0;
    font-size: 0.9rem;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ========== 空状态 ========== */
.empty, .center { text-align: center; padding: 48px 0; color: var(--text-dim); }
.empty p { font-size: 1.1rem; }

/* ========== 页脚 ========== */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 20px;
    color: var(--text-dim);
    font-size: 0.85rem;
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
    .post-card, .post-layout .post-detail { padding: 18px; }
    .post-card.has-thumb { flex-direction: column; }
    .post-thumb { flex: 0 0 auto; height: 160px; width: 100%; }
    .admin-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .admin-table { font-size: 0.82rem; }
    .admin-table th, .admin-table td { padding: 8px 10px; }
    .hero h1 { font-size: 1.5rem; }
}

/* ========== 搜索 ========== */
/* 导航栏搜索框 */
.nav-search {
    margin-left: 18px;
    display: flex;
    align-items: center;
}
.nav-search input {
    width: 160px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.85rem;
    font-family: inherit;
    background: var(--bg);
    transition: all .2s;
    outline: none;
}
.nav-search input:focus {
    width: 200px;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(52,152,219,.15);
}
.nav-search input::placeholder {
    color: #adb5bd;
}

/* 搜索结果页 */
.search-header {
    text-align: center;
    margin-bottom: 20px;
}
.search-header h1 {
    font-size: 1.5rem;
    margin-bottom: 16px;
}
.search-bar {
    display: flex;
    gap: 10px;
    max-width: 520px;
    margin: 0 auto;
}
.search-bar input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1.05rem;
    font-family: inherit;
    background: var(--surface);
    transition: border-color .2s;
    outline: none;
}
.search-bar input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(52,152,219,.15);
}
.search-bar .btn {
    padding: 12px 28px;
    font-size: 1rem;
}

.search-info {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.95rem;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

/* 搜索关键词高亮 */
mark {
    background: var(--mark-bg);
    color: inherit;
    padding: 1px 4px;
    border-radius: 3px;
}
.search-snippet {
    color: var(--text-dim);
    line-height: 1.65;
    font-size: 0.9rem;
}
.search-snippet mark {
    background: var(--mark-bg);
    filter: brightness(0.85);
}

/* ========== 网站地图页 ========== */
.sitemap-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.sitemap-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 28px;
    box-shadow: var(--shadow);
}
.sitemap-card h3 {
    font-size: 1.05rem;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.sitemap-card .count {
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--text-dim);
}
.sitemap-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sitemap-card li {
    padding: 6px 0;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--divider);
}
.sitemap-card li:last-child {
    border-bottom: none;
}
.sitemap-card a {
    color: var(--text);
    transition: color .15s;
}
.sitemap-card a:hover {
    color: var(--primary);
}
.sitemap-post-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px 12px;
}
.sitemap-post-list .meta {
    font-size: 0.78rem;
    color: var(--text-dim);
    white-space: nowrap;
    display: flex;
    gap: 10px;
    align-items: center;
}
.sitemap-posts {
    grid-column: 1 / -1;  /* 文章列表跨两列 */
}
.dim {
    color: var(--text-dim);
    font-size: 0.85rem;
}

@media (max-width: 640px) {
    .sitemap-grid {
        grid-template-columns: 1fr;
    }
    .sitemap-posts {
        grid-column: 1;
    }
    .sitemap-post-list .meta {
        font-size: 0.72rem;
        gap: 6px;
    }
}

/* 窄屏搜索适配 */
@media (max-width: 768px) {
    .nav-search {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
    }
    .nav-search input {
        width: 100%;
    }
    .nav-search input:focus {
        width: 100%;
    }
    .nav-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 10px 0;
    }
}
