/* ==========================================================
   Bootstrap 兼容层
   作用：让「文档查阅系统」的页面在保留原有 HTML 的前提下，
        套用知识库系统的视觉语言（配色 / 圆角 / 阴影 / 间距）
   ========================================================== */

:root {
    --bs-body-font-family: var(--font);
    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-border-color: var(--line);
    --bs-primary: #2563eb;
    --bs-primary-rgb: 37, 99, 235;
    --bs-link-color: #2563eb;
    --bs-link-hover-color: #1d4ed8;
    --bs-border-radius: 10px;
    --bs-border-radius-sm: 8px;
    --bs-border-radius-lg: 14px;
    --bs-secondary-color: #64748b;
    --bs-tertiary-bg: #f8fafc;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.7;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--ink); font-weight: 700; letter-spacing: -.01em; }
.fw-bold, .fw-semibold { color: var(--ink); }
.text-muted, .text-secondary { color: var(--muted) !important; }
.text-body { color: var(--text) !important; }
.text-dark { color: var(--ink) !important; }
.bg-white { background: #fff !important; }
.bg-light { background: #f8fafc !important; }
.border { border-color: var(--line) !important; }
.shadow-sm { box-shadow: 0 1px 2px rgba(15, 23, 42, .05) !important; }
.shadow { box-shadow: 0 10px 30px -18px rgba(15, 23, 42, .28) !important; }

/* ---------------- 布局 ---------------- */
.kb-main { min-height: 54vh; }
.admin-content > .container { width: 100%; max-width: none; padding-left: 0; padding-right: 0; }
.admin-content > .container.py-4 { padding-top: 4px !important; padding-bottom: 0 !important; }
.admin-content .row.g-4 > [class*="col-"] { min-width: 0; }

/* ---------------- 按钮 ---------------- */
.btn {
    --bs-btn-border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: .16s;
}
.btn-sm { font-size: 13px; padding: 6px 12px; border-radius: 9px; }
.btn-lg { font-size: 15.5px; padding: 12px 24px; border-radius: 12px; }

.btn-primary {
    --bs-btn-bg: #2563eb; --bs-btn-border-color: #2563eb;
    --bs-btn-hover-bg: #1d4ed8; --bs-btn-hover-border-color: #1d4ed8;
    --bs-btn-active-bg: #1e40af; --bs-btn-active-border-color: #1e40af;
    --bs-btn-disabled-bg: #93b4fb; --bs-btn-disabled-border-color: #93b4fb;
    box-shadow: 0 6px 14px -8px rgba(37, 99, 235, .7);
}
.btn-outline-primary {
    --bs-btn-color: #2563eb; --bs-btn-border-color: #c7d7fb;
    --bs-btn-hover-bg: #eff6ff; --bs-btn-hover-color: #1d4ed8; --bs-btn-hover-border-color: #93b4fb;
    --bs-btn-active-bg: #dbeafe; --bs-btn-active-color: #1e40af; --bs-btn-active-border-color: #93b4fb;
}
.btn-outline-secondary {
    --bs-btn-color: #475569; --bs-btn-border-color: var(--line);
    --bs-btn-hover-bg: #f1f5f9; --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: #cbd5e1;
    --bs-btn-active-bg: #e2e8f0; --bs-btn-active-color: var(--ink); --bs-btn-active-border-color: #cbd5e1;
}
.btn-secondary { --bs-btn-bg: #64748b; --bs-btn-border-color: #64748b; --bs-btn-hover-bg: #475569; --bs-btn-hover-border-color: #475569; }
.btn-danger {
    --bs-btn-bg: #dc2626; --bs-btn-border-color: #dc2626;
    --bs-btn-hover-bg: #b91c1c; --bs-btn-hover-border-color: #b91c1c;
}
.btn-outline-danger {
    --bs-btn-color: #dc2626; --bs-btn-border-color: #fca5a5;
    --bs-btn-hover-bg: #fef2f2; --bs-btn-hover-color: #b91c1c; --bs-btn-hover-border-color: #f87171;
}
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--line); --bs-btn-color: var(--text); --bs-btn-hover-bg: #f8fafc; --bs-btn-hover-border-color: #cbd5e1; --bs-btn-hover-color: var(--ink); }
.btn-close { --bs-btn-close-focus-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }

/* ---------------- 卡片 ---------------- */
.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
    color: var(--text);
}
.card-header {
    background: #fff;
    border-bottom: 1px solid var(--line-2);
    font-weight: 700;
    font-size: 14.5px;
    padding: 14px 20px;
    border-radius: 16px 16px 0 0 !important;
    color: var(--ink);
}
.card-header.bg-white { background: #fff !important; }
.card-body { padding: 18px 20px; }
.card-footer { background: #fbfcff; border-top: 1px solid var(--line-2); padding: 12px 20px; }
.card-title { font-size: 15px; font-weight: 700; }

/* ---------------- 表格 ---------------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; font-size: 14px; color: var(--text); }
.table > thead th {
    background: #f8fafc;
    color: var(--muted);
    font-weight: 600;
    font-size: 12.5px;
    border-bottom: 1px solid var(--line);
    padding: 11px 12px;
    white-space: nowrap;
}
.table > tbody td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table > tbody tr:last-child td { border-bottom: 0; }
.table-hover > tbody > tr:hover > * { background: #f8faff; color: var(--text); }
.table-responsive { border-radius: 12px; }

/* ---------------- 表单 ---------------- */
.form-label { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-control, .form-select {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 14px;
    background: #fff;
    color: var(--ink);
}
.form-control::placeholder { color: #94a3b8; }
.form-control:focus, .form-select:focus {
    border-color: #93b4fb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
    background: #fff;
}
.form-control-sm, .form-select-sm { padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.form-text { font-size: 12px; color: var(--muted); }
.form-check-input { border-color: #cbd5e1; }
.form-check-input:checked { background-color: #2563eb; border-color: #2563eb; }
.form-check-input:focus { border-color: #93b4fb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.form-check-label { font-size: 13.5px; }
.input-group-text { background: #f8fafc; border-color: var(--line); font-size: 13px; color: var(--muted); border-radius: 10px; }

/* ---------------- 徽标 ---------------- */
.badge { font-weight: 600; font-size: 11.5px; padding: 4px 8px; border-radius: 7px; letter-spacing: 0; }
.text-bg-primary { background: #eff6ff !important; color: #1d4ed8 !important; }
.text-bg-success { background: #ecfdf5 !important; color: #047857 !important; }
.text-bg-warning { background: #fffbeb !important; color: #b45309 !important; }
.text-bg-danger { background: #fef2f2 !important; color: #b91c1c !important; }
.text-bg-info { background: #eff6ff !important; color: #0369a1 !important; }
.text-bg-secondary { background: #f1f5f9 !important; color: #475569 !important; }
.text-bg-light { background: #f8fafc !important; color: #475569 !important; }
.text-bg-dark { background: #1e293b !important; color: #fff !important; }

/* ---------------- 列表组 ---------------- */
.list-group-item { background: #fff; border-color: var(--line-2); color: var(--text); font-size: 14px; padding: 12px 16px; }
.list-group-item-action { transition: .14s; }
.list-group-item-action:hover { background: #f8faff; color: var(--pri-600); }
.list-group-item.active { background: #eff6ff; border-color: #dbeafe; color: #1d4ed8; font-weight: 600; }
.list-group-item-action.active:hover { background: #dbeafe; color: #1e40af; }
.cat-nav .list-group-item { border-left: 0; border-right: 0; }
.cat-nav .list-group-item:first-child { border-top: 0; }

/* ---------------- 弹窗 / 下拉 ---------------- */
.modal-content { border: 0; border-radius: 18px; box-shadow: 0 24px 60px -30px rgba(15, 23, 42, .35); }
.modal-header { border-bottom: 1px solid var(--line-2); padding: 16px 20px; }
.modal-title { font-size: 16px; }
.modal-body { padding: 18px 20px; }
.modal-footer { border-top: 1px solid var(--line-2); padding: 12px 20px; gap: 8px; }
.modal-backdrop.show { opacity: .42; }

.dropdown-menu { border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 44px -22px rgba(15, 23, 42, .32); padding: 6px; font-size: 14px; }
.dropdown-item { border-radius: 8px; padding: 8px 10px; color: var(--text); }
.dropdown-item:hover, .dropdown-item:focus { background: #f1f5f9; color: var(--ink); }
.dropdown-divider { border-color: var(--line-2); margin: 6px 4px; }

/* ---------------- 提示 ---------------- */
.alert { border-radius: 12px; border: 1px solid; font-size: 13.5px; padding: 12px 16px; }
.alert-danger { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-info { background: #eff6ff; border-color: #c7ddff; color: #1e40af; }
.alert-light { background: #f8fafc; border-color: var(--line); color: var(--text); }
.alert-secondary { background: #f8fafc; border-color: var(--line); color: var(--muted); }

/* ---------------- 分页 ---------------- */
.pagination { gap: 4px; }
.page-link { border-color: var(--line); color: var(--text); border-radius: 9px !important; font-size: 13.5px; padding: 7px 12px; }
.page-link:hover { background: #f1f5f9; color: var(--pri-600); border-color: #cbd5e1; }
.page-item.active .page-link { background: #2563eb; border-color: #2563eb; color: #fff; }
.page-item.disabled .page-link { color: #cbd5e1; }

/* ---------------- 进度 / 分隔 ---------------- */
.progress { height: 8px; border-radius: 999px; background: #eef2f7; }
.progress-bar { background-color: #2563eb; }
hr { border-color: var(--line-2); opacity: 1; }

/* ---------------- 文档类型标签（原系统组件） ---------------- */
.doc-type {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 7px;
    color: #fff;
    letter-spacing: .02em;
    line-height: 1.4;
    /* 兜底底色：类名未命中时也不会白字白底 */
    background: linear-gradient(140deg, #64748b, #334155);
}
.doc-type.t-word, .doc-type.t-doc { background: linear-gradient(140deg, #3b82f6, #1d4ed8); }
.doc-type.t-pdf { background: linear-gradient(140deg, #ef4444, #b91c1c); }
.doc-type.t-ppt { background: linear-gradient(140deg, #f59e0b, #d97706); }
.doc-type.t-excel, .doc-type.t-xls { background: linear-gradient(140deg, #10b981, #047857); }
.doc-type.t-other { background: linear-gradient(140deg, #64748b, #334155); }

.doc-item { position: relative; padding-right: 4.6rem; }
.doc-item .doc-link { display: block; color: inherit; text-decoration: none; }
.doc-item .doc-link:hover .fw-semibold { color: var(--pri-600); }
.doc-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); }
.meta-sm { font-size: 12.5px; color: var(--muted); }

/* 统计卡 */
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.stat-card .num { font-size: 26px; font-weight: 800; line-height: 1.2; color: var(--ink); }
.stat-card .lbl { font-size: 12.5px; color: var(--muted); }

/* 柱状图样式见 app.css（.bar-chart .bar > em / i / span），此处不再覆盖 */

/* 知识库文件夹大卡 */
.kb-hero .card-body { padding: 22px 24px; }

/* 评论屏蔽态 */
.comment-hidden { opacity: .6; background: #f8fafc; border-left: 3px solid #e2e8f0; padding-left: 10px; }

/* 响应式微调 */
@media (max-width: 768px) {
    .btn { padding: 7px 13px; font-size: 13.5px; }
    .card-body { padding: 15px 16px; }
    .card-header { padding: 12px 16px; }
    .table > thead th, .table > tbody td { padding: 9px 10px; }
    .admin-content > .container.py-4 { padding-top: 0 !important; }
}

/* ===== 知识库文件夹 / 首页目录卡片（统一为蓝色渐变主题） ===== */
.kb-hero {
    border: 0;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 52%, #4f46e5 100%);
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 44px -26px rgba(30, 58, 138, .75);
}
/* 右上角柔光，营造层次 */
.kb-hero::after {
    content: "";
    position: absolute;
    width: 340px; height: 340px;
    right: -110px; top: -190px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 68%);
    pointer-events: none;
}
.kb-hero .card-body { position: relative; z-index: 2; }
.kb-hero .fw-bold,
.kb-hero .fw-semibold { color: #fff !important; }
.kb-hero .text-muted { color: rgba(255, 255, 255, .76) !important; }
.kb-hero-stats { padding-left: 46px; color: rgba(255, 255, 255, .8); }
.kb-hero-icon {
    width: 38px; height: 38px; border-radius: 10px; flex: none;
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .3);
    display: flex; align-items: center; justify-content: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}
/* 蓝色渐变卡上的「全部文档」按钮：白底蓝字 */
.kb-hero .btn-dark,
.kb-hero .btn-light {
    background: #fff;
    border-color: #fff;
    color: #1d4ed8;
    font-weight: 700;
    box-shadow: 0 10px 22px -14px rgba(2, 6, 23, .9);
}
.kb-hero .btn-dark:hover,
.kb-hero .btn-light:hover {
    background: #eff6ff;
    border-color: #eff6ff;
    color: #1e40af;
}
.kb-folder-row { border-bottom: 1px solid var(--line); padding: 14px 16px; align-items: center; background: var(--surface); }
.kb-folder-row:last-child { border-bottom: 0; }
.kb-folder-row:hover { background: #f8fbff; }
.kb-folder-icon {
    flex: none; display: flex; align-items: center; justify-content: center;
    width: 42px; height: 36px; color: #60a5fa; transition: .16s;
}
.kb-folder-row:hover .kb-folder-icon { color: #2563eb; }
.kb-folder-desc { color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }
.kb-qr-btn {
    flex: none; width: 34px; height: 34px; border: 0; border-radius: 9px; background: #eef2f4;
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; color: #8aa0b4;
}
.kb-qr-btn:hover { background: #e2e9ed; color: var(--pri); }
.kb-doc-row { padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; margin: 6px 0; }
.kb-doc-type { font-size: 10px; padding: 2px 6px; border-radius: 5px; line-height: 1.3; flex: none; color: #fff; font-weight: 700; }
.kb-doc-title { font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.kb-doc-meta { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 12px; }

/* 首页「知识库目录」卡片行 */
.folder-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.folder-card {
    display: flex; align-items: center; gap: 12px; padding: 14px 15px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    transition: .16s; min-width: 0;
}
.folder-card:hover { border-color: #c7d2fe; box-shadow: 0 6px 16px rgba(37, 99, 235, .08); transform: translateY(-1px); }
.folder-icon {
    flex: none; width: 40px; height: 40px; border-radius: 11px;
    background: linear-gradient(135deg, #eff6ff, #bfdbfe); color: #2563eb;
    display: flex; align-items: center; justify-content: center;
}
.folder-icon svg { width: 22px; height: 22px; }
.folder-name { font-size: 14px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.doc-type.t-txt { background: linear-gradient(140deg, #64748b, #475569); }

/* ==========================================================
   统一视觉（v2.0.5）：旧系统控件收敛到知识库风格
   ========================================================== */

/* 描边按钮统一浅灰描边 + 语义色文字，hover 才出淡色底，
   避免一屏出现蓝/绿/青/红四种彩色边框 */
.btn-outline-primary,
.btn-outline-info,
.btn-outline-success,
.btn-outline-warning,
.btn-outline-danger {
    background: #fff;
    border-color: var(--line);
    box-shadow: none;
}
.btn-outline-primary { color: #1d4ed8; }
.btn-outline-primary:hover { background: var(--pri-50); border-color: #bfdbfe; color: #1e40af; }
.btn-outline-info { color: #0369a1; }
.btn-outline-info:hover { background: #f0f9ff; border-color: #bae6fd; color: #075985; }
.btn-outline-success { color: #047857; }
.btn-outline-success:hover { background: #ecfdf5; border-color: #bbf7d0; color: #065f46; }
.btn-outline-warning { color: #b45309; }
.btn-outline-warning:hover { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.btn-outline-danger { color: #b91c1c; }
.btn-outline-danger:hover { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

/* 实心按钮统一轻投影，不再"重色块" */
.btn-primary, .btn-success, .btn-danger { box-shadow: 0 8px 18px -14px rgba(15, 23, 42, .75); }
.btn-success { --bs-btn-bg: #059669; --bs-btn-border-color: #059669; --bs-btn-hover-bg: #047857; --bs-btn-hover-border-color: #047857; }

/* 徽标统一胶囊 */
.badge { border-radius: 999px; padding: 3px 10px; font-size: 11.5px; }
.text-bg-warning { background: #fffbeb !important; color: #b45309 !important; }

/* 详情页"已收藏"等在渐变卡内的高亮态 */
.doc-actions .btn-success { background: rgba(255, 255, 255, .92); border-color: transparent; color: #b45309; font-weight: 700; }
.doc-actions .btn-success:hover { background: #fff; color: #92400e; }

/* 侧栏小卡里的二维码 */
.doc-qr { display: flex; justify-content: center; }

/* 表单：下拉/输入统一高度，与知识库表单一致 */
.form-control, .form-select { min-height: 40px; }
.form-control:disabled, .form-select:disabled { background: #f8fafc; color: var(--muted); }

/* 列表分组：去掉外边框线，圆角由外层卡片负责 */
.list-group-flush > .list-group-item { border-left: 0; border-right: 0; }
