/*
 *  comiis-editor.css — Comiis 风格富文本编辑器
 *  从 site.css 2310-2920 抽取,自带设计令牌,可不依赖主样式表
 *  适配场景:发帖页 / 快速回复框 / 后台编辑 modal
 */

:root {
    --kf-primary: #3B82F6;
    --kf-primary-dark: #2563EB;
    --kf-primary-light: #60A5FA;
    --kf-primary-lighter: #DBEAFE;
    --kf-danger: #EF4444;
    --kf-danger-light: #FEE2E2;
    --kf-body-bg: #F8FAFC;
    --kf-card-bg: #FFFFFF;
    --kf-surface-bg: #F1F5F9;
    --kf-surface-light: #F8FAFC;
    --kf-text-primary: #1E293B;
    --kf-text-secondary: #475569;
    --kf-text-muted: #94A3B8;
    --kf-text-disabled: #CBD5E1;
    --kf-text-white: #FFFFFF;
    --kf-border: #E2E8F0;
    --kf-border-light: #F1F5F9;
    --kf-radius-xs: 4px;
    --kf-radius-sm: 8px;
    --kf-radius-md: 12px;
    --kf-radius-lg: 16px;
    --kf-radius-full: 9999px;
    --kf-radius-circle: 50%;
    --kf-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --kf-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --kf-shadow-primary: 0 4px 16px rgba(59, 130, 246, 0.25);
}

/* ════════════════════════════════════════════
   Comiis 风格富文本编辑器
   适用于发帖页 & 快速回复框 & 后台编辑 modal
   ════════════════════════════════════════════ */

/* ── 编辑器页面容器 ── */
.comiis-editor-page {
    max-width: 1220px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}

/* ── CKEditor 5 编辑器包裹容器（替代旧 .ce-editor-wrap）── */
.json-editor {
    position: relative;
}
.json-editor__content {
    position: relative;
    min-height: 560px;
}
.json-editor__content > .ck.ck-editor,
.json-editor__content > .ck.ck-editor__main > .ck-editor__editable {
    min-height: 560px;
    border-radius: 0 0 var(--kf-radius-md) var(--kf-radius-md) !important;
}

/* ── 编辑器操作条（纯文本切换 + 提示文字）── */
.kf-editor-extrabar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    border-bottom: 1px solid var(--kf-border);
    background: #fafbfc;
    font-size: 13px;
}
.kf-editor-plain-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #555;
    user-select: none;
    font-size: 13px;
}
.kf-editor-plain-toggle input[type="checkbox"] {
    accent-color: var(--kf-primary);
    width: 15px; height: 15px;
    cursor: pointer;
}
.kf-editor-plain-toggle:hover { color: var(--kf-primary); }
.kf-editor-hint {
    color: #999;
    font-size: 12px;
}

/* ── 面包屑 ── */
.ce-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #888;
    margin-bottom: 18px;
    padding: 10px 14px;
    background: var(--kf-card-bg);
    border-radius: var(--kf-radius-sm);
}
.ce-breadcrumb a { color: #666; text-decoration: none; transition: color .2s; }
.ce-breadcrumb a:hover { color: var(--kf-primary); }
.ce-bc-sep { color: #ccc; font-size: 11px; }
.ce-bc-current { color: #333; }
.ce-home-icon {
    width: 15px; height: 15px;
    vertical-align: -2px;
    fill: #999;
}
.ce-edit-btn {
    margin-left: auto;
    color: #e74c3c !important;
    font-size: 12px;
}

/* ── 主容器 ── */
.ce-container {
    background: #fff;
    border: 1px solid var(--kf-border);
    border-radius: var(--kf-radius-md);
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* ── Tab 切换栏 ── */
.ce-tabs {
    display: flex;
    align-items: center;
    gap: 0;
    border-bottom: 1px solid var(--kf-border);
    background: linear-gradient(to bottom, #fafbfc, #f5f6f8);
    padding: 0 16px;
}
.ce-tab {
    display: inline-flex;
    align-items: center;
    padding: 13px 18px;
    font-size: 14px;
    color: #555;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all .2s ease;
    cursor: pointer;
    position: relative;
    top: 1px;
}
.ce-tab:hover { color: var(--kf-primary); background: rgba(0,0,0,.02); }
.ce-tab-active {
    color: var(--kf-primary);
    border-bottom-color: var(--kf-primary);
    font-weight: 600;
}

/* ── 标题输入行 ── */
.ce-title-row {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    gap: 16px;
    border-bottom: 1px solid var(--kf-border);
}
.ce-title-input {
    flex: 1;
    height: 42px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0 14px;
    font-size: 15px;
    outline: none;
    transition: border-color .2s;
    font-family: inherit;
}
.ce-title-input:focus {
    border-color: var(--kf-primary);
    box-shadow: 0 0 0 3px rgba(65,130,240,.08);
}
.ce-title-count {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── 工具栏外层 ── */
.ce-toolbar-wrap {
    position: relative;
    border-bottom: 1px solid var(--kf-border);
}

/* ── 工具栏主体 ── */
.ce-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    padding: 8px 10px;
    background: #fbfcfd;
    min-height: 46px;
}

/* 分隔线 */
.ce-tb-sep {
    width: 1px;
    height: 22px;
    background: #ddd;
    margin: 0 4px;
    flex-shrink: 0;
}

/* 按钮组 */
.ce-tb-group {
    display: flex;
    align-items: center;
    gap: 1px;
}

/* 下拉选择(字体/大小) */
.ce-tb-select {
    height: 30px;
    border: 1px solid #d0d5dd;
    border-radius: 5px;
    padding: 0 22px 0 8px;
    font-size: 12px;
    color: #555;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E") no-repeat right 7px center;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    outline: none;
    transition: border-color .2s;
}
.ce-tb-select:focus { border-color: var(--kf-primary); }

/* 工具栏按钮 */
.ce-tb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 6px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: #444;
    font-size: 14px;
    cursor: pointer;
    transition: all .15s ease;
    line-height: 1;
}
.ce-tb-btn:hover {
    background: #e8f0fe;
    border-color: #c0d3ef;
    color: var(--kf-primary);
}
.ce-tb-btn:active {
    background: #d0e2f8;
    transform: scale(.95);
}

/* 颜色按钮特殊样式 */
.ce-tb-color {
    position: relative;
    overflow: visible;
    flex-direction: column;
    padding: 2px 6px !important;
    min-width: 32px;
}
.ce-color-icon {
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}
.ce-fg-icon { color: #333; }
.ce-bg-icon { color: #d4a000; text-decoration: underline; }
.ce-color-bar {
    display: block;
    width: 100%;
    height: 3px;
    border-radius: 0 0 3px 3px;
    margin-top: 1px;
}

/* 右侧控制区 */
.ce-tb-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.ce-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    user-select: none;
}
.ce-toggle input[type="checkbox"] {
    accent-color: var(--kf-primary);
    width: 14px; height: 14px;
}
.ce-toggle:hover span { color: var(--kf-primary); }

/* ── 颜色选择器弹出层 ── */
.ce-color-picker {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 99999;
    background: #fff;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0,0,0,.15);
    padding: 12px;
    animation: ceFadeIn .15s ease;
}
@keyframes ceFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ce-color-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}
.ce-color-swatch {
    display: block;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform .1s, border-color .1s;
}
.ce-color-swatch:hover {
    transform: scale(1.25);
    border-color: #333;
}

/* ── 编辑区域 ── */
.ce-editor-wrap {
    position: relative;
}
.ce-editor-area {
    min-height: 320px;
    max-height: 600px;
    overflow-y: auto;
    padding: 20px 22px;
    font-size: 15px;
    line-height: 1.85;
    color: #222;
    outline: none;
    word-break: break-word;
    transition: max-height .3s ease;
}
.ce-editor-area:empty:before {
    content: attr(placeholder);
    color: #bbb;
    pointer-events: none;
    font-size: 14px;
}
.ce-editor-area:focus { background: #fefefe; }
/* 编辑区内部样式 */
.ce-editor-area img {
    max-width: 100%;
    border-radius: 6px;
    margin: 8px 0;
}
.ce-editor-area table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
}
.ce-editor-area th,
.ce-editor-area td {
    border: 1px solid #dde2ea;
    padding: 8px 12px;
    text-align: left;
}
.ce-editor-area th { background: #f5f7fa; font-weight: 600; }
.ce-editor-area pre {
    background: #282c34;
    color: #abb2bf;
    padding: 16px 18px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Consolas','Monaco','Courier New',monospace;
    font-size: 13px;
    line-height: 1.6;
    margin: 12px 0;
}
.ce-editor-area code {
    background: #f0f2f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Consolas','Monaco',monospace;
    color: #e74c3c;
}
.ce-editor-area pre code { background: none; padding: 0; color: inherit; }
.ce-editor-area pre.ce-code-block {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 16px 20px;
    margin: 12px 0;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Consolas','Monaco','Courier New',monospace;
    font-size: 13px;
    line-height: 1.6;
    border: 1px solid #333;
    position: relative;
}
.ce-editor-area pre.ce-code-block::before {
    content: attr(class);
    display: none;
}
.ce-editor-area pre.ce-code-block code {
    background: none;
    padding: 0;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
}
.ce-editor-area blockquote {
    border-left: 4px solid var(--kf-primary);
    margin: 12px 0;
    padding: 10px 16px;
    background: #f8faff;
    color: #555;
    border-radius: 0 8px 8px 0;
    font-style: italic;
}
.ce-editor-area hr { border: none; border-top: 1px solid #eee; margin: 16px 0; }
.ce-editor-area p { margin: 6px 0; }
.ce-editor-area ul, .ce-editor-area ol { padding-left: 24px; margin: 8px 0; }

/* 大编辑器模式 */
.ce-editor-big .ce-editor-area { min-height: 600px; max-height: 800px; }

/* 纯文本模式 textarea */
.ce-textarea-plain {
    width: 100%;
    min-height: 300px;
    padding: 20px 22px;
    border: none;
    font-size: 15px;
    line-height: 1.85;
    resize: vertical;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
}

/* 预览模式 */
.ce-preview-mode { background: #fafbfd; cursor: default; }

/* ── 底部状态栏 ── */
.ce-statusbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    border-top: 1px solid var(--kf-border);
    background: #fafbfc;
    font-size: 12px;
    color: #aaa;
}
.ce-status-left, .ce-status-right {
    display: flex;
    align-items: center;
    gap: 4px;
}
.ce-status-item { color: #999; }
.ce-status-sep { color: #e0e0e0; margin: 0 2px; }
.ce-status-link {
    color: var(--kf-primary);
    text-decoration: none;
    cursor: pointer;
    transition: color .2s;
}
.ce-status-link:hover { text-decoration: underline; color: var(--kf-primary); }

/* ── 扩展选项行 ── */
.ce-options-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-top: 1px solid var(--kf-border);
    font-size: 13px;
}
.ce-opt-label {
    color: #666;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 4px;
    transition: all .2s;
}
.ce-opt-label:hover { color: var(--kf-primary); background: rgba(65,130,240,.05); }
.ce-opt-sep { color: #e0e0e0; font-size: 10px; }

/* ── 提交操作区 ── */
.ce-submit-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-top: 1px solid var(--kf-border);
    background: #fdfdfd;
}
.ce-submit-left { display: flex; align-items: center; gap: 16px; }
.ce-submit-right { flex-shrink: 0; }

/* 发表按钮 */
.ce-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 32px;
    background: var(--kf-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s ease;
    letter-spacing: .5px;
}
.ce-submit-btn:hover {
    background: #3a68ca;
    box-shadow: 0 4px 12px rgba(65,130,240,.35);
    transform: translateY(-1px);
}
.ce-submit-btn:active { transform: translateY(0); }
.ce-submit-btn:disabled { background: #ccc; cursor: not-allowed; box-shadow: none; transform: none; }

/* 复选框项 */
.ce-check-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
}
.ce-check-item input[type="checkbox"] { accent-color: var(--kf-primary); width: 14px; height: 14px; }

/* 小下拉框 */
.ce-select-sm {
    height: 30px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0 24px 0 10px;
    font-size: 12px;
    color: #666;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E") no-repeat right 8px center;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    cursor: pointer;
}
.ce-select-sm:focus { border-color: var(--kf-primary); }

/* 积分规则链接 */
.ce-rule-link { font-size: 12px; color: var(--kf-primary); text-decoration: none; }
.ce-rule-link:hover { text-decoration: underline; }

/* ── 全屏模式 ── */
body.ce-fullscreen-mode { overflow: hidden !important; }
body.ce-fullscreen-mode .ce-breadcrumb { display: none; }
body.ce-fullscreen-mode .ce-tabs { position: sticky; top: 0; z-index: 10; }

/* ── Modal 嵌入适配(后台编辑用) ── */
.ce-modal-host {
    /* 在 admin/threads modal 中保证编辑器撑开容器 */
    width: 100%;
}
.ce-modal-host .ce-container {
    border-radius: var(--kf-radius-sm);
    box-shadow: none;
}
.ce-modal-host .ce-editor-area { min-height: 240px; }
.ce-modal-host .ce-tabs { display: none; }
.ce-modal-host .ce-options-row { display: none; }
.ce-modal-host .ce-submit-row { display: none; }

/* ── 表情选择器 ── */
.ce-emoji-picker {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 99999;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0,0,0,.2);
    padding: 16px;
    min-width: 280px;
    max-width: 400px;
}
.ce-emoji-picker-title {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}
.ce-emoji-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
}
.ce-emoji-cell {
    cursor: pointer;
    font-size: 22px;
    padding: 4px;
    border-radius: 4px;
    line-height: 1;
}
.ce-emoji-cell:hover { background: #eee; }

.ce-image-panel {
    position: fixed; z-index: 100001;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 520px; max-width: 92vw; max-height: 80vh;
    background: #f5f5f5; border: 2px solid #ddd; border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
    display: flex; flex-direction: column;
    overflow: hidden;
    font-size: 13px; color: #333;
}
.ce-image-panel * { box-sizing: border-box; }
.ce-image-title {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; background: #fafafa; border-bottom: 1px solid #ddd;
    font-size: 14px; font-weight: bold; color: #333;
}
.ce-image-close {
    width: 22px; height: 22px; line-height: 20px; text-align: center;
    background: #bbb; color: #fff; border-radius: 2px; cursor: pointer;
    text-decoration: none; font-size: 16px; font-weight: bold;
}
.ce-image-close:hover { background: #999; }
.ce-image-tabs {
    display: flex; border-bottom: 1px solid #ddd; background: #eee;
}
.ce-image-tab {
    padding: 8px 16px; font-size: 13px; color: #666; cursor: pointer;
    border-bottom: 2px solid transparent; user-select: none;
    transition: all .15s;
}
.ce-image-tab:hover { color: #333; }
.ce-image-tab-active {
    color: #333; background: #fff; border-bottom-color: #3186c3;
    font-weight: bold;
}
.ce-image-body {
    padding: 12px; min-height: 180px; max-height: 50vh; overflow-y: auto;
    background: #fff;
}
.ce-image-upload-row { margin-bottom: 10px; }
.ce-image-upload-btn {
    display: inline-block; padding: 4px 14px; font-size: 13px;
    color: #fff; background: #3186c3; border: 1px solid #2a72a8;
    border-radius: 3px; cursor: pointer; text-decoration: none;
    transition: background .15s;
}
.ce-image-upload-btn:hover { background: #2a72a8; }
.ce-image-hints {
    color: #666; font-size: 12px; line-height: 1.7; margin-bottom: 10px;
}
.ce-image-hints .warning {
    color: #c00; display: inline-flex; align-items: center; gap: 4px;
}
.ce-image-hints .warning::before {
    content: '▲'; font-size: 10px;
}
.ce-image-list {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px;
    list-style: none; padding: 0;
}
.ce-image-list-item {
    width: 80px; height: 80px; border: 1px solid #ddd; border-radius: 2px;
    overflow: hidden; position: relative; cursor: pointer; background: #f9f9f9;
}
.ce-image-list-item img {
    width: 100%; height: 100%; object-fit: cover;
}
.ce-image-list-item .del {
    position: absolute; top: 0; right: 0; width: 16px; height: 16px;
    background: rgba(0,0,0,.6); color: #fff; font-size: 11px; line-height: 16px;
    text-align: center; cursor: pointer; display: none;
}
.ce-image-list-item:hover .del { display: block; }
.ce-image-list-item .inserted {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: rgba(49,134,195,.85); color: #fff; font-size: 11px;
    text-align: center; padding: 2px 0; display: none;
    pointer-events: none;
}
.ce-image-list-item.inserted .inserted { display: block; }
.ce-image-url-row { display: flex; gap: 8px; }
.ce-image-url-input {
    flex: 1; height: 32px; border: 1px solid #ccc; border-radius: 3px;
    padding: 0 8px; font-size: 13px;
}
.ce-image-url-go {
    height: 32px; padding: 0 16px; background: #3186c3; color: #fff;
    border: 1px solid #2a72a8; border-radius: 3px; cursor: pointer; font-size: 13px;
}
.ce-image-url-go:hover { background: #2a72a8; }
.ce-image-footer {
    display: flex; justify-content: flex-end; align-items: center;
    padding: 10px 12px; background: #eee; border-top: 1px solid #ddd;
}
.ce-image-confirm-btn {
    padding: 5px 16px; font-size: 13px; color: #fff;
    background: #3186c3; border: 1px solid #2a72a8; border-radius: 3px; cursor: pointer;
}
.ce-image-confirm-btn:hover { background: #2a72a8; }

/* ════════════════════════════════════════════
   附件上传面板 (Discuz 风格)
   ════════════════════════════════════════════ */
.ce-attach-panel {
    position: fixed; z-index: 100001;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 580px; max-width: 92vw; max-height: 80vh;
    background: #f5f5f5; border: 2px solid #ddd; border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
    display: flex; flex-direction: column;
    overflow: hidden;
    font-size: 13px; color: #333;
}
.ce-attach-panel * { box-sizing: border-box; }
.ce-attach-title {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; background: #fafafa; border-bottom: 1px solid #ddd;
    font-size: 14px; font-weight: bold; color: #333;
}
.ce-attach-close {
    width: 22px; height: 22px; line-height: 20px; text-align: center;
    background: #bbb; color: #fff; border-radius: 2px; cursor: pointer;
    text-decoration: none; font-size: 16px; font-weight: bold;
}
.ce-attach-close:hover { background: #999; }
.ce-attach-body2 { padding: 12px; overflow-y: auto; flex: 1; }
.ce-attach-upload-row {
    margin-bottom: 12px;
}
.ce-attach-upload-btn {
    display: inline-block; padding: 4px 14px; font-size: 13px;
    color: #fff; background: #3186c3; border: 1px solid #2a72a8;
    border-radius: 3px; cursor: pointer; text-decoration: none;
    transition: background .15s;
}
.ce-attach-upload-btn:hover { background: #2a72a8; }
.ce-attach-hints {
    color: #666; font-size: 12px; line-height: 1.7; margin-bottom: 10px;
}
.ce-attach-hints .warning {
    color: #c00; display: inline-flex; align-items: center; gap: 4px;
}
.ce-attach-hints .warning::before {
    content: '▲'; font-size: 10px;
}
.ce-attach-progress {
    background: #f8f9fa; border: 1px solid #e0e0e0; border-radius: 6px;
    margin-bottom: 10px; overflow: hidden; padding: 8px 10px;
}
.ce-attach-progress-info {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 12px; color: #555; margin-bottom: 6px;
    line-height: 1.4;
}
.ce-attach-progress-info [data-cmd="attach-progress-file"] {
    max-width: 60%; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; color: #3186c3; font-weight: 500;
}
.ce-attach-progress-info [data-cmd="attach-progress-pct"] {
    font-weight: 600; color: #3186c3; min-width: 36px; text-align: right;
}
.ce-attach-progress-bar-wrap {
    height: 8px; background: #e8eaed; border-radius: 4px; overflow: hidden;
}
.ce-attach-progress-bar {
    height: 100%; width: 0; background: linear-gradient(90deg, #3186c3, #4a9be8);
    border-radius: 4px; transition: width .2s ease;
    position: relative;
}
.ce-attach-progress-bar::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.3), transparent);
    animation: ceProgressShimmer 1.5s infinite;
}
@keyframes ceProgressShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
.ce-attach-list-header {
    display: flex; background: #e9e9e9; border: 1px solid #ddd; border-bottom: 0;
    padding: 6px 8px; font-size: 12px; font-weight: bold; color: #555;
}
.ce-attach-list-header .col-name { width: 35%; }
.ce-attach-list-header .col-desc { width: 25%; }
.ce-attach-list-header .col-read { width: 20%; }
.ce-attach-list-header .col-price { width: 20%; }
.ce-attach-list {
    list-style: none; margin: 0; padding: 0;
    border: 1px solid #ddd; border-top: 0; background: #fff;
    max-height: 200px; overflow-y: auto;
}
.ce-attach-list-item {
    display: flex; align-items: center; padding: 6px 8px;
    border-bottom: 1px solid #eee; font-size: 12px;
}
.ce-attach-list-item:last-child { border-bottom: 0; }
.ce-attach-list-hint {
    display: flex; align-items: center; padding: 6px 8px;
    border-bottom: 1px solid #eee; font-size: 12px;
    background: #f8fbff; color: #3186c3; cursor: default;
}
.ce-attach-list-hint:last-child { border-bottom: 0; }
.ce-attach-list-item .col-name { width: 35%; display: flex; align-items: center; gap: 4px; }
.ce-attach-list-item .col-name a {
    color: #369; cursor: pointer; text-decoration: none;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ce-attach-list-item .col-name a:hover { text-decoration: underline; }
.ce-attach-list-item .col-desc { width: 25%; padding-right: 6px; }
.ce-attach-list-item .col-desc input {
    width: 100%; height: 24px; border: 1px solid #ccc; border-radius: 2px; padding: 0 4px; font-size: 12px;
}
.ce-attach-list-item .col-read { width: 20%; padding-right: 6px; }
.ce-attach-list-item .col-read select {
    width: 100%; height: 24px; border: 1px solid #ccc; border-radius: 2px; font-size: 12px; padding: 0 2px;
}
.ce-attach-list-item .col-price { width: 20%; padding-right: 6px; }
.ce-attach-list-item .col-price input {
    width: 100%; height: 24px; border: 1px solid #ccc; border-radius: 2px; padding: 0 4px; font-size: 12px;
}
.ce-attach-list-item .col-action {
    width: 24px; text-align: center; color: #c00; cursor: pointer; font-size: 14px;
}
.ce-attach-list-item .col-action:hover { color: #900; }
.ce-attach-list-empty {
    padding: 16px; text-align: center; color: #999; font-size: 12px;
}
.ce-attach-footer {
    display: flex; justify-content: flex-end; align-items: center;
    padding: 10px 12px; background: #eee; border-top: 1px solid #ddd;
}
.ce-attach-confirm-btn {
    padding: 5px 16px; font-size: 13px; color: #fff;
    background: #3186c3; border: 1px solid #2a72a8; border-radius: 3px; cursor: pointer;
}
.ce-attach-confirm-btn:hover { background: #2a72a8; }

/* ═══ 响应式:编辑器 ═══ */
@media (max-width: 900px) {
    .ce-toolbar { gap: 1px; padding: 6px 8px; }
    .ce-tb-group:nth-child(n+7) { display: none; }
    .ce-tb-right { display: none; }
    .ce-editor-area { min-height: 250px; padding: 14px 16px; }
    .ce-options-row { flex-wrap: wrap; }
    .ce-submit-row { flex-direction: column; align-items: flex-start; gap: 12px; }
    .ce-submit-left { flex-wrap: wrap; gap: 10px; }
}
@media (max-width: 600px) {
    .ce-container { border-radius: 8px; }
    .ce-tab { padding: 10px 12px; font-size: 13px; }
    .ce-title-input { height: 38px; font-size: 14px; }
    .ce-tb-btn { min-width: 28px; height: 28px; font-size: 13px; }
    .ce-tb-sep { display: none; }
    .ce-tb-select { display: none; }
    .ce-editor-area { min-height: 200px; padding: 12px; }
    .ce-submit-btn { width: 100%; }
}

/* ════════════════════════════════════════════
   DZX5.0 高级模式:附件 + 标签 + 高级模式面板
   ════════════════════════════════════════════ */

/* ── 附件面板 ── */
.ce-attach-panel {
    position: fixed; z-index: 99999;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: min(560px, 92vw); max-height: 80vh;
    background: #fff; border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    display: flex; flex-direction: column;
    overflow: hidden;
    animation: ceFadeIn .18s ease;
}
.ce-attach-panel * { box-sizing: border-box; }
.ce-attach-tabs {
    display: flex; border-bottom: 1px solid #eee;
    background: #fafbfc; position: relative;
}
.ce-attach-tab {
    flex: 1; padding: 12px 0; text-align: center;
    font-size: 14px; color: #666; cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all .2s; user-select: none;
}
.ce-attach-tab:hover { color: #3071F2; }
.ce-attach-tab.active {
    color: #3071F2; border-bottom-color: #3071F2;
    font-weight: 600; background: #fff;
}
.ce-attach-body { padding: 20px; overflow-y: auto; flex: 1; }
.ce-attach-close {
    position: absolute; top: 10px; right: 10px;
    width: 28px; height: 28px; border-radius: 50%;
    background: #f5f5f5; border: none; cursor: pointer;
    color: #666; font-size: 16px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    z-index: 2;
}
.ce-attach-close:hover { background: #e0e0e0; color: #333; }
.ce-attach-drop {
    border: 2px dashed #d0d5dd; border-radius: 10px;
    padding: 32px 16px; text-align: center;
    color: #999; cursor: pointer;
    transition: all .2s; background: #fafbfc;
    position: relative;
}
.ce-attach-drop input[type="file"] { display: none; }
.ce-attach-drop:hover, .ce-attach-drop.dragover {
    border-color: #3071F2; background: #f0f6ff; color: #3071F2;
}
.ce-attach-drop .ce-attach-icon { font-size: 36px; margin-bottom: 6px; }
.ce-attach-drop strong { color: #3071F2; }
.ce-attach-hint { font-size: 12px; color: #999; margin-top: 8px; line-height: 1.6; }
.ce-attach-url-row { display: flex; gap: 8px; }
.ce-attach-url-row input {
    flex: 1; height: 38px; border: 1px solid #ddd;
    border-radius: 6px; padding: 0 12px; font-size: 13px;
    outline: none; transition: border-color .2s;
}
.ce-attach-url-row input:focus { border-color: #3071F2; }
.ce-attach-url-row button {
    height: 38px; padding: 0 18px;
    background: #3071F2; color: #fff; border: none;
    border-radius: 6px; cursor: pointer; font-size: 13px;
    transition: background .2s;
}
.ce-attach-url-row button:hover { background: #2559d1; }
.ce-attach-list { margin-top: 16px; }
.ce-attach-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border: 1px solid #eee;
    border-radius: 8px; margin-bottom: 8px;
    background: #fff; transition: all .15s;
}
.ce-attach-item:hover { border-color: #3071F2; background: #fafcff; }
.ce-attach-icon { font-size: 20px; flex-shrink: 0; }
.ce-attach-info { flex: 1; min-width: 0; }
.ce-attach-name {
    font-size: 13px; color: #333;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ce-attach-size { font-size: 11px; color: #999; margin-top: 2px; }
.ce-attach-progress {
    height: 4px; background: #f0f2f5; border-radius: 2px;
    overflow: hidden; margin-top: 6px;
}
.ce-attach-progress-bar {
    height: 100%; background: #3071F2; width: 0%;
    transition: width .2s;
}
.ce-attach-del {
    width: 24px; height: 24px; border-radius: 50%;
    background: #fee; color: #e74c3c; border: none;
    cursor: pointer; font-size: 14px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.ce-attach-del:hover { background: #fcc; }
.ce-attach-empty {
    text-align: center; color: #ccc; padding: 24px;
    font-size: 13px;
}
.ce-attach-loading {
    text-align: center; padding: 20px; color: #999;
    font-size: 13px;
}
.ce-attach-queue { margin-top: 12px; }

/* ── 附件上传权限设置行 ── */
.ce-attach-perm-row {
    display: flex; gap: 12px; margin-bottom: 12px;
    flex-wrap: wrap; align-items: center;
    padding: 10px 14px; background: #f8f9fb;
    border: 1px solid #eee; border-radius: 8px;
}
.ce-attach-perm-field {
    display: flex; align-items: center; gap: 4px;
    font-size: 12px; color: #555;
}
.ce-attach-perm-field input[type="number"] {
    width: 60px; height: 28px; border: 1px solid #ddd;
    border-radius: 4px; padding: 0 6px; font-size: 12px;
    outline: none; transition: border-color .2s;
}
.ce-attach-perm-field input[type="number"]:focus {
    border-color: #3071F2;
}
.ce-attach-perm-field input[type="checkbox"] {
    accent-color: #3071F2; cursor: pointer;
}
.ce-attach-perm-hint {
    font-size: 11px; color: #999; margin-left: auto;
}

/* ── 标签面板 ── */
.ce-tag-panel {
    position: fixed; z-index: 99999;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: min(420px, 90vw);
    background: #fff; border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    padding: 20px;
    animation: ceFadeIn .18s ease;
}
.ce-tag-panel * { box-sizing: border-box; }
.ce-tag-title {
    font-size: 15px; font-weight: 600;
    color: #333; margin-bottom: 12px;
    display: flex; justify-content: space-between; align-items: center;
}
.ce-tag-hint { font-size: 11px; color: #999; font-weight: normal; }
.ce-tag-list {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 10px; min-height: 44px;
    border: 1px solid #eee; border-radius: 8px;
    background: #fafbfc; margin-bottom: 10px;
}
.ce-tag-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; background: #e8f0fe; color: #3071F2;
    border-radius: 14px; font-size: 12px; font-weight: 500;
}
.ce-tag-chip span {
    cursor: pointer; opacity: .6; padding: 0 2px;
    font-size: 14px; line-height: 1;
}
.ce-tag-chip span:hover { opacity: 1; color: #e74c3c; }
.ce-tag-input-row { display: flex; gap: 8px; }
.ce-tag-input {
    flex: 1; height: 36px; border: 1px solid #ddd;
    border-radius: 6px; padding: 0 12px; font-size: 13px;
    outline: none; transition: border-color .2s;
}
.ce-tag-input:focus { border-color: #3071F2; }
.ce-tag-confirm {
    height: 36px; padding: 0 16px;
    background: #3071F2; color: #fff; border: none;
    border-radius: 6px; cursor: pointer; font-size: 13px;
    transition: background .2s;
}
.ce-tag-confirm:hover { background: #2559d1; }

/* ── 高级模式面板 ── */
.ce-advanced-panel {
    border: 1px solid var(--kf-border);
    border-radius: var(--kf-radius-md);
    background: #fafbfc; margin: 0 20px 16px;
    overflow: hidden;
    transition: all .25s ease;
}
.ce-advanced-panel * { box-sizing: border-box; }
.ce-advanced-collapsed .ce-advanced-body { display: none; }
.ce-advanced-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; cursor: pointer;
    background: linear-gradient(to bottom, #f5f7fa, #eef0f4);
    user-select: none;
    font-size: 13px; color: #555;
    transition: background .2s;
}
.ce-advanced-header:hover { background: #e8eef7; color: #3071F2; }
.ce-advanced-title { display: flex; align-items: center; gap: 6px; }
.ce-advanced-arrow {
    transition: transform .25s ease;
    font-size: 11px; color: #999; display: inline-block;
}
.ce-advanced-collapsed .ce-advanced-arrow { transform: rotate(-90deg); }
.ce-advanced-body {
    padding: 16px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px 20px;
}
.ce-advanced-section {
    grid-column: 1 / -1;
    font-size: 12px; color: #3071F2;
    font-weight: 600; padding-bottom: 4px;
    border-bottom: 1px dashed #d0d5dd;
    margin-bottom: 4px;
    display: flex; align-items: center; gap: 6px;
}
.ce-advanced-field {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; color: #444;
}
.ce-advanced-field label {
    cursor: pointer; user-select: none;
    display: flex; align-items: center; gap: 4px;
}
.ce-advanced-field input[type="number"],
.ce-advanced-field input[type="text"] {
    width: 90px; height: 28px; border: 1px solid #ddd;
    border-radius: 4px; padding: 0 6px; font-size: 12px;
    outline: none; transition: border-color .2s;
}
.ce-advanced-field input[type="number"]:focus,
.ce-advanced-field input[type="text"]:focus { border-color: #3071F2; }
.ce-advanced-field select {
    height: 28px; border: 1px solid #ddd; border-radius: 4px;
    padding: 0 6px; font-size: 12px; outline: none;
    background: #fff;
}
.ce-advanced-field input[type="checkbox"] { accent-color: #3071F2; cursor: pointer; }

/* 高级模式响应式 */
@media (max-width: 700px) {
    .ce-advanced-body { grid-template-columns: 1fr; gap: 10px; }
    .ce-attach-panel, .ce-tag-panel { width: 95vw; }
}
