:root {
    --bg: #f5f6f8;
    --card: #ffffff;
    --text: #222;
    --muted: #777;
    --primary: #2f6fed;
    --border: #e2e5ea;
}
* { box-sizing: border-box; }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font: 15px/1.6 -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 10px; }
.main { padding: 10px; min-height: calc(100vh - 110px); }

.topbar { background: #1f2533; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 52px; }
.brand { color: #fff; font-size: 18px; font-weight: 700; }
.nav-links a { color: #cfd4e0; margin-left: 16px; font-size: 14px; }
.nav-links a:hover { color: #fff; }
.nav-toggle {
    display: none; width: 38px; height: 34px; padding: 6px 8px;
    border: 1px solid #5a6376; border-radius: 6px; background: none; cursor: pointer;
}
.nav-toggle span {
    display: block; height: 2px; margin: 4px 0; border-radius: 2px;
    background: #e6e9f0; transition: transform .2s, opacity .2s;
}
.nav-toggle.active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.nav-links a.nav-btn {
    display: inline-block; padding: 3px 12px;
    border: 1px solid #5a6376; border-radius: 4px;
    color: #e6e9f0; text-decoration: none;
}
.nav-links a.nav-btn:hover { border-color: #fff; color: #fff; }

.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }

.card {
    background: var(--card); border: 1px solid var(--border); border-radius: 8px;
    padding: 20px 24px; margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 18px; }

.post-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.post-item:last-child { border-bottom: none; }
.post-item > div { flex: 1; min-width: 0; }
.post-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.post-line .title { flex: 1; min-width: 0; }
.badge {
    flex: none; display: inline-block; padding: 1px 6px; border-radius: 4px;
    font-size: 12px; font-weight: 600; line-height: 1.6;
}
.badge-top { color: #2f6fed; background: #eaf2fd; }
.badge-notice { color: #c0392b; background: #fdecea; }
.post-item .title {
    display: block; font-weight: 600; font-size: var(--title-size, 16px);
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.post-item .meta { color: var(--muted); font-size: 13px; }
/* 手机版列表标题固定 16px，字号仅电脑端由后台控制 */
@media (max-width: 768px) {
    .post-item .title { font-size: 16px; }
    .card { padding: 20px 15px; }
    /* 后台帖子列表：手机版隐藏发布时间列 */
    .tbl-fixed .col-time, .tbl-fixed td.time { display: none; }
    /* 手机版导航：汉堡菜单 */
    .topbar .wrap { position: relative; }
    .nav-toggle { display: block; }
    .nav-links {
        display: none; position: absolute; top: 52px; right: 0; z-index: 50;
        min-width: 160px; flex-direction: column; padding: 6px 16px 10px;
        background: #1f2533; border-radius: 0 0 10px 10px;
        box-shadow: 0 10px 24px rgba(0, 0, 0, .25);
    }
    .nav-links.open { display: flex; }
    .nav-links a {
        display: block; margin: 0; padding: 10px 0; font-size: 15px;
        border-bottom: 1px solid rgba(255, 255, 255, .08);
    }
    .nav-links a:last-child { border-bottom: none; }
    .nav-links a.nav-btn { display: inline-block; margin-top: 8px; padding: 5px 14px; }
}
.lock-badge { font-size: 12px; color: #b45309; background: #fef3c7; border-radius: 4px; padding: 2px 8px; }

.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 16px; font-size: 14px; }
.pagination a, .pagination .page-current, .pagination .disabled, .pagination .dots {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 30px; height: 30px; padding: 0 8px;
    border: 1px solid var(--border); border-radius: 6px; background: #fff; color: #444;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.pagination .page-current { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .disabled { color: #c6cbd4; background: #f7f8fa; }
.pagination .dots { border: 0; background: none; color: #999; }

.col-check { width: 36px; }
.tbl-fixed { table-layout: fixed; }
.tbl-fixed .col-id { width: 50px; }
.tbl-fixed .col-board { width: 100px; }
.tbl-fixed .col-time { width: 160px; }
.tbl-fixed .col-actions { width: 120px; }
.tbl-fixed .actions { white-space: nowrap; }
.tbl-fixed .title-ellipsis { max-width: 100%; }
.title-ellipsis { display: flex; align-items: center; gap: 6px; max-width: 420px; overflow: hidden; white-space: nowrap; }
.title-ellipsis .badge { flex-shrink: 0; }
.title-ellipsis a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.batch-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.batch-bar .btn { margin-top: 0; }

.ad-block { margin: 0 0 16px; text-align: center; }
.ad-block img { max-width: 100%; height: auto; }

label { display: block; margin: 12px 0 4px; font-size: 14px; color: #444; }
input[type=text], input[type=password], input[type=datetime-local], input[type=number], textarea, select {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
    font: inherit; background: #fff;
}
textarea { min-height: 220px; resize: vertical; }
.title-input { position: relative; }
.title-input input[type=text] { padding-right: 40px; }
.color-picker { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); }
.color-trigger {
    display: block; width: 22px; height: 22px; padding: 0; cursor: pointer;
    border: 1px solid rgba(0, 0, 0, .2); border-radius: 4px;
}
.color-menu {
    display: none; position: absolute; right: 0; top: calc(100% + 8px); z-index: 20;
    grid-template-columns: repeat(3, 24px); gap: 8px;
    padding: 8px; background: #fff; border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
}
.color-menu.open { display: grid; }
.color-menu label { position: relative; display: inline-flex; margin: 0; }
.color-menu input { position: absolute; opacity: 0; pointer-events: none; }
.color-menu span {
    display: block; width: 24px; height: 24px; border-radius: 4px; cursor: pointer;
    border: 1px solid rgba(0, 0, 0, .15);
}
.color-menu input:checked + span { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--primary); }
.btn {
    display: inline-block; margin-top: 14px; padding: 8px 18px; border: none; border-radius: 6px;
    background: var(--primary); color: #fff; font: inherit; cursor: pointer;
}
.btn:hover { opacity: .9; text-decoration: none; }
.btn-sm { margin: 0; padding: 4px 10px; font-size: 13px; }
.btn-danger { background: #d9534f; }
.btn-ghost { background: #6c757d; }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; font-size: 14px; }
.alert-success { background: #e7f7ec; color: #1a7f37; border: 1px solid #b7ebc6; }
.alert-error   { background: #fdecea; color: #c0392b; border: 1px solid #f5c6c2; }
.alert-info    { background: #eaf2fd; color: #2f6fed; border: 1px solid #c7dbf9; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.tbl th { background: #f0f2f5; font-weight: 600; }
.tbl code { background: #eef1f6; padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.tbl input[type=text], .tbl input[type=number] { width: 100%; padding: 6px 8px; }
.col-board-sort { width: 110px; }
.col-board-count { width: 90px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.page-head h2 { margin: 0; }
.page-head .btn { margin-top: 0; }
.breadcrumb {
    font-size: 14px; color: #777;
    min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.breadcrumb a { color: #777; }
.breadcrumb .sep { margin: 0 6px; color: #b8bdc7; }
.breadcrumb .current { color: #777; }

.post-meta-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 18px; font-size: 14px; }
.post-title { text-align: center; }
.post-nav { display: flex; align-items: center; }
.post-nav a, .post-nav .disabled {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; font-size: 14px;
    border: 0; background: none; color: #777; text-decoration: none;
}
.post-nav a:hover { color: #2f6fed; text-decoration: none; }
.post-nav .disabled { color: #c6cbd4; cursor: default; }

/* 一行式表单（紧凑行内字段） */
.form-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.form-row label { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; color: #444; }
.form-row input[type=number], .form-row input[type=text] { width: 90px; padding: 6px 8px; }
.form-row .btn { margin-top: 0; }

/* 二级菜单（标签页） */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tabs .tab {
    padding: 8px 16px; font-size: 14px; color: #555;
    border: 1px solid transparent; border-bottom: none; border-radius: 6px 6px 0 0;
}
.tabs .tab:hover { text-decoration: none; color: var(--primary); background: #eef3fe; }
.tabs .tab.active {
    background: #fff; border-color: var(--border); color: var(--primary);
    font-weight: 600; margin-bottom: -1px;
}

/* 轻量富文本编辑器 */
.editor {
    border: 1px solid var(--border); border-radius: 10px; background: #fff;
    overflow: hidden; transition: border-color .15s, box-shadow .15s;
}
.editor:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47, 111, 237, .12); }
.editor-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    padding: 8px 10px; background: #f8f9fb; border-bottom: 1px solid var(--border);
}
.tool-group { display: flex; align-items: center; gap: 2px; }
.tool-sep { width: 1px; height: 18px; background: var(--border); margin: 0 2px; }
.editor-toolbar button {
    min-width: 30px; padding: 4px 9px; font-size: 13px; line-height: 1.2;
    background: transparent; border: 1px solid transparent; border-radius: 5px;
    cursor: pointer; color: #333;
}
.editor-toolbar button:hover { background: #fff; border-color: var(--border); color: var(--primary); }
.editor-toolbar button:active { background: #eef3fe; }
.editor-toolbar button:disabled { opacity: .5; cursor: default; }
.editor-toolbar select.editor-size {
    width: auto; height: 26px; padding: 0 6px; font-size: 13px;
    border: 1px solid var(--border); border-radius: 5px; background: #fff; color: #333;
}
.tool-color {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 26px; margin: 0; border: 1px solid transparent; border-radius: 5px; cursor: pointer;
}
.tool-color:hover { background: #fff; border-color: var(--border); }
.tool-color input[type=color] {
    position: absolute; inset: 0; width: 100%; height: 100%;
    padding: 0; border: none; opacity: 0; cursor: pointer;
}
.color-label { font-weight: 700; font-size: 13px; line-height: 1; padding: 0 2px 1px; border-bottom: 3px solid #e74c3c; }
.bg-label { border-bottom: none; border-radius: 3px; padding: 2px 4px; }
.editor-body {
    min-height: 300px; max-height: 60vh; overflow-y: auto;
    padding: 16px 18px; font-size: 15px; line-height: 1.8;
    color: #222; outline: none; word-break: break-word;
}
.editor-body:empty::before { content: attr(data-placeholder); color: #b0b6c0; pointer-events: none; }
.editor-body p { margin: 0 0 10px; }
.editor-body h2 { font-size: 18px; margin: 14px 0 8px; }
.editor-body blockquote {
    margin: 10px 0; padding: 8px 14px; border-left: 3px solid var(--primary);
    background: #f5f8ff; color: #555; border-radius: 0 6px 6px 0;
}
.editor-body ul, .editor-body ol { padding-left: 24px; margin: 8px 0; }
.editor-body a { color: var(--primary); }
.editor-body img { max-width: 100%; }
.editor-body table, .content-body table { border-collapse: collapse; width: 100%; margin: 10px 0; }
.editor-body table td, .content-body table td { border: 1px solid #c9ced8; padding: 6px 10px; min-width: 40px; }
.editor-source {
    display: none; width: 100%; min-height: 300px; border: none; border-radius: 0;
    padding: 14px 16px; font: 13px/1.6 Consolas, Monaco, monospace;
    resize: vertical; outline: none;
}
.editor.source-mode .editor-body { display: none; }
.editor.source-mode .editor-source { display: block; }
.editor.source-mode .editor-toolbar > .tool-group:not(.tool-html-group),
.editor.source-mode .editor-toolbar > .tool-sep { opacity: .4; pointer-events: none; }
.editor-foot {
    display: flex; justify-content: flex-end; padding: 6px 12px;
    border-top: 1px solid var(--border); background: #fafbfc;
}
.editor-count { font-size: 12px; color: var(--muted); }

.content-body { word-break: break-word; }
.content-body p { margin: 8px 0; }
.content-body h2 { font-size: 18px; margin: 16px 0 8px; }
.content-body blockquote { margin: 10px 0; padding: 6px 12px; border-left: 3px solid var(--border); color: #555; background: #fafafa; }
.content-body ul, .content-body ol { padding-left: 24px; }
.content-body img { max-width: 100%; }
.muted { color: var(--muted); font-size: 13px; }
.inline-form { display: inline; }
.actions form { display: inline; margin-left: 4px; }
