/* ===== 资源站 通用样式 ===== */
:root {
    --primary: #2f6bff;
    --primary-dark: #1f4fd0;
    --bg: #f5f7fb;
    --card: #ffffff;
    --text: #1f2430;
    --muted: #7a8296;
    --line: #e6eaf2;
    --danger: #e5484d;
    --ok: #16a34a;
    --warn: #f59e0b;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(20, 30, 60, .06), 0 6px 20px rgba(20, 30, 60, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }

/* 按钮 */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    padding: 7px 14px; border: 1px solid var(--line); border-radius: 8px;
    background: #fff; color: var(--text); cursor: pointer; white-space: nowrap;
    transition: .15s;
}
.btn:hover { border-color: #c9d4ec; background: #fafbff; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.danger { color: var(--danger); border-color: #f6c9cb; }
.btn.danger:hover { background: #fff5f5; }
.btn.sm { padding: 4px 9px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 表单 */
input[type=text], input[type=password], input[type=number], select, textarea {
    padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47, 107, 255, .12); }
label { font-size: 13px; color: var(--muted); }

/* ===== 顶部 ===== */
.top {
    position: sticky; top: 0; z-index: 30; background: #fff; border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: center; gap: 16px; padding: 10px 18px; flex-wrap: wrap;
}
.brand { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
.searchbar { flex: 0 1 760px; display: flex; gap: 8px; min-width: 240px; max-width: 760px; }
.searchbar input { flex: 1; min-width: 0; border-radius: 8px; height: 42px; font-size: 15px; padding: 0 14px; }
.searchbar .btn { flex: 0 0 auto; height: 42px; font-size: 15px; padding: 0 20px; }
.badge.best { background: #fff4e5; color: #b45309; border: 1px solid #fcd9a8; }
.heat { color: #e8590c; font-size: 12px; }
.top-links { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }
.notice {
    background: linear-gradient(90deg, #eef3ff, #f7f9ff); border-bottom: 1px solid var(--line);
    padding: 8px 18px; font-size: 13px; color: #41506e;
}
.notice:empty { display: none; }

/* ===== 布局 ===== */
.layout { display: flex; max-width: 1400px; margin: 0 auto; gap: 16px; padding: 16px; align-items: flex-start; }
.sidebar {
    width: 260px; flex: 0 0 260px; background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 10px; max-height: calc(100vh - 130px);
    display: flex; flex-direction: column; box-shadow: var(--shadow);
}
#tree { flex: 1 1 auto; overflow: auto; min-height: 0; }
#findBtn { display: none; }
.content { flex: 1; min-width: 0; }
.tree-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--card); padding-bottom: 8px; margin-bottom: 2px; }
.tree-close { display: none; }
.backdrop { display: none; }

/* ===== 分类树 ===== */
.tree-title { font-size: 12px; color: var(--muted); padding: 4px 8px 8px; letter-spacing: 1px; }
.tn { user-select: none; }
.tn-row {
    display: flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 7px; cursor: pointer;
    font-size: 13px; line-height: 1.4;
}
.tn-row:hover { background: #f2f5fd; }
.tn-row.active { background: #e8efff; color: var(--primary-dark); font-weight: 600; }
.tn-arrow { width: 14px; text-align: center; color: var(--muted); font-size: 10px; flex: 0 0 14px; transition: .15s; }
.tn-arrow.open { transform: rotate(90deg); }
.tn-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tn-cnt { color: var(--muted); font-size: 11px; }
.tn-sort { color: #f59e0b; font-size: 11px; margin-left: 2px; font-weight: 600; }
.dsr-row { display: flex; gap: 10px; padding: 6px 8px; border-bottom: 1px solid var(--line); font-size: 13px; }
.dsr-row span:first-child { color: var(--muted); min-width: 48px; }
.dsr-row.ok { color: #16a34a; }
.dsr-row.bad { color: #ef4444; }
.dsr-row.muted { color: var(--muted); }
.tn-children { margin-left: 12px; border-left: 1px dashed var(--line); padding-left: 4px; }

/* ===== 工具栏 ===== */
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumb b { color: var(--text); }
.bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--card);
    border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.bar .grow { flex: 1; }
.tagchips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
    padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff;
    font-size: 12px; color: #55607a; cursor: pointer;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ===== 资源列表 ===== */
.list { display: flex; flex-direction: column; gap: 10px; }
.item {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 12px 14px; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: flex-start;
}
.item .main { flex: 1; min-width: 0; }
.item .title { font-size: 15px; font-weight: 600; line-height: 1.5; word-break: break-all; }
.item .meta { margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); }
.item .ops { display: flex; flex-direction: row; gap: 6px; flex: 0 0 auto; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.badge { padding: 2px 8px; border-radius: 6px; font-size: 12px; background: #eef2fb; color: #46536e; }
.badge.qk { background: #e8f1ff; color: #1f63d6; }
.badge.bd { background: #eaf5ee; color: #128a45; }
.badge.ali { background: #fff2e6; color: #c2620a; }
.badge.xl { background: #e2f7f7; color: #0e8c8c; }
.badge.p3 { background: #fdeaea; color: #c0392b; }
.badge.lz { background: #e9edfd; color: #3b5bdb; }
.badge.yd { background: #efeafb; color: #6741c4; }
.badge.oth { background: #f1f2f5; color: #5a6478; }
.code { font-family: ui-monospace, Consolas, monospace; background: #f4f6fb; padding: 1px 6px; border-radius: 5px; }
.tag { color: #6a5acd; background: #f3f0ff; padding: 1px 7px; border-radius: 5px; }
mark { background: #ffe9a8; color: inherit; padding: 0 1px; border-radius: 2px; }
.dead { opacity: .6; }
.dead .title { text-decoration: line-through; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }
.blocked-tip { background: #fff6f6; border: 1px solid #f6c9cb; color: #a33; padding: 14px; border-radius: var(--radius); }

.pager { display: flex; gap: 6px; justify-content: center; align-items: center; padding: 18px 0; flex-wrap: wrap; }
.pager .btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== 页脚 ===== */
.foot { max-width: 1400px; margin: 0 auto; padding: 18px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.foot .box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }

/* ===== 后台 ===== */
.admin-wrap { max-width: 1280px; margin: 0 auto; padding: 16px; }
.admin-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.admin-head h1 { font-size: 18px; margin: 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.tabs .btn { border-color: transparent; background: transparent; }
.tabs .btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.panel { display: none; }
.panel.active { display: block; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 10px; font-size: 15px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.stat .n { font-size: 22px; font-weight: 700; }
.stat .l { font-size: 12px; color: var(--muted); }
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tb th, table.tb td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.tb th { color: var(--muted); font-weight: 600; background: #fafbfe; position: sticky; top: 0; }
table.tb tr:hover td { background: #fbfcff; }
.tb-wrap { max-height: 60vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.row-flex { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row-flex > * { flex: 0 0 auto; }
.grow-input { flex: 1 1 220px !important; min-width: 160px; }
.login-box { max-width: 360px; margin: 12vh auto; }
.muted { color: var(--muted); font-size: 12px; }
.nowrap { white-space: nowrap; }
.sel-node { max-width: 260px; }
.toast {
    position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
    background: rgba(28, 33, 46, .92); color: #fff; padding: 9px 18px; border-radius: 8px; z-index: 999; font-size: 13px;
}
.hidden { display: none !important; }

/* ===== 移动端 ===== */
.menu-btn { display: none; }
@media (max-width: 860px) {
    .layout { padding: 10px; gap: 10px; }
    .sidebar {
        position: fixed; left: 0; top: 0; bottom: 0; z-index: 60; width: 78vw; max-width: 300px;
        border-radius: 0; max-height: none; transform: translateX(-100%); transition: .2s;
    }
    .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0, 0, 0, .2); }
    .menu-btn { display: inline-flex; }
    .tree-close { display: inline-flex; }
    .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 55; }
    .tn-children { margin-left: 8px; padding-left: 4px; }
    .item { flex-direction: column; }
    .item .ops { flex-direction: row; width: 100%; }
    .item .ops .btn { flex: 1; }
    .searchbar { order: 3; width: 100%; max-width: none; }
    .tb-wrap { max-height: 52vh; }
}
.item .meta .extra { background: #eef2ff; color: #4f46e5; border-radius: 6px; padding: 1px 6px; margin-left: 6px; font-size: 12px; }
.tb td b { color: #4f46e5; cursor: help; }

/* ===== 留言板 ===== */
.board { max-width: 1400px; margin: 0 auto; padding: 16px; }
.board-title { font-size: 18px; margin: 4px 0; }
.board-form { align-items: stretch; margin: 12px 0; }
.board-form textarea { resize: vertical; min-height: 44px; }
.msg-list { display: flex; flex-direction: column; gap: 12px; }
.msg { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.msg.del { opacity: .55; }
.msg-head { font-size: 13px; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.msg-head b { font-size: 14px; }
.msg-body { font-size: 14px; line-height: 1.7; word-break: break-word; white-space: pre-wrap; }
.replies { margin-top: 10px; border-left: 3px solid var(--line); padding-left: 12px; display: flex; flex-direction: column; gap: 10px; }
.reply { background: #f8faff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.reply.del { opacity: .55; }
.quote { font-size: 12px; color: var(--muted); margin-bottom: 4px; background: #fff; border: 1px dashed var(--line); border-radius: 6px; padding: 4px 8px; word-break: break-word; }
.reply-body { font-size: 14px; line-height: 1.7; word-break: break-word; white-space: pre-wrap; }
.admin-tag { color: #fff; background: var(--primary); border-radius: 6px; padding: 1px 7px; font-size: 12px; font-weight: 600; margin-right: 4px; }
.tag.danger { color: #fff; background: var(--danger); }
@media (max-width: 860px) {
    .board-form { flex-direction: column; }
    .board-form textarea { width: 100% !important; }
    .board-form input { width: 100% !important; flex: 1 1 auto !important; }
}
