/* =============================================================
   BDA共享资料库 · 全站样式（v2.0.0）
   说明：
   1. 本文件是全站唯一的自定义样式入口，页面内不再写 <style>；
   2. 颜色、圆角、阴影、间距统一走 CSS 变量，深色模式只覆盖变量；
   3. 命名沿用原站（#sidebar / #main-content / .side-link 等），避免模板大改。
   ============================================================= */

/* ---------- 1. 设计令牌 ---------- */
:root {
    --bg: #f6f8fa;
    --surface: #ffffff;
    --surface-2: #eef1f4;
    --surface-3: #e4e9ee;

    --text: #1f2328;
    --text-2: #59636e;
    --text-3: #6b7480;

    --border: #d8dee4;
    --border-strong: #b8c2cc;

    --accent: #0969da;
    --accent-hover: #0757b8;
    --accent-soft: rgba(9, 105, 218, 0.09);

    --success: #1a7f37;
    --success-soft: rgba(26, 127, 55, 0.1);
    --warning: #9a6700;
    --warning-soft: rgba(154, 103, 0, 0.12);
    --danger: #cf222e;
    --danger-soft: rgba(207, 34, 46, 0.1);
    --info: #0969da;

    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;

    --shadow-sm: 0 1px 2px rgba(31, 35, 40, 0.06);
    --shadow: 0 4px 14px rgba(31, 35, 40, 0.08);
    --shadow-lg: 0 16px 40px rgba(31, 35, 40, 0.14);

    --ring: 0 0 0 3px var(--accent-soft);

    --sidebar-w: 216px;
    --topbar-h: 60px;
    --bottom-bar-h: 58px;
    --shell-max: 1360px;
    --shell-pad: 32px;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC",
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

[data-bs-theme="dark"] {
    --bg: #0d1117;
    --surface: #151b23;
    --surface-2: #1c2430;
    --surface-3: #242e3a;

    --text: #e6edf3;
    --text-2: #9ba7b4;
    --text-3: #7d8896;

    --border: #2d3742;
    --border-strong: #434f5d;

    --accent: #4493f8;
    --accent-hover: #6aa9ff;
    --accent-soft: rgba(68, 147, 248, 0.15);

    --success: #3fb950;
    --success-soft: rgba(63, 185, 80, 0.14);
    --warning: #d29922;
    --warning-soft: rgba(210, 153, 34, 0.15);
    --danger: #f85149;
    --danger-soft: rgba(248, 81, 73, 0.14);
    --info: #4493f8;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.55);
}

/* ---------- 2. 基础 ---------- */
html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4, h5, h6 { color: var(--text); font-weight: 650; line-height: 1.35; }
h1 { font-size: 30px; letter-spacing: -0.02em; }
h2 { font-size: 22px; letter-spacing: -0.01em; }
h3 { font-size: 19px; }
h4 { font-size: 17px; }
h5 { font-size: 16px; }
h6 { font-size: 15px; }

code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

::selection { background: var(--accent-soft); }

*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 3. 外壳（T 型：顶栏 + 左侧栏） ---------- */
.topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    width: var(--sidebar-w);
    height: 100%;
    padding: 0 12px 0 16px;
    border-right: 1px solid var(--border);
    flex-shrink: 0;
}

.topbar-brand .side-brand {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0;
    border: 0;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 20px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}
.user-chip:hover { background: var(--surface-2); border-color: var(--border); }

.user-chip .avatar {
    width: 30px;
    height: 30px;
    font-size: 13px;
    background: linear-gradient(135deg, #0969da, #54aeff);
    color: #fff;
}

.user-chip-name {
    max-width: 140px;
    overflow: hidden;
    color: var(--text);
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.user-chip-level {
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-3);
    font-size: 11px;
    font-weight: 600;
}
.user-chip-caret { color: var(--text-3); flex-shrink: 0; }

.dropdown-menu {
    --bs-dropdown-bg: var(--surface);
    --bs-dropdown-border-color: var(--border);
    --bs-dropdown-link-color: var(--text);
    --bs-dropdown-link-hover-bg: var(--surface-2);
    --bs-dropdown-link-hover-color: var(--text);
    --bs-dropdown-link-active-bg: var(--accent-soft);
    --bs-dropdown-link-active-color: var(--accent);
    min-width: 160px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}
.dropdown-item { padding: 8px 12px; border-radius: var(--radius-xs); font-size: 13.5px; }
.dropdown-item.is-danger { color: var(--danger); }
.dropdown-item.is-danger:hover { background: var(--danger-soft); color: var(--danger); }
.dropdown-divider { margin: 4px 0; border-color: var(--border); }

.app-shell {
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
    padding-top: var(--topbar-h);
}

#main-wrap {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--topbar-h));
    min-height: calc(100dvh - var(--topbar-h));
}

#main-content {
    flex: 1 0 auto;
    width: 100%;
    max-width: var(--shell-max);
    margin: 0 auto;
    padding: 28px var(--shell-pad) 56px;
}

/* ---------- 4. 侧栏 ---------- */
#sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    z-index: 1040;
}

.side-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px 16px;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
}

.side-brand:hover { color: var(--text); }

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #0969da, #54aeff);
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.02em;
    box-shadow: 0 2px 8px rgba(9, 105, 218, 0.35);
}

.brand-text { min-width: 0; }
.brand-text b {
    display: block;
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
}
.brand-text small {
    display: block;
    margin-top: 1px;
    color: var(--text-3);
    font-size: 11px;
    letter-spacing: 0.02em;
}

.side-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 12px 10px;
}

.side-group + .side-group { margin-top: 14px; }

.side-group-label {
    margin: 0 0 6px;
    padding: 0 12px;
    color: var(--text-3);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.side-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-size: 14px;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.side-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 0;
    opacity: 0.8;
}
.side-link.active .side-icon,
.side-link:hover .side-icon { opacity: 1; }

.side-icon-dark { display: none; }
[data-bs-theme="dark"] .side-icon-light { display: none; }
[data-bs-theme="dark"] .side-icon-dark { display: inline-block; }

.side-svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--text-3);
}
.side-link:hover .side-svg { color: var(--text-2); }
.side-link.active .side-svg { color: var(--accent); }

.side-badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

.side-foot {
    height: var(--bottom-bar-h);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 10px;
    border-top: 1px solid var(--border);
}

.side-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--text);
    text-decoration: none;
}
.side-user:hover { background: var(--surface-2); color: var(--text); }

.avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 14px;
    font-weight: 700;
}

.side-user-meta { min-width: 0; }
.side-user-name {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.side-user-level { display: block; font-size: 11px; color: var(--text-3); }

.side-auth {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 4px 4px 8px;
}

/* 主题切换 */
.side-theme {
    position: relative;
}

.side-theme-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-2);
    font-size: 13.5px;
    text-align: left;
}
.side-theme-btn:hover { background: var(--surface-2); color: var(--text); }

.theme-menu {
    display: none;
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 46px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1050;
}
.theme-menu.show { display: block; }
.theme-menu button {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text-2);
    font-size: 13.5px;
    text-align: left;
}
.theme-menu button:hover { background: var(--surface-2); color: var(--text); }
.theme-menu button.selected { color: var(--accent); font-weight: 600; }

/* 手机端汉堡按钮（桌面隐藏） */
.side-toggle { display: none; }

/* ---------- 5. 页头 ---------- */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin: 2px 0 20px;
}
.page-title {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.page-sub {
    margin: 4px 0 0;
    color: var(--text-2);
    font-size: 13.5px;
}
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 6. 页脚 ---------- */
.site-footer {
    margin-top: auto;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.footer-inner {
    width: 100%;
    max-width: var(--shell-max);
    margin: 0 auto;
    padding: 0 var(--shell-pad);
    min-height: calc(var(--bottom-bar-h) - 1px);
    display: flex;
    align-items: center;
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    width: 100%;
    color: var(--text-3);
    font-size: 12px;
    text-align: center;
}
.footer-bottom a { color: var(--text-3); text-decoration: none; }
.footer-bottom a:hover { color: var(--accent); }
.footer-bottom a.footer-ad-link { color: var(--accent); font-weight: 600; }
.footer-bottom a.footer-ad-link:hover { color: var(--accent-hover); text-decoration: underline; }

/* ---------- 7. 卡片 ---------- */
.card {
    --bs-card-bg: var(--surface);
    --bs-card-border-color: var(--border);
    --bs-card-border-radius: var(--radius);
    --bs-card-inner-border-radius: calc(var(--radius) - 1px);
    --bs-card-cap-bg: var(--surface-2);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.card-header {
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.card-header h4,
.card-header h5 { margin: 0; }

.card-body { padding: 18px 20px; }

.card-title { margin-bottom: 8px; font-size: 15px; font-weight: 600; line-height: 1.45; }
.card-title a { color: var(--text); text-decoration: none; }
.card-title a:hover { color: var(--accent); }

/* 卡片悬停（列表卡片才有意义，静态卡片几乎无感） */
.card:hover { border-color: var(--border-strong); }

/* 资料/作品卡片的统一信息行 */
.card-text { color: var(--text-2); }
.card-text.text-muted { color: var(--text-2) !important; }

/* ---------- 8. 按钮 ---------- */
.btn {
    --bs-btn-font-weight: 500;
    --bs-btn-focus-box-shadow: var(--ring);
    border-radius: var(--radius-sm);
}

.btn-sm { --bs-btn-padding-y: 0.28rem; --bs-btn-padding-x: 0.65rem; border-radius: var(--radius-xs); }

.btn-primary {
    --bs-btn-bg: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-bg: var(--accent-hover);
    --bs-btn-hover-border-color: var(--accent-hover);
    --bs-btn-active-bg: var(--accent-hover);
    --bs-btn-active-border-color: var(--accent-hover);
    --bs-btn-disabled-bg: var(--accent);
    --bs-btn-disabled-border-color: var(--accent);
}

.btn-outline-primary {
    --bs-btn-color: var(--accent);
    --bs-btn-border-color: var(--border-strong);
    --bs-btn-hover-bg: var(--accent);
    --bs-btn-hover-border-color: var(--accent);
    --bs-btn-active-bg: var(--accent);
    --bs-btn-active-border-color: var(--accent);
}

.btn-outline-secondary {
    --bs-btn-color: var(--text-2);
    --bs-btn-border-color: var(--border-strong);
    --bs-btn-hover-bg: var(--surface-2);
    --bs-btn-hover-color: var(--text);
    --bs-btn-hover-border-color: var(--border-strong);
    --bs-btn-active-bg: var(--surface-3);
    --bs-btn-active-color: var(--text);
}

/* ---------- 9. 徽标（深色模式可读性关键） ---------- */
.badge {
    padding: 0.3em 0.65em;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    vertical-align: middle;
}

/* Bootstrap 的 bg-* 只设背景不设前景，深色模式下会出现"浅底白字"发糊 */
.badge.bg-primary, .badge.bg-info { background-color: #0969da !important; color: #fff !important; }
.badge.bg-success { background-color: #1a7f37 !important; color: #fff !important; }
.badge.bg-warning { background-color: #9a6700 !important; color: #fff !important; }
.badge.bg-danger { background-color: #cf222e !important; color: #fff !important; }
.badge.bg-secondary { background-color: #57606a !important; color: #fff !important; }

/* 非 badge 元素上的 bg-*（头像底、卡头等）同步压暗，白字始终可读 */
.bg-warning { background-color: #9a6700 !important; color: #fff !important; }
.bg-info { background-color: #0969da !important; color: #fff !important; }
.bg-success { background-color: #1a7f37 !important; color: #fff !important; }
.bg-danger { background-color: #cf222e !important; color: #fff !important; }
.bg-secondary { background-color: #57606a !important; color: #fff !important; }
.bg-primary { background-color: #0969da !important; color: #fff !important; }
.text-bg-warning, .text-bg-info, .text-bg-success, .text-bg-danger { color: #fff !important; }

/* ---------- 10. 表单 ---------- */
.form-label {
    margin-bottom: 6px;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 600;
}

.form-control,
.form-select {
    min-height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    color: var(--text);
    font-size: 14px;
}
.form-control-sm,
.form-select-sm { min-height: 31px; font-size: 13.5px; }

.form-control:focus,
.form-select:focus {
    border-color: var(--accent);
    background-color: var(--surface);
    color: var(--text);
    box-shadow: var(--ring);
}

.form-control::placeholder { color: var(--text-3); }
.form-text { font-size: 12px; color: var(--text-3); }

.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { box-shadow: var(--ring); }

input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--surface-2);
    color: var(--text);
    font-size: 13px;
}

/* 用户管理：批量导入的文件选择框与按钮同高，灰色选择按钮贴合输入框左缘 */
#importForm #excel_file {
    height: 38px;
    padding: 0;
    line-height: 36px;
    overflow: hidden;
}
#importForm #excel_file::file-selector-button {
    height: 36px;
    margin: 0 10px 0 0;
    padding: 0 14px;
    border: 0;
    border-right: 1px solid var(--border);
    border-radius: 0;
    background: var(--surface-2);
    color: var(--text);
    font-size: 13px;
    vertical-align: top;
}

/* ---------- 11. 标签页 / 表格 ---------- */
.nav-tabs {
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
}
.nav-tabs .nav-link {
    position: relative;
    margin-right: 16px;
    padding: 8px 2px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--text-2);
    font-size: 14px;
}
.nav-tabs .nav-link:hover { color: var(--text); border-bottom-color: var(--border-strong); }
.nav-tabs .nav-link.active {
    background: transparent;
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--border);
    margin-bottom: 0;
    color: var(--text);
    font-size: 13.5px;
}
.table > :not(caption) > * > * { padding: 10px 12px; border-color: var(--border); }
.table thead th {
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
}
.table-hover > tbody > tr:hover > * { background-color: var(--surface-2); color: var(--text); }
.table-light { --bs-table-bg: var(--surface-2); --bs-table-color: var(--text-2); }

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.table-scroll > .table { margin: 0; }
.card .table-scroll { border: 0; border-radius: 0; background: transparent; }
.table-scroll .table > thead th:first-child { border-top-left-radius: var(--radius); }
.table-scroll .table > thead th:last-child { border-top-right-radius: var(--radius); }

/* 表格内容与原站一致：水平居中、垂直居中 */
#main-content .table th,
#main-content .table td { text-align: center; vertical-align: middle; }

/* ---------- 12. 分页 / 提示 ---------- */
.pagination { gap: 4px; margin: 0; }
.page-link {
    min-width: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-2);
    text-align: center;
    font-size: 13px;
}
.page-link:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.page-item.active .page-link { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-item.disabled .page-link { background: var(--surface-2); border-color: var(--border); color: var(--text-3); }

.alert { border-radius: var(--radius-sm); border: 1px solid var(--border); }
.alert-danger { background: var(--danger-soft); border-color: rgba(207, 34, 46, 0.25); color: var(--text); }
.alert-warning { background: var(--warning-soft); border-color: rgba(154, 103, 0, 0.25); color: var(--text); }
.alert-info { background: var(--accent-soft); border-color: rgba(9, 105, 218, 0.2); color: var(--text); }
.alert-success { background: var(--success-soft); border-color: rgba(26, 127, 55, 0.2); color: var(--text); }

/* ---------- 13. 首页 ---------- */
.home-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin: 6px 0 24px;
}
.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.home-head h1 {
    margin: 0 0 10px;
    font-size: clamp(26px, 3vw, 36px);
    font-weight: 750;
    letter-spacing: -0.025em;
}
.home-sub {
    max-width: 660px;
    margin: 0;
    color: var(--text-2);
    font-size: 14.5px;
}
.home-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.home-banner {
    height: clamp(170px, 20vw, 250px);
    margin: 0 0 22px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-2);
}
.home-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }

.home-hero { margin-bottom: 26px; }
.home-hero .slider,
.home-hero .panel { height: clamp(300px, 30vw, 392px); }

/* 轮播 */
.slider {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    box-shadow: var(--shadow-sm);
}
.slider-track { display: flex; height: 100%; transition: transform 0.5s ease; }
.slider-slide { min-width: 100%; height: 100%; }
.slider-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slider-slide a { display: block; height: 100%; }

.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: rgba(13, 17, 23, 0.55);
    color: #fff;
    font-size: 15px;
    line-height: 1;
    backdrop-filter: blur(4px);
    transition: background 0.15s ease;
}
.slider-arrow:hover { background: rgba(13, 17, 23, 0.8); }
#promo-prev { left: 12px; }
#promo-next { right: 12px; }

.slider-dots {
    position: absolute;
    left: 50%;
    bottom: 12px;
    z-index: 2;
    display: flex;
    gap: 6px;
    padding: 4px 8px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: rgba(13, 17, 23, 0.35);
    backdrop-filter: blur(4px);
}
.slider-dots .dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    cursor: pointer;
}
.slider-dots .dot.active { background: #fff; }

/* 公告面板 */
.panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.panel-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14.5px;
    font-weight: 600;
}
.panel-head svg { color: var(--accent); }
.panel-body { flex: 1 1 auto; overflow-y: auto; padding: 6px 8px; }
.panel-foot {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    font-size: 12.5px;
}
.panel-foot a { color: var(--text-2); text-decoration: none; }
.panel-foot a:hover { color: var(--accent); }

.ann-list { margin: 0; padding: 0; list-style: none; }
.ann-list li { border-radius: var(--radius-sm); }
.ann-list li:hover { background: var(--surface-2); }
.ann-list .ann-title {
    display: block;
    padding: 9px 10px 2px;
    color: var(--text);
    font-size: 13.5px;
    line-height: 1.5;
    text-decoration: none;
}
.ann-list .ann-title:hover { color: var(--accent); }
.ann-list .ann-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 10px 9px;
    color: var(--text-3);
    font-size: 12px;
}
.ann-list .ann-meta a { color: var(--text-3); text-decoration: none; }
.ann-list .ann-meta a:hover { color: var(--accent); }

/* 统计条 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}
.stats-grid.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat {
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.stat-value { font-size: 26px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.15; }
.stat-label { margin-top: 2px; color: var(--text-2); font-size: 12.5px; }

/* 区块标题 */
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 14px;
}
.section-head h2 { margin: 0; font-size: 19px; }
.section-more { color: var(--text-2); font-size: 13px; text-decoration: none; }
.section-more:hover { color: var(--accent); }

/* 最新资料卡片 */
.doc-card { height: 100%; }
.doc-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.doc-card .card-body { display: flex; flex-direction: column; gap: 8px; height: 100%; }
.doc-top { display: flex; align-items: center; gap: 8px; }
.doc-date { color: var(--text-3); font-size: 12px; }
.doc-title { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.45; }
.doc-title a { color: var(--text); text-decoration: none; }
.doc-title a:hover { color: var(--accent); }
.doc-desc {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--text-2);
    font-size: 13px;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.doc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin: auto 0 0;
    color: var(--text-3);
    font-size: 12px;
}
.doc-meta a { color: var(--text-3); text-decoration: none; }
.doc-meta a:hover { color: var(--accent); }

.chip {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}
.chip-link { background: var(--success-soft); color: var(--success); }
.chip-ann { background: var(--warning-soft); color: var(--warning); }
.chip-pic { background: rgba(130, 80, 223, 0.12); color: #8250df; }
[data-bs-theme="dark"] .chip-pic { color: #bc8cff; }

/* 公告类型卡片的角标 */
.announce-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
    padding: 1px 8px;
    border: 1px solid rgba(154, 103, 0, 0.25);
    border-radius: 999px;
    background: var(--warning-soft);
    color: var(--warning);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.6;
}
.announce-badge ~ .card-body .card-title { padding-right: 42px; }

/* 公告卡片：下载按钮固定到右下角 */
.announce-card .card-body { display: flex; flex-direction: column; }
.announce-actions { margin-top: auto; justify-content: flex-end; }

/* 空状态 */
.empty-state {
    padding: 40px 20px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-2);
    text-align: center;
    font-size: 13.5px;
}

/* ---------- 14. 关于页 ---------- */
.about-hero { padding: 6px 0 22px; }
.about-hero h1 { margin: 0 0 10px; font-size: clamp(28px, 3.2vw, 38px); font-weight: 750; letter-spacing: -0.025em; }
.about-lead { max-width: 720px; margin: 0; color: var(--text-2); font-size: 14.5px; }
.about-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 14px;
    color: var(--text-3);
    font-size: 12.5px;
}

.info-list { margin: 0; padding: 0; list-style: none; }
.info-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 13.5px;
}
.info-list li:last-child { border-bottom: 0; }
.info-list .k { color: var(--text-2); }
.info-list .v { color: var(--text); text-align: right; }

.timeline { position: relative; margin: 0; padding: 0 0 0 22px; list-style: none; }
.timeline::before {
    content: "";
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 5px;
    width: 2px;
    background: var(--border);
}
.timeline li { position: relative; padding-bottom: 22px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
    content: "";
    position: absolute;
    top: 7px;
    left: -22px;
    width: 8px;
    height: 8px;
    border: 2px solid var(--border-strong);
    border-radius: 50%;
    background: var(--surface);
}
.timeline li.is-current::before { border-color: var(--accent); background: var(--accent); }
.tl-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tl-version { font-size: 14.5px; font-weight: 700; }
.tl-date { color: var(--text-3); font-size: 12px; }
.tl-title { margin: 3px 0 6px; color: var(--text); font-size: 13.5px; font-weight: 600; }
.timeline ul { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 13px; }
.timeline ul li { padding: 1px 0; border: 0; }
.timeline ul li::before { display: none; }

/* 宽屏：更新记录卡片与右侧「联系与备案」卡片底部平齐，记录区内部滚动 */
.about-layout { position: relative; }

@media (min-width: 992px) {
    .about-layout { display: block; }

    .about-side {
        width: calc(33.333% - 8px);
        margin-left: auto;
    }

    .about-main {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        width: calc(66.666% - 16px);
        display: flex;
        flex-direction: column;
    }

    .about-main > .card:first-child { flex: 0 0 auto; }

    .about-main > .card:last-child {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .about-main > .card:last-child > .card-body {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .about-timeline {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        padding-right: 6px;
    }
}

@media (max-width: 991.98px) {
    .about-layout { display: flex; flex-direction: column; gap: 24px; }
    .about-main,
    .about-side { width: 100%; }
}

/* ---------- 15. 旧组件兼容 ---------- */
.card-transparent {
    background: var(--surface) !important;
    border-color: var(--border) !important;
}

.pic-thumb {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    background: var(--surface-3);
}

/* 复制链接提示 */
.toast-msg {
    position: fixed;
    top: 20px;
    left: 50%;
    z-index: 9999;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    background: var(--text);
    color: var(--bg);
    font-size: 13px;
    opacity: 0;
    transform: translateX(-50%);
    transition: opacity 0.3s ease;
    pointer-events: none;
    box-shadow: var(--shadow);
}
.toast-msg.show { opacity: 1; }

/* 页头内嵌搜索条（资料中心） */
.search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 280px;
    flex-wrap: nowrap;
    max-width: 520px;
}
.search-form .form-control { flex: 1 1 auto; min-width: 0; }
.search-form .btn { flex: 0 0 auto; white-space: nowrap; }

/* 我发出的留言（个人中心） */
.sent-msg {
    position: relative;
    cursor: pointer;
}

/* 卡片高亮（搜索命中） */
@keyframes highlight-flash {
    0% { background-color: var(--accent-soft); }
    100% { background-color: transparent; }
}
.highlight-flash { animation: highlight-flash 2.5s ease-out; }

/* 点赞 / 收藏 */
.like-btn.active,
.fav-btn.active {
    color: #fb7299 !important;
    border-color: #fb7299 !important;
    background-color: rgba(251, 114, 153, 0.12) !important;
}

/* 通知红点（侧栏 / 子标签统一） */
.notify-dot {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 0 2px var(--surface);
    pointer-events: none;
}

.nav-tabs .nav-link .notify-dot {
    top: 3px;
    right: -6px;
    box-shadow: 0 0 0 2px var(--bg);
}
.sent-msg.unseen { border-color: var(--accent); background: var(--accent-soft); }

/* 宣传管理：当前生效缩略图 */
.promo-view-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.promo-view-item {
    position: relative;
    width: 110px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--surface-2);
}
.promo-view-item img { width: 110px; height: 110px; object-fit: cover; display: block; }
.promo-view-item .ord {
    position: absolute;
    top: 4px;
    left: 4px;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}
.promo-view-item .pid-label {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 1px 0;
    background: rgba(13, 17, 23, 0.6);
    color: #fff;
    font-size: 11px;
    text-align: center;
}

.promo-ann-list { margin: 0 0 10px; padding: 0; list-style: none; }
.promo-ann-list li {
    padding: 6px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 13.5px;
}
.promo-ann-list .ann-ord {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

/* 宣传选择页 */
.select-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.select-item {
    position: relative;
    width: 110px;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: var(--radius-xs);
    background: var(--surface-2);
    cursor: pointer;
}
.select-item img { width: 110px; height: 110px; object-fit: cover; display: block; }
.select-item.selected { border-color: var(--accent); }
.select-item .dot {
    position: absolute;
    top: 6px;
    right: 6px;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: rgba(13, 17, 23, 0.4);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}
.select-item.selected .dot { background: var(--accent); }
.select-item .pid-label {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 1px 0;
    background: rgba(13, 17, 23, 0.6);
    color: #fff;
    font-size: 11px;
    text-align: center;
}

.ann-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin-bottom: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 13.5px;
    cursor: pointer;
}
.ann-item:hover { border-color: var(--border-strong); }
.ann-item.selected { border-color: var(--accent); background: var(--accent-soft); }
.ann-item .dot {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    border: 2px solid var(--border-strong);
    border-radius: 50%;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}
.ann-item.selected .dot { border-color: var(--accent); background: var(--accent); }

/* ---------- 16. 深色模式修补 ---------- */
[data-bs-theme="dark"] .text-dark { color: var(--text) !important; }
[data-bs-theme="dark"] .text-body { color: var(--text) !important; }
[data-bs-theme="dark"] .text-muted { color: var(--text-2) !important; }
[data-bs-theme="dark"] .bg-white { background-color: var(--surface-2) !important; }
[data-bs-theme="dark"] .bg-light { background-color: var(--surface-2) !important; }
[data-bs-theme="dark"] .border { border-color: var(--border) !important; }
[data-bs-theme="dark"] .card-header.bg-white { background: var(--surface-2) !important; }
[data-bs-theme="dark"] .modal-content { background: var(--surface); color: var(--text); }
[data-bs-theme="dark"] .list-group-item { background: var(--surface); color: var(--text); border-color: var(--border); }
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select { background-color: var(--surface); border-color: var(--border); color: var(--text); }
[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(1) brightness(1.6); }
[data-bs-theme="dark"] .table-light { --bs-table-bg: var(--surface-2); --bs-table-color: var(--text-2); }

/* 深色下链接按钮的浅色描边统一压暗 */
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-border-color: var(--border-strong); }
[data-bs-theme="dark"] .btn-outline-secondary { --bs-btn-border-color: var(--border-strong); }

/* ---------- 17. 模态框 ---------- */
.modal-content {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-lg);
}
.modal-header { border-bottom: 0; padding-bottom: 0; }
.modal-footer { border-top: 1px solid var(--border); }
.modal-title { font-size: 17px; }

/* 兼容国产移动端浏览器：modal-open 的滚动锁会引发重排挤压，主动放弃 */
body.modal-open {
    overflow: auto !important;
    padding-right: 0 !important;
}
.modal {
    position: fixed !important;
    inset: 0;
}

/* ---------- 18. 响应式 ---------- */
/* 平板：保留竖栏，内容自适应；不再强制 1200px 横向滚动 */
@media (max-width: 1199.98px) {
    :root { --shell-pad: 24px; }
}

/* 手机：顶栏 + 抽屉导航 */
@media (max-width: 767.98px) {
    :root { --shell-pad: 16px; }

    #sidebar {
        top: var(--topbar-h);
        bottom: 0;
        width: 264px;
        transform: translateX(-105%);
        transition: transform 0.25s ease;
        z-index: 1060;
        border-right: 1px solid var(--border);
    }
    #sidebar.show { transform: translateX(0); }

    #main-wrap {
        margin-left: 0;
    }

    .topbar-brand {
        width: auto;
        flex: 1 1 auto;
        padding: 0 6px;
        gap: 2px;
        border-right: 0;
    }
    .topbar-brand .side-brand small { display: none; }
    .topbar-actions { padding-right: 10px; gap: 6px; }
    .user-chip-name { max-width: 72px; }
    .user-chip-level { display: none; }

    .side-toggle {
        position: static;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        background: var(--surface);
        color: var(--text);
        box-shadow: none;
        flex-shrink: 0;
    }

    #main-content { padding: 18px 16px 44px; }
    .page-head { margin-bottom: 16px; }
    .page-title { font-size: 22px; }

    .home-hero .slider { height: clamp(200px, 52vw, 300px); }
    .home-hero .panel { height: auto; max-height: 380px; }

    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stats-grid.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .stat-value { font-size: 22px; }

    .footer-inner { padding: 12px 16px; }

    /* 未包在 .table-scroll 里的表格也保证不撑破页面 */
    #main-content table:not(.table-scroll table) {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}

@media (min-width: 768px) {
    .side-toggle { display: none; }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .slider-track { transition: none; }
    .card, .doc-card { transition: none; }
    * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
}
