* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 1100px;
    color: #172033;
    background: #eef1f5;
    font-family: "Microsoft YaHei", Arial, sans-serif;
}

.hidden {
    display: none !important;
}

.boot-screen {
    display: grid;
    min-height: 100vh;
    place-items: center;
    color: #64748b;
    font-size: 14px;
}

.login-screen {
    position: relative;
    overflow: hidden;
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
    background: #172433;
}

.login-screen::before {
    position: absolute;
    inset: -20%;
    content: "";
    background:
        radial-gradient(circle at 18% 28%, rgba(37, 99, 235, 0.36), transparent 28%),
        radial-gradient(circle at 78% 18%, rgba(20, 184, 166, 0.26), transparent 24%),
        radial-gradient(circle at 64% 78%, rgba(99, 102, 241, 0.3), transparent 30%),
        linear-gradient(135deg, #111827 0%, #172433 52%, #0f172a 100%);
    animation: loginAura 14s ease-in-out infinite alternate;
}

.login-screen::after {
    position: absolute;
    inset: 0;
    content: "";
    background-image:
        linear-gradient(rgba(226, 232, 240, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(226, 232, 240, 0.08) 1px, transparent 1px);
    background-size: 72px 72px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent 90%);
    animation: loginGrid 18s linear infinite;
}

.login-panel {
    position: relative;
    z-index: 1;
    display: flex;
    width: min(420px, 100%);
    flex-direction: column;
    gap: 16px;
    border: 1px solid #d8dee8;
    border-radius: 8px;
    padding: 28px;
    background: #ffffff;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
}

.beian-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 18px;
    z-index: 1;
    color: rgba(255, 255, 255, 0.78);
    font-size: 13px;
    text-align: center;
}

.beian-footer a {
    color: inherit;
    text-decoration: none;
}

.beian-footer a:hover {
    text-decoration: underline;
}

@keyframes loginAura {
    0% {
        transform: translate3d(-2%, -1%, 0) scale(1);
    }

    100% {
        transform: translate3d(2%, 1%, 0) scale(1.08);
    }
}

@keyframes loginGrid {
    0% {
        background-position: 0 0, 0 0;
    }

    100% {
        background-position: 72px 72px, 72px 72px;
    }
}

.page-beian-footer {
    padding: 14px 24px 20px;
    color: #64748b;
    font-size: 13px;
    text-align: center;
}

.page-beian-footer a {
    color: inherit;
    text-decoration: none;
}

.page-beian-footer a:hover {
    text-decoration: underline;
}

.share-page {
    min-height: 100vh;
    padding: 28px;
}

.share-shell {
    width: min(980px, 100%);
    margin: 0 auto;
    border: 1px solid #d8dee8;
    border-radius: 8px;
    background: #ffffff;
}

.share-header {
    border-bottom: 1px solid #e5e7eb;
    padding: 20px 24px;
}

.share-header strong {
    display: block;
    color: #111827;
    font-size: 24px;
}

.share-header span {
    display: block;
    margin-top: 6px;
    color: #64748b;
    font-size: 13px;
}

.share-password-panel {
    display: flex;
    align-items: end;
    gap: 12px;
    border-bottom: 1px solid #e5e7eb;
    padding: 20px 24px;
}

.share-password-panel label {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 7px;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
}

.share-content {
    min-height: 360px;
    padding: 24px;
    color: #1f2937;
    line-height: 1.75;
}

.share-kb-content {
    padding: 0;
}

.share-kb-layout {
    display: grid;
    min-height: 560px;
    grid-template-columns: 280px minmax(0, 1fr);
}

.share-kb-nav {
    overflow: auto;
    max-height: calc(100vh - 150px);
    border-right: 1px solid #e5e7eb;
    padding: 16px;
    background: #f8fafc;
}

.share-kb-nav-group + .share-kb-nav-group {
    margin-top: 18px;
}

.share-kb-nav-group h2 {
    margin: 0 0 8px;
    color: #111827;
    font-size: 14px;
}

.share-kb-nav-article {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 6px;
    padding: 8px 10px;
    color: #475569;
    background: transparent;
    text-align: left;
    font-size: 14px;
    line-height: 1.45;
    cursor: pointer;
}

.share-kb-nav-article:hover {
    color: #111827;
    background: #e5e7eb;
}

.share-kb-nav-article.active {
    color: #111827;
    background: #dbe2ea;
    font-weight: 700;
}

.share-kb-reader {
    min-width: 0;
    padding: 26px 30px;
}

.share-kb-article {
    max-width: 860px;
}

.share-kb-article-header {
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 18px;
    padding-bottom: 14px;
}

.share-kb-article-header h2 {
    margin: 0;
    color: #111827;
    font-size: 24px;
}

.share-kb-article-meta {
    margin: 6px 0 12px;
    color: #64748b;
    font-size: 13px;
}

.share-kb-article-body > :first-child {
    margin-top: 0;
}

.share-kb-article-body > :last-child {
    margin-bottom: 0;
}

.share-empty {
    margin: 0;
    color: #64748b;
}

.share-kb-empty {
    display: flex;
    min-height: 360px;
    align-items: center;
    justify-content: center;
    color: #64748b;
}

.login-panel h1 {
    margin: 0 0 6px;
    font-size: 24px;
}

.login-panel label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
}

.captcha-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 132px;
    gap: 10px;
}

.captcha-image-button {
    overflow: hidden;
    min-height: 40px;
    border: 1px solid #cbd5e1;
    padding: 0;
    background: #ffffff;
}

.captcha-image-button:hover {
    background: #f8fafc;
}

.captcha-image-button img {
    display: block;
    width: 132px;
    height: 42px;
}

.kb-screen {
    min-height: 100vh;
}

.user-page {
    min-height: 100vh;
}

.user-page-body {
    padding: 24px;
}

.user-page-table {
    margin: 0;
}

.user-page-table table {
    min-width: 760px;
}

.article-page {
    min-height: 100vh;
}

.article-page-body {
    padding: 24px;
}

.article-page-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    border: 1px solid #d8dee8;
    border-radius: 8px;
    padding: 20px;
    background: #ffffff;
}

.article-page-form .form-grid label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
}

.article-editor-wrap {
    min-height: 560px;
}

.article-editor-tools {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border: 1px solid #d8dee8;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    padding: 10px 12px;
    background: #f8fafc;
}

.article-editor-tools + #articleEditor {
    border-radius: 0 0 8px 8px;
}

#articleEditor {
    margin-bottom: 0;
    border-radius: 8px;
}

.article-editor-tools + #articleEditor {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.editor-toolbar-table-action {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: auto !important;
    min-width: 54px;
    padding: 0 8px !important;
    color: #334155 !important;
    font-size: 13px !important;
    font-weight: 700;
    line-height: 26px !important;
}

.editor-toolbar-table-action .fa {
    margin-right: 0 !important;
    font-size: 14px !important;
    line-height: 26px !important;
}

.editor-toolbar-table-action span {
    display: inline-block;
    line-height: 26px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #d8dee8;
    padding: 18px 24px;
    background: #ffffff;
}

.topbar strong {
    display: block;
    font-size: 20px;
}

.topbar span {
    display: block;
    margin-top: 4px;
    color: #64748b;
    font-size: 13px;
}

.topbar-actions {
    display: flex;
    gap: 10px;
}

.kb-page {
    padding: 24px;
}

.kb-detail {
    min-height: 100vh;
}

.kb-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #d8dee8;
    padding: 18px 24px;
    background: #ffffff;
}

.kb-detail-header strong {
    display: block;
    font-size: 20px;
}

.kb-detail-header span {
    display: block;
    margin-top: 4px;
    color: #64748b;
    font-size: 13px;
}

.kb-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.kb-header-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    min-height: 34px;
    border: 1px solid #dbe3ee;
    border-radius: 7px;
    padding: 0 12px;
    color: #475569;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    font-size: 13px;
    font-weight: 700;
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.kb-header-action:hover {
    color: #0f172a;
    border-color: #b8c3d4;
    background: #f8fafc;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.kb-header-action-primary {
    color: #1d4ed8;
    border-color: #c9dcff;
    background: #f6f9ff;
}

.kb-header-action-primary:hover {
    color: #1e40af;
    border-color: #93c5fd;
    background: #eff6ff;
}

.kb-header-action-danger {
    color: #b42318;
    border-color: #ffd0ca;
    background: #fff8f7;
}

.kb-header-action-danger:hover {
    color: #991b1b;
    border-color: #fca5a5;
    background: #fff1f0;
}

.kb-header-action-icon {
    display: block;
    position: relative;
    top: 2px;
    width: 14px;
    height: 16px;
    flex: none;
    font-size: 13px;
    line-height: 16px;
    text-align: center;
}

.kb-header-action-icon::before {
    display: block;
    line-height: 16px;
}

.kb-header-action-text {
    display: block;
    height: 16px;
    line-height: 16px;
}

.kb-detail-body {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    height: calc(100vh - 73px);
    min-height: 0;
    overflow: hidden;
}

.kb-tree-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    border-right: 1px solid #d8dee8;
    padding: 18px;
    background: #ffffff;
    min-height: 0;
}

.kb-tree {
    overflow: auto;
    flex: 0 1 auto;
    min-height: 0;
    max-height: calc(100vh - 190px);
}

.tree-folder {
    margin-bottom: 14px;
    border-radius: 6px;
    padding: 4px;
    transition: background 0.16s ease;
}

.tree-folder.drag-over {
    background: #dbeafe;
}

.tree-folder-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.tree-folder-title button,
.tree-folder-title span {
    overflow: hidden;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-folder-title button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 28px;
    padding: 0;
    background: transparent;
    text-align: left;
}

.tree-folder-title button:hover {
    color: #2563eb;
    background: transparent;
}

.tree-folder-title .tree-folder-toggle {
    flex: 1;
    min-width: 0;
}

.tree-folder-title .tree-edit,
.tree-folder-title .tree-delete {
    flex: 0 0 auto;
    min-height: 24px;
    border-radius: 5px;
    padding: 0 8px;
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease;
}

.tree-folder-title:hover .tree-edit,
.tree-folder-title:hover .tree-delete,
.tree-folder-title:focus-within .tree-edit,
.tree-folder-title:focus-within .tree-delete {
    opacity: 1;
    pointer-events: auto;
}

.tree-folder-title .tree-edit {
    color: #2563eb;
    background: #dbeafe;
}

.tree-folder-title .tree-delete {
    color: #dc2626;
    background: #fee2e2;
}

.folder-icon {
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
    width: 18px;
    height: 14px;
    border-radius: 3px;
    background: #facc15;
    box-shadow: inset 0 -2px 0 rgba(146, 64, 14, 0.16);
}

.folder-icon::before {
    position: absolute;
    top: -4px;
    left: 2px;
    width: 8px;
    height: 5px;
    border-radius: 3px 3px 0 0;
    background: #fde68a;
    content: "";
}

.tree-folder.collapsed .folder-icon {
    background: #f59e0b;
}

.tree-pages {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-left: 25px;
}

.tree-page {
    position: relative;
    justify-content: flex-start;
    min-height: 34px;
    padding: 0 10px;
    color: #475569;
    background: #f8fafc;
    text-align: left;
}

.tree-page[draggable="true"] {
    cursor: grab;
}

.tree-page[draggable="true"]:active {
    cursor: grabbing;
}

.tree-page.dragging {
    opacity: 0.45;
}

.tree-page.drag-before::before,
.tree-page.drag-after::after {
    position: absolute;
    left: 8px;
    right: 8px;
    height: 2px;
    border-radius: 999px;
    background: #2563eb;
    content: "";
}

.tree-page.drag-before::before {
    top: -4px;
}

.tree-page.drag-after::after {
    bottom: -4px;
}

.tree-page:hover,
.tree-page.active {
    color: #334155;
    background: #e5e7eb;
}

.tree-page.active {
    box-shadow: inset 3px 0 0 #64748b;
}

.tree-empty {
    padding: 10px;
    color: #94a3b8;
    font-size: 13px;
}

.kb-tree-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    border-top: 1px solid #e5e7eb;
    padding-top: 12px;
}

.tree-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    min-height: 34px;
    border: 1px solid #dbe3ee;
    border-radius: 7px;
    padding: 0 10px;
    color: #475569;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    font-size: 13px;
    font-weight: 700;
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.tree-action:hover {
    color: #0f172a;
    border-color: #b8c3d4;
    background: #f8fafc;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.tree-action-primary {
    color: #1d4ed8;
    border-color: #c9dcff;
    background: #f6f9ff;
}

.tree-action-primary:hover {
    color: #1e40af;
    border-color: #93c5fd;
    background: #eff6ff;
}

.tree-action-icon {
    width: 14px;
    flex: none;
    font-size: 13px;
    line-height: 1;
    text-align: center;
}

.kb-page-preview {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
}

.page-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #d8dee8;
    padding: 18px 22px;
    background: #ffffff;
}

.page-preview-header strong {
    display: block;
    font-size: 18px;
}

.page-preview-header span {
    display: block;
    margin-top: 4px;
    color: #64748b;
    font-size: 13px;
}

.preview-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    background: transparent;
}

.preview-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    min-height: 32px;
    border: 1px solid #dbe3ee;
    border-radius: 6px;
    padding: 0 11px;
    color: #475569;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    font-size: 12px;
    font-weight: 600;
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.preview-action:hover {
    color: #0f172a;
    border-color: #b8c3d4;
    background: #f8fafc;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.preview-action-icon {
    display: block;
    position: relative;
    top: 2px;
    width: 14px;
    height: 16px;
    flex: none;
    font-size: 13px;
    line-height: 16px;
    text-align: center;
}

.preview-action-icon::before {
    display: block;
    line-height: 16px;
}

.preview-action-text {
    display: block;
    height: 16px;
    line-height: 16px;
}

.preview-action-primary {
    color: #1d4ed8;
    border-color: #c9dcff;
    background: #f6f9ff;
}

.preview-action-primary:hover {
    color: #1e40af;
    border-color: #93c5fd;
    background: #eff6ff;
}

.preview-action-danger {
    color: #b42318;
    border-color: #ffd0ca;
    background: #fff8f7;
}

.preview-action-danger:hover {
    color: #991b1b;
    border-color: #fca5a5;
    background: #fff1f0;
}

.preview-action:disabled,
.preview-action:disabled:hover {
    color: #94a3b8;
    border-color: #e2e8f0;
    background: #f8fafc;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.page-preview-shell {
    display: grid;
    min-height: 0;
    flex: 1;
    grid-template-columns: minmax(0, 1fr) 230px;
    background: #f8fafc;
}

.page-preview-content {
    overflow: auto;
    flex: 1;
    min-width: 0;
    min-height: 0;
    padding: 24px;
    color: #1f2937;
    background: #f8fafc;
    line-height: 1.75;
}

.article-toc-panel {
    overflow: hidden;
    display: flex;
    min-width: 0;
    min-height: 0;
    border-left: 1px solid #e2e8f0;
    flex-direction: column;
    background: #ffffff;
}

.article-toc-title {
    flex: none;
    border-bottom: 1px solid #edf2f7;
    padding: 16px 18px 12px;
    color: #0f172a;
    font-size: 14px;
    font-weight: 700;
}

.article-toc {
    overflow: auto;
    flex: 1;
    padding: 10px 10px 16px;
}

.article-toc-empty {
    padding: 8px;
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.6;
}

.article-toc-item {
    display: block;
    width: 100%;
    min-height: 30px;
    border: 0;
    border-radius: 6px;
    padding: 6px 8px;
    color: #64748b;
    background: transparent;
    font-size: 13px;
    line-height: 18px;
    text-align: left;
    word-break: break-word;
    transition: background 0.16s ease, color 0.16s ease;
}

.article-toc-item:hover {
    color: #1f2937;
    background: #f1f5f9;
}

.article-toc-item.active {
    color: #1d4ed8;
    background: #eff6ff;
    font-weight: 700;
}

.article-toc-level-2 {
    padding-left: 18px;
}

.article-toc-level-3 {
    padding-left: 28px;
}

.article-toc-level-4 {
    padding-left: 38px;
}

.article-toc-level-5 {
    padding-left: 48px;
}

.article-toc-level-6 {
    padding-left: 58px;
}

.preview-back-top {
    position: absolute;
    right: 22px;
    bottom: 22px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    min-height: 42px;
    border: 1px solid #cbd5e1;
    border-radius: 50%;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
    transition: opacity 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.preview-back-top.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.preview-back-top:hover {
    background: #f1f5f9;
}

.preview-back-top span {
    width: 13px;
    height: 13px;
    border-top: 3px solid #334155;
    border-left: 3px solid #334155;
    transform: translateY(4px) rotate(45deg);
}

.page-preview-content h1,
.page-preview-content h2,
.page-preview-content h3,
.page-preview-content h4,
.page-preview-content h5,
.page-preview-content h6,
.editormd-preview-container h1,
.editormd-preview-container h2,
.editormd-preview-container h3,
.editormd-preview-container h4,
.editormd-preview-container h5,
.editormd-preview-container h6 {
    margin: 1em 0 0.55em;
    color: #111827;
    font-weight: 700;
    line-height: 1.35;
}

.page-preview-content h1,
.editormd-preview-container h1 {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.3em;
    font-size: 2em;
}

.page-preview-content h2,
.editormd-preview-container h2 {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.25em;
    font-size: 1.5em;
}

.page-preview-content h3,
.editormd-preview-container h3 {
    font-size: 1.25em;
}

.page-preview-content p,
.page-preview-content ul,
.page-preview-content ol,
.page-preview-content blockquote,
.editormd-preview-container p,
.editormd-preview-container ul,
.editormd-preview-container ol,
.editormd-preview-container blockquote {
    margin: 0 0 1em;
}

.page-preview-content ul,
.page-preview-content ol,
.editormd-preview-container ul,
.editormd-preview-container ol {
    padding-left: 2em;
}

.page-preview-content blockquote,
.editormd-preview-container blockquote {
    border-left: 4px solid #cbd5e1;
    padding: 0.2em 1em;
    color: #475569;
    background: #f8fafc;
}

.page-preview-content img,
.editormd-preview-container img {
    max-width: 100%;
}

.page-preview-content table,
.editormd-preview-container table {
    display: table;
    width: 100%;
    margin: 14px 0;
    border: 1px solid #cbd5e1;
    border-collapse: collapse;
    background: #ffffff;
}

.page-preview-content th,
.page-preview-content td,
.editormd-preview-container th,
.editormd-preview-container td {
    border: 1px solid #cbd5e1;
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
}

.page-preview-content th,
.editormd-preview-container th {
    position: static;
    color: #334155;
    background: #f1f5f9;
    font-weight: 700;
}

.page-preview-content tr:nth-child(even) td,
.editormd-preview-container tr:nth-child(even) td {
    background: #f8fafc;
}

.page-preview-content pre,
.editormd-preview-container pre {
    overflow: auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px 14px;
    background: #f5f5f5;
}

.page-preview-content code,
.editormd-preview-container code {
    border-radius: 4px;
    padding: 2px 5px;
    color: #be123c;
    background: #ffe4e6;
    font-family: Consolas, "Microsoft YaHei", monospace;
    font-size: 13px;
}

.page-preview-content pre code,
.editormd-preview-container pre code {
    display: block;
    padding: 0;
    color: #333333;
    background: transparent;
    line-height: 1.65;
    white-space: pre;
}

.page-preview-content .prettyprint,
#articlePreview .prettyprint {
    border: 0;
}

.page-preview-content .pln,
#articlePreview .pln {
    color: #333333;
}

.page-preview-content .kwd,
#articlePreview .kwd {
    color: #000088;
}

.page-preview-content .str,
#articlePreview .str {
    color: #008800;
}

.page-preview-content .com,
#articlePreview .com {
    color: #880000;
    font-style: italic;
}

.page-preview-content .lit,
#articlePreview .lit {
    color: #006666;
}

.page-preview-content .pun,
.page-preview-content .opn,
.page-preview-content .clo,
#articlePreview .pun,
#articlePreview .opn,
#articlePreview .clo {
    color: #333333;
}

.page-preview-content .typ,
#articlePreview .typ {
    color: #660066;
}

.page-preview-content .tag,
#articlePreview .tag {
    color: #660066;
}

.page-preview-content .atn,
#articlePreview .atn {
    color: #660000;
}

.page-preview-content .atv,
#articlePreview .atv {
    color: #008800;
}

.kb-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    align-content: start;
}

.kb-card {
    position: relative;
    display: flex;
    min-height: 176px;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid #d8dee8;
    border-radius: 8px;
    background: #ffffff;
}

.kb-card:hover {
    border-color: #2563eb;
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.14);
}

.kb-open {
    display: flex;
    flex: 1;
    min-height: 126px;
    flex-direction: column;
    align-items: flex-start;
    border-radius: 8px 8px 0 0;
    padding: 18px;
    color: #172033;
    background: #ffffff;
    text-align: left;
}

.kb-open:hover {
    background: #f8fafc;
}

.kb-open strong {
    font-size: 18px;
}

.kb-open span {
    margin-top: 10px;
    color: #64748b;
    line-height: 1.55;
}

.kb-open em {
    margin-top: 18px;
    color: #2563eb;
    font-size: 13px;
    font-style: normal;
}

.kb-actions {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: flex;
    gap: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease;
}

.kb-actions button {
    min-height: 26px;
    border-radius: 5px;
    padding: 0 8px;
    font-size: 12px;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: none;
}

.modal.open {
    display: block;
}

.modal-mask {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
}

.modal-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    overflow: auto;
    transform: translate(-50%, -50%);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 18px;
}

.modal-header h1 {
    margin: 0;
    font-size: 18px;
}

.modal-header-actions {
    display: flex;
    gap: 10px;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
}

.modal-form label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
}

.modal-form textarea {
    min-height: 110px;
}

.user-manager-panel {
    width: min(860px, calc(100vw - 32px));
}

.user-table-wrap {
    max-height: min(560px, calc(100vh - 160px));
    overflow: auto;
}

.user-table-wrap table {
    min-width: 720px;
}

.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: none;
}

.confirm-modal.open {
    display: block;
}

.confirm-mask {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
}

.confirm-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(420px, calc(100vw - 32px));
    transform: translate(-50%, -50%);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

.confirm-header {
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 18px;
}

.confirm-header h1 {
    margin: 0;
    font-size: 18px;
}

.confirm-body {
    padding: 18px;
    color: #334155;
    line-height: 1.65;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid #e5e7eb;
    padding: 14px 18px;
}

.kb-card:hover .kb-actions,
.kb-card:focus-within .kb-actions {
    opacity: 1;
    pointer-events: auto;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    min-height: 36px;
    border: 0;
    border-radius: 6px;
    padding: 0 14px;
    color: #ffffff;
    background: #2563eb;
    cursor: pointer;
}

button:hover {
    background: #1d4ed8;
}

button:disabled {
    cursor: not-allowed;
    background: #9ca3af;
}

button.ghost {
    color: #334155;
    background: #e5e7eb;
}

button.ghost:hover {
    background: #d1d5db;
}

button.danger {
    background: #dc2626;
}

button.danger:hover {
    background: #b91c1c;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 9px 10px;
    color: #111827;
    background: #ffffff;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

textarea {
    resize: vertical;
}

.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 18px;
    border-right: 1px solid #d8dee8;
    padding: 22px;
    background: #ffffff;
}

.brand {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
}

.kb-desc {
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}

.primary-action {
    width: 100%;
}

.side-section {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
    gap: 12px;
}

.section-title {
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
}

.category-list {
    display: flex;
    overflow: auto;
    max-height: 260px;
    flex-direction: column;
    gap: 8px;
}

.category-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px;
    background: #f8fafc;
}

.category-item strong {
    display: block;
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-item span {
    display: block;
    margin-top: 4px;
    color: #64748b;
    font-size: 12px;
}

.category-item .mini-actions {
    display: flex;
    gap: 6px;
}

.category-item button {
    min-height: 28px;
    padding: 0 8px;
    font-size: 12px;
}

.category-form {
    display: flex;
    flex-direction: column;
    gap: 9px;
    border-top: 1px solid #e5e7eb;
    padding-top: 14px;
}

.row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.content {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.toolbar {
    border-bottom: 1px solid #d8dee8;
    padding: 18px 22px;
    background: #ffffff;
}

.filters {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 160px 180px 88px;
    gap: 10px;
}

.table-wrap {
    position: relative;
    overflow: auto;
    flex: 1;
    margin: 18px 22px 0;
    border: 1px solid #d8dee8;
    border-radius: 8px;
    background: #ffffff;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid #e5e7eb;
    padding: 13px 14px;
    text-align: left;
    vertical-align: middle;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #475569;
    background: #f8fafc;
    font-size: 13px;
    font-weight: 700;
}

td {
    font-size: 14px;
}

.title-cell {
    max-width: 420px;
}

.title-cell strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.title-cell span {
    display: block;
    overflow: hidden;
    margin-top: 4px;
    color: #64748b;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    height: 26px;
    border-radius: 999px;
    padding: 0 10px;
    font-size: 12px;
}

.status-0 {
    color: #92400e;
    background: #fef3c7;
}

.status-1 {
    color: #166534;
    background: #dcfce7;
}

.status-2 {
    color: #334155;
    background: #e2e8f0;
}

.table-actions {
    display: flex;
    gap: 8px;
}

.table-actions button {
    min-height: 30px;
    padding: 0 10px;
}

.empty {
    display: none;
    padding: 60px 0;
    color: #64748b;
    text-align: center;
}

.empty.show {
    display: block;
}

.pager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 22px 20px;
    color: #475569;
}

.drawer {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: none;
}

.drawer.open {
    display: block;
}

.drawer-mask {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
}

.drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    width: min(920px, 88vw);
    flex-direction: column;
    background: #ffffff;
    box-shadow: -8px 0 28px rgba(15, 23, 42, 0.2);
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e5e7eb;
    padding: 18px 22px;
}

.drawer-header h1 {
    margin: 0;
    font-size: 20px;
}

.article-form {
    display: flex;
    overflow: auto;
    flex: 1;
    flex-direction: column;
    gap: 16px;
    padding: 20px 22px 26px;
}

.article-form label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
}

.form-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 14px;
}

.editor-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
}

.content-editor {
    min-height: 360px;
    font-family: Consolas, "Microsoft YaHei", monospace;
    line-height: 1.62;
}

.preview {
    min-height: 390px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 12px 14px;
    background: #f8fafc;
}

.preview-title {
    margin-bottom: 10px;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
}

#articlePreview {
    overflow: auto;
    max-height: 342px;
    color: #1f2937;
    line-height: 1.72;
}

#articlePreview h1,
#articlePreview h2,
#articlePreview h3 {
    margin-top: 12px;
}

#articlePreview pre {
    overflow: auto;
    border-radius: 6px;
    padding: 10px;
    background: #e5e7eb;
}

#articlePreview blockquote {
    margin-left: 0;
    border-left: 4px solid #94a3b8;
    padding-left: 12px;
    color: #475569;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid #e5e7eb;
    padding-top: 16px;
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 30;
    display: none;
    max-width: 360px;
    border-radius: 8px;
    padding: 12px 16px;
    color: #ffffff;
    background: #0f172a;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.28);
}

.toast.show {
    display: block;
}

body.login-active .toast {
    top: 50%;
    right: auto;
    bottom: auto;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 260px;
    text-align: center;
}

@media (max-width: 900px) {
    body {
        min-width: 0;
    }

    .share-page {
        padding: 12px;
    }

    .share-kb-layout {
        grid-template-columns: 1fr;
    }

    .share-kb-nav {
        max-height: 260px;
        border-right: 0;
        border-bottom: 1px solid #e5e7eb;
    }

    .share-kb-reader {
        padding: 20px;
    }

    .kb-detail-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .kb-header-actions {
        flex-wrap: wrap;
        width: 100%;
    }

    .kb-header-action {
        flex: 1 1 calc(50% - 8px);
    }

    .page-preview-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .preview-actions {
        width: 100%;
    }

    .preview-action {
        flex: 1;
    }

    .page-preview-shell {
        grid-template-columns: 1fr;
    }

    .article-toc-panel {
        order: -1;
        max-height: 180px;
        border-left: 0;
        border-bottom: 1px solid #e2e8f0;
    }

    .article-toc-title {
        padding: 12px 16px 8px;
    }

    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid #d8dee8;
    }

    .filters,
    .form-grid,
    .editor-grid {
        grid-template-columns: 1fr;
    }

    .drawer-panel {
        width: 100vw;
    }
}
