/*!
 * 牛马帖子表格插件 - PC 样式
 * 设计原则：CSS 变量驱动配色、精致边框、协调间距、适度动画
 * 所有元素使用 .nm-pt- 前缀，避免与论坛主题样式冲突
 * 视觉风格：表格渲染支持暗色主题（obsidian），模态框用浅色（白色背景）更利于编辑
 * 禁用 backdrop-filter:blur()，性能与兼容优先
 */

/* ==================== A. 表格渲染样式（帖子页展示） ====================
   默认变量对应 coral 主题（与 install.php 预设一致）
   .nm-pt-theme-{key} 类由 service getThemesCss() 注入覆盖变量
   单表格自定义配色由表格容器 inline style 覆盖 */
.nm-pt-table{
    --nm-pt-header-bg:#e07856;
    --nm-pt-header-text:#ffffff;
    --nm-pt-border:#e8d5cc;
    --nm-pt-row-bg:#fdf8f5;
    --nm-pt-row-alt-bg:#f7ede6;
    --nm-pt-hover-bg:#f3e0d6;
    --nm-pt-caption-bg:#e07856;
    --nm-pt-caption-text:#ffffff;

    position:relative;
    box-sizing:border-box;
    margin:10px 0;
    border:1px solid var(--nm-pt-border);
    border-radius:8px;
    overflow:hidden;
    font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
    font-size:14px;
    line-height:1.5;
    color:#1a1d26;
    background:var(--nm-pt-row-bg);
}
.nm-pt-table *{box-sizing:border-box;}

/* 表格标题 caption */
.nm-pt-caption{
    background:var(--nm-pt-caption-bg);
    color:var(--nm-pt-caption-text);
    padding:9px 14px;
    font-weight:600;
    font-size:14px;
    letter-spacing:0.2px;
    text-align:center;
}

/* 横向滚动容器（窄屏表格不撑破布局） */
.nm-pt-scroll{
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
}

/* 横向拖动提示：默认显示，JS 检测不可滚动时加 .nm-pt-no-scroll 隐藏 */
.nm-pt-scroll-hint{
    display:block;
    text-align:center;
    padding:5px 8px;
    font-size:11px;
    color:#9ca3af;
    letter-spacing:0.3px;
    background:rgba(0,0,0,0.02);
    border-top:1px dashed rgba(0,0,0,0.06);
}
.nm-pt-scroll-hint.nm-pt-hidden{
    display:none;
}

/* 表格主体 */
.nm-pt-table table{
    border-collapse:collapse;
    width:100%;
    background:var(--nm-pt-row-bg);
    border-spacing:0;
    table-layout:fixed;
}
.nm-pt-table th{
    background:var(--nm-pt-header-bg);
    color:var(--nm-pt-header-text);
    padding:9px 12px;
    border:1px solid var(--nm-pt-border);
    font-weight:600;
    text-align:left;
    white-space:normal;
    word-break:break-word;
}
.nm-pt-table td{
    padding:8px 12px;
    border:1px solid var(--nm-pt-border);
    vertical-align:middle;
    word-break:break-word;
    color:var(--nm-pt-row-text,#1a1d26);
}

/* 斑马纹：偶数行单元格底色（应用到 td/th 而非 tr，避免合并单元格跨行斑马纹错乱） */
.nm-pt-striped tbody tr:nth-child(even) td,
.nm-pt-striped tbody tr:nth-child(even) th{
    background:var(--nm-pt-row-alt-bg);
}

/* 悬停高亮（应用到 td/th，合并单元格整体高亮一致） */
.nm-pt-table tbody tr:hover td,
.nm-pt-table tbody tr:hover th{
    background:var(--nm-pt-hover-bg);
}

/* ==================== B. 编辑器按钮样式（发帖页按钮） ====================
   图标由 HTML 内联 SVG 提供，此处仅做按钮骨架与表格图标感
   参照 nm_pan_dl 按钮隔离规范，关键属性 !important 防论坛主题干扰 */

/* 快速回复框 / 版块列表快捷发帖区 按钮（浮动纯图标小按钮） */
.nm-pt-seditor-btn.nm-pt-fastpost-btn{
    float:left !important;
    margin:2px 5px 0 0 !important;
    width:20px !important;
    height:20px !important;
    line-height:20px !important;
    text-indent:-9999px !important;
    overflow:hidden !important;
    border:none !important;
    padding:0 !important;
    background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7280' d='M3 3h18v18H3V3zm2 2v3h5V5H5zm7 0v3h7V5h-7zM5 10v3h5v-3H5zm7 0v3h7v-3h-7zM5 14v5h5v-5H5zm7 0v5h7v-5h-7z'/%3E%3C/svg%3E") no-repeat center !important;
    background-size:18px 18px !important;
    cursor:pointer;
    transition:filter 0.2s ease !important;
}
.nm-pt-seditor-btn.nm-pt-fastpost-btn:hover{
    background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23e07856' d='M3 3h18v18H3V3zm2 2v3h5V5H5zm7 0v3h7V5h-7zM5 10v3h5v-3H5zm7 0v3h7v-3h-7zM5 14v5h5v-5H5zm7 0v5h7v-5h-7z'/%3E%3C/svg%3E") no-repeat center !important;
    background-size:18px 18px !important;
    filter:drop-shadow(0 0 6px rgba(224,120,86,0.5)) !important;
}

/* 悬浮回复框按钮（fpd 内，纯图标样式） */
.nm-pt-seditor-btn{
    cursor:pointer;
    transition:filter 0.2s ease !important;
}

/* 默认编辑器工具栏按钮（#e_adv_s1 内，与原生按钮同级）
   常用模式 .b2r：纯图标
   高级模式 .b1r：图标+文字 */
#e_adv_s1.b2r #nm_post_table_editor_btn{
    background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7280' d='M3 3h18v18H3V3zm2 2v3h5V5H5zm7 0v3h7V5h-7zM5 10v3h5v-3H5zm7 0v3h7v-3h-7zM5 14v5h5v-5H5zm7 0v5h7v-5h-7z'/%3E%3C/svg%3E") no-repeat center !important;
    background-size:18px 18px !important;
    transition:filter 0.2s ease !important;
}
#e_adv_s1.b2r #nm_post_table_editor_btn:hover{
    background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23e07856' d='M3 3h18v18H3V3zm2 2v3h5V5H5zm7 0v3h7V5h-7zM5 10v3h5v-3H5zm7 0v3h7v-3h-7zM5 14v5h5v-5H5zm7 0v5h7v-5h-7z'/%3E%3C/svg%3E") no-repeat center !important;
    background-size:18px 18px !important;
    filter:drop-shadow(0 0 6px rgba(224,120,86,0.5)) !important;
}
#e_adv_s1.b1r #nm_post_table_editor_btn{
    text-indent:0 !important;
    width:45px !important;
    background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7280' d='M3 3h18v18H3V3zm2 2v3h5V5H5zm7 0v3h7V5h-7zM5 10v3h5v-3H5zm7 0v3h7v-3h-7zM5 14v5h5v-5H5zm7 0v5h7v-5h-7z'/%3E%3C/svg%3E") no-repeat center 4px !important;
    background-size:28px 28px !important;
    transition:filter 0.2s ease !important;
}
#e_adv_s1.b1r #nm_post_table_editor_btn:hover{
    background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23e07856' d='M3 3h18v18H3V3zm2 2v3h5V5H5zm7 0v3h7V5h-7zM5 10v3h5v-3H5zm7 0v3h7v-3h-7zM5 14v5h5v-5H5zm7 0v5h7v-5h-7z'/%3E%3C/svg%3E") no-repeat center 4px !important;
    background-size:28px 28px !important;
    filter:drop-shadow(0 0 6px rgba(224,120,86,0.5)) !important;
}

/* X5 JSON 编辑器工具栏按钮 */
#toolbar-nm_post_table button{cursor:pointer;}
#toolbar-nm_post_table svg path{
    fill:#6b7280;
    transition:fill 0.2s ease;
}
#toolbar-nm_post_table:hover svg path{fill:#e07856;}

/* 移动端发帖页底部按钮（简约轻盈风格，水平布局：图标在左，文字在右）
   进入共享容器后由 pan_dl_mobile.css 切换为垂直布局
   移动端具体尺寸由 post_table_mobile.css 覆盖 */
.nm-pt-mobile-btn{
    display:inline-flex !important;
    flex-direction:row !important;
    align-items:center !important;
    justify-content:center !important;
    gap:6px;
    margin:8px 12px !important;
    padding:9px 14px !important;
    border:1px solid transparent !important;
    border-radius:8px !important;
    background:#e88a6c !important;
    color:#fff !important;
    font-size:13px !important;
    font-weight:500 !important;
    font-family:-apple-system,"PingFang SC","Microsoft YaHei",sans-serif !important;
    cursor:pointer !important;
    text-decoration:none !important;
    -webkit-appearance:none !important;
    appearance:none !important;
    -moz-appearance:none !important;
    box-sizing:border-box !important;
    line-height:1.3 !important;
    vertical-align:middle !important;
    white-space:nowrap !important;
    transition:opacity 0.15s ease;
}
.nm-pt-mobile-btn:hover{opacity:0.85;}
.nm-pt-mobile-btn:active{opacity:0.75;}
.nm-pt-mobile-btn svg{flex-shrink:0;display:block;width:16px;height:16px;}
.nm-pt-mobile-btn span{white-space:nowrap;}

/* ==================== C. 模态框编辑器样式（发帖页弹窗） ====================
   浅色背景利于编辑，表格预览区独立配色（继承当前选中主题变量）
   无 backdrop-filter:blur()，蒙层用纯半透明黑色 */

/* 蒙层：fixed 全屏 */
.nm-pt-modal{
    position:fixed;
    inset:0;
    z-index:10000;
    font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;
    animation:nm-pt-fade 0.18s ease;
}
.nm-pt-modal-mask{
    position:absolute;
    inset:0;
    background:rgba(0,0,0,0.5);
}
@keyframes nm-pt-fade{from{opacity:0;}to{opacity:1;}}

/* 容器：居中、白底、圆角、最大宽高、flex 列布局 */
.nm-pt-modal-box{
    position:absolute;
    top:50%;
    left:50%;
    transform:translate(-50%,-50%);
    width:1135px;
    max-width:94vw;
    max-height:88vh;
    background:#fff;
    border-radius:12px;
    display:flex;
    flex-direction:column;
    overflow:hidden;
    box-shadow:0 12px 40px rgba(0,0,0,0.22),0 4px 12px rgba(0,0,0,0.1);
    animation:nm-pt-pop 0.2s ease;
    color:#1a1d26;
}
@keyframes nm-pt-pop{
    from{opacity:0;transform:translate(-50%,-48%) scale(0.96);}
    to{opacity:1;transform:translate(-50%,-50%) scale(1);}
}

/* 顶部工具栏：标题输入、配色选择、选项按钮 */
.nm-pt-modal-header{
    display:flex;
    align-items:center;
    gap:10px;
    padding:12px 14px;
    border-bottom:1px solid #eef0f3;
    background:#fafbfc;
    flex-shrink:0;
}
.nm-pt-modal-title-input{
    flex:1;
    min-width:0;
    padding:7px 10px;
    border:1px solid #e5e7eb;
    border-radius:6px;
    font-size:14px;
    font-weight:600;
    color:#1a1d26;
    background:#fff;
    font-family:inherit;
    outline:none;
    transition:border-color 0.15s ease,box-shadow 0.15s ease;
}
.nm-pt-modal-title-input:focus{
    border-color:#e07856;
    box-shadow:0 0 0 2px rgba(224,120,86,0.12);
}
.nm-pt-modal-title-input::placeholder{color:#9ca3af;font-weight:400;}

/* 配色选择下拉（强制隔离样式，防论坛主题覆盖，参照 nm_pan_dl） */
.nm-pt-modal-theme-select{
    padding:7px 28px 7px 10px !important;
    border:1px solid #e5e7eb !important;
    border-radius:6px !important;
    font-size:13px !important;
    color:#1a1d26 !important;
    background:#fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 10px center !important;
    background-size:12px !important;
    -webkit-appearance:none !important;
    appearance:none !important;
    -moz-appearance:none !important;
    cursor:pointer !important;
    font-family:inherit !important;
    outline:none !important;
    height:36px !important;
    line-height:1.5 !important;
    margin:0 !important;
    box-sizing:border-box !important;
}
.nm-pt-modal-theme-select:focus{
    border-color:#e07856 !important;
    box-shadow:0 0 0 2px rgba(224,120,86,0.12) !important;
}
.nm-pt-modal-theme-select option{
    color:#1a1d26 !important;
    background:#fff !important;
}

/* 选项按钮（自定义配色、表头开关、斑马纹、排序） */
.nm-pt-modal-opts{
    display:flex;
    gap:6px;
    flex-shrink:0;
}
.nm-pt-modal-opt{
    display:inline-flex;
    align-items:center;
    gap:4px;
    padding:6px 10px;
    border:1px solid #e5e7eb;
    border-radius:6px;
    background:#fff;
    color:#4b5563;
    font-size:12px;
    cursor:pointer;
    font-family:inherit;
    transition:all 0.15s ease;
    white-space:nowrap;
}
.nm-pt-modal-opt:hover{
    border-color:#e07856;
    color:#e07856;
}
.nm-pt-modal-opt.nm-pt-active{
    background:#e07856;
    border-color:#e07856;
    color:#fff;
}
.nm-pt-modal-opt input[type="checkbox"]{
    margin:0;
    cursor:pointer;
}

/* 行列操作栏：+行/-行/+列/-列/合并/拆分/对齐/表头开关/单元格色 */
.nm-pt-modal-toolbar{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:4px;
    padding:8px 14px;
    border-bottom:1px solid #eef0f3;
    background:#f5f7fa;
    flex-shrink:0;
}
.nm-pt-modal-tool{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:4px;
    padding:5px 10px;
    border:1px solid #e0e4ea;
    border-radius:5px;
    background:#fff;
    color:#374151;
    font-size:12px;
    cursor:pointer;
    font-family:inherit;
    transition:all 0.15s ease;
    white-space:nowrap;
    line-height:1.4;
}
.nm-pt-modal-tool:hover{
    border-color:#e07856;
    color:#e07856;
    background:#fff;
}
.nm-pt-modal-tool:active{transform:translateY(1px);}
.nm-pt-modal-tool.nm-pt-disabled{
    opacity:0.45;
    cursor:not-allowed;
    pointer-events:none;
}
.nm-pt-modal-tool svg{
    width:14px;
    height:14px;
    flex-shrink:0;
}
.nm-pt-modal-tool-sep{
    width:1px;
    height:18px;
    background:#e0e4ea;
    margin:0 2px;
    flex-shrink:0;
}
/* 行列增删分组：[-][输入框][+] 一体化控件 */
.nm-pt-rc-group{
    display:inline-flex;
    align-items:center;
    border:1px solid #e0e4ea;
    border-radius:5px;
    overflow:hidden;
    flex-shrink:0;
    background:#fff;
}
.nm-pt-rc-group:hover{
    border-color:#e07856;
}
.nm-pt-rc-label{
    padding:0 6px;
    font-size:11px;
    color:#6b7280;
    background:#f5f7fa;
    border-right:1px solid #e0e4ea;
    line-height:26px;
    flex-shrink:0;
}
.nm-pt-rc-btn{
    width:24px;
    height:26px;
    border:none;
    background:#fff;
    color:#374151;
    font-size:14px;
    cursor:pointer;
    font-family:inherit;
    line-height:1;
    transition:background 0.15s ease;
    padding:0;
}
.nm-pt-rc-btn:hover{
    background:#fef3f0;
    color:#e07856;
}
.nm-pt-rc-btn:active{transform:translateY(1px);}
.nm-pt-rc-count{
    width:38px;
    height:26px;
    border:none;
    border-left:1px solid #e0e4ea;
    border-right:1px solid #e0e4ea;
    background:#fff;
    color:#374151;
    font-size:12px;
    text-align:center;
    font-family:inherit;
    outline:none;
    -moz-appearance:textfield;
}
.nm-pt-rc-count::-webkit-outer-spin-button,
.nm-pt-rc-count::-webkit-inner-spin-button{
    -webkit-appearance:none;
    margin:0;
}
.nm-pt-rc-count:focus{
    background:#fffbeb;
}

/* 对齐按钮组（左/中/右）激活态 */
.nm-pt-modal-tool.nm-pt-align-active{
    background:#e07856;
    border-color:#e07856;
    color:#fff;
}

/* 表格编辑区：flex:1、可滚动、内含可编辑表格 */
.nm-pt-modal-grid{
    flex:1;
    overflow:auto;
    padding:14px;
    background:#fff;
    min-height:200px;
}
/* 空表格也保持可见高度（table:empty 对含空 tbody 的表格无效，用 grid 最小高度兜底） */
.nm-pt-modal-grid:empty{
    min-height:200px;
}
/* 编辑态表格：基础样式（不继承渲染态 CSS 变量，独立浅色配色） */
.nm-pt-modal-grid table{
    border-collapse:collapse;
    width:100%;
    background:#fff;
    min-height:120px;
    table-layout:fixed;
}
.nm-pt-modal-grid th,
.nm-pt-modal-grid td{
    border:1px solid #d1d5db;
    padding:10px 12px;
    font-size:13px;
    vertical-align:middle;
    word-break:break-word;
    position:relative;
    min-width:100px;
    height:42px;
    line-height:1.5;
}
.nm-pt-modal-grid th{
    background:#f3f4f6;
    font-weight:600;
    color:#1a1d26;
}
.nm-pt-modal-grid td{
    background:#fff;
    color:#1a1d26;
}

/* 单元格编辑态：点击变可编辑（!important 覆盖内联 bg_color/text_color，保证可读性） */
.nm-pt-modal-grid td.nm-pt-editing,
.nm-pt-modal-grid th.nm-pt-editing{
    background:#fffbeb !important;
    color:#1a1d26 !important;
    border-color:#f59e0b;
    box-shadow:inset 0 0 0 2px rgba(245,158,11,0.25);
}
.nm-pt-modal-grid td[contenteditable="true"],
.nm-pt-modal-grid th[contenteditable="true"]{
    outline:none;
    cursor:text;
}

/* 选中单元格高亮 */
.nm-pt-modal-grid td.nm-pt-selected,
.nm-pt-modal-grid th.nm-pt-selected{
    background:#fef3f0;
    border-color:#e07856;
    box-shadow:inset 0 0 0 2px rgba(224,120,86,0.35);
}
.nm-pt-modal-grid td.nm-pt-selected.nm-pt-editing,
.nm-pt-modal-grid th.nm-pt-selected.nm-pt-editing{
    background:#fffbeb;
}

/* 合并格标记（右上角小标） */
.nm-pt-modal-grid td.nm-pt-merged::after,
.nm-pt-modal-grid th.nm-pt-merged::after{
    content:"";
    position:absolute;
    top:2px;
    right:2px;
    width:6px;
    height:6px;
    background:#6b7280;
    border-radius:50%;
}

/* 编辑态单元格颜色覆盖（实时预览） */
.nm-pt-modal-grid td[style*="background"],
.nm-pt-modal-grid th[style*="background"]{
    /* 允许 inline style 覆盖 */
}

/* 预览区：当用户切换"预览"时，编辑态表格套用主题变量 */
.nm-pt-modal-grid.nm-pt-preview table{
    background:var(--nm-pt-row-bg,#fff);
}
.nm-pt-modal-grid.nm-pt-preview th{
    background:var(--nm-pt-header-bg,#f3f4f6);
    color:var(--nm-pt-header-text,#1a1d26);
    border-color:var(--nm-pt-border,#d1d5db);
}
.nm-pt-modal-grid.nm-pt-preview td{
    background:var(--nm-pt-row-bg,#fff);
    color:var(--nm-pt-row-text,#1a1d26);
    border-color:var(--nm-pt-border,#d1d5db);
}

/* 底部：取消/插入按钮 */
.nm-pt-modal-footer{
    display:flex;
    align-items:center;
    gap:8px;
    padding:10px 14px;
    border-top:1px solid #eef0f3;
    background:#fafbfc;
    flex-shrink:0;
    justify-content:flex-end;
}
.nm-pt-modal-btn{
    padding:8px 18px;
    border:none;
    border-radius:6px;
    cursor:pointer;
    font-size:13px;
    font-family:inherit;
    font-weight:600;
    transition:all 0.15s ease;
    line-height:1.4;
}
.nm-pt-modal-btn-primary{
    background:linear-gradient(135deg,#e07856 0%,#c9633d 100%);
    color:#fff;
    box-shadow:0 2px 6px rgba(224,120,86,0.25);
}
.nm-pt-modal-btn-primary:hover{
    filter:brightness(1.05);
    box-shadow:0 4px 12px rgba(224,120,86,0.35);
}
.nm-pt-modal-btn-primary:active{transform:translateY(1px);}
.nm-pt-modal-btn-cancel{
    background:#fff;
    color:#4b5563;
    border:1px solid #e5e7eb;
}
.nm-pt-modal-btn-cancel:hover{
    border-color:#d1d5db;
    background:#f9fafb;
}
.nm-pt-modal-btn-del{
    background:#fff;
    color:#ef4444;
    border:1px solid #fecaca;
    margin-right:auto;
}
.nm-pt-modal-btn-del:hover{background:#fef2f2;}
.nm-pt-modal-btn-help{
    background:#fff;
    color:#6b7280;
    border:1px solid #e5e7eb;
    padding:8px 12px;
    font-size:12px;
    font-weight:500;
}
.nm-pt-modal-btn-help:hover{
    border-color:#e07856;
    color:#e07856;
    background:#fff;
}

/* ==================== 使用说明面板 ==================== */
.nm-pt-help-overlay{
    position:fixed;
    inset:0;
    z-index:10020;
    animation:nm-pt-fade 0.18s ease;
}
.nm-pt-help-mask{
    position:absolute;
    inset:0;
    background:rgba(0,0,0,0.45);
}
.nm-pt-help-box{
    position:absolute;
    top:50%;
    left:50%;
    transform:translate(-50%,-50%);
    width:560px;
    max-width:94vw;
    max-height:80vh;
    background:#fff;
    border-radius:12px;
    display:flex;
    flex-direction:column;
    overflow:hidden;
    box-shadow:0 12px 40px rgba(0,0,0,0.22),0 4px 12px rgba(0,0,0,0.1);
    animation:nm-pt-pop 0.2s ease;
}
.nm-pt-help-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:14px 18px;
    border-bottom:1px solid #eef0f3;
    background:#fafbfc;
    flex-shrink:0;
}
.nm-pt-help-title{
    font-size:15px;
    font-weight:600;
    color:#1a1d26;
}
.nm-pt-help-close{
    width:28px;
    height:28px;
    border:none;
    background:transparent;
    color:#9ca3af;
    font-size:22px;
    line-height:1;
    cursor:pointer;
    border-radius:6px;
    transition:all 0.15s ease;
    padding:0;
}
.nm-pt-help-close:hover{
    background:#f3f4f6;
    color:#1a1d26;
}
.nm-pt-help-body{
    flex:1;
    overflow-y:auto;
    padding:16px 20px;
    color:#374151;
    font-size:13px;
    line-height:1.7;
    -webkit-overflow-scrolling:touch;
}
.nm-pt-help-body h4{
    font-size:13px;
    font-weight:600;
    color:#1a1d26;
    margin:14px 0 6px;
    padding-left:8px;
    border-left:3px solid #e07856;
}
.nm-pt-help-body h4:first-child{margin-top:0;}
.nm-pt-help-body ul{
    margin:0;
    padding-left:18px;
}
.nm-pt-help-body li{
    margin-bottom:4px;
}
.nm-pt-help-body b{
    color:#1a1d26;
    font-weight:600;
}

/* ==================== 配色面板（自定义 + 单元格级） ====================
   颜色选择器网格，浮层定位 */
.nm-pt-color-panel{
    position:absolute;
    z-index:10010;
    background:#fff;
    border:1px solid #e5e7eb;
    border-radius:8px;
    padding:12px;
    box-shadow:0 8px 24px rgba(0,0,0,0.15),0 2px 6px rgba(0,0,0,0.08);
    animation:nm-pt-pop-sm 0.15s ease;
    max-width:calc(100vw - 16px);
}
/* 横向双栏：背景色 | 文字色 */
.nm-pt-color-cols{
    display:flex;
    gap:16px;
}
.nm-pt-color-section{
    flex:1;
    min-width:0;
}
@keyframes nm-pt-pop-sm{
    from{opacity:0;transform:translateY(-4px);}
    to{opacity:1;transform:translateY(0);}
}
.nm-pt-color-panel-title{
    font-size:12px;
    font-weight:600;
    color:#4b5563;
    margin-bottom:8px;
    padding-bottom:6px;
    border-bottom:1px solid #f3f4f6;
}
.nm-pt-color-grid{
    display:grid;
    grid-template-columns:repeat(8,1fr);
    gap:4px;
    margin-bottom:8px;
}
.nm-pt-color-swatch{
    width:24px;
    height:24px;
    border-radius:4px;
    border:1px solid #e5e7eb;
    cursor:pointer;
    transition:transform 0.1s ease,box-shadow 0.1s ease;
}
.nm-pt-color-swatch:hover{
    transform:scale(1.12);
    box-shadow:0 0 0 2px rgba(224,120,86,0.4);
}
.nm-pt-color-swatch.nm-pt-active{
    box-shadow:0 0 0 2px #e07856,0 0 0 4px rgba(224,120,86,0.2);
}
.nm-pt-color-clear{
    display:inline-flex;
    align-items:center;
    gap:4px;
    padding:4px 8px;
    border:1px solid #e5e7eb;
    border-radius:4px;
    background:#fff;
    color:#6b7280;
    font-size:11px;
    cursor:pointer;
    font-family:inherit;
}
.nm-pt-color-clear:hover{
    color:#ef4444;
    border-color:#fecaca;
    background:#fef2f2;
}
.nm-pt-color-custom{
    display:flex;
    align-items:center;
    gap:6px;
    margin-top:6px;
    padding-top:6px;
    border-top:1px solid #f3f4f6;
}
.nm-pt-color-custom input[type="color"]{
    width:28px;
    height:28px;
    border:1px solid #e5e7eb;
    border-radius:4px;
    cursor:pointer;
    padding:0;
    background:#fff;
}
.nm-pt-color-custom input[type="text"]{
    flex:1;
    padding:5px 8px;
    border:1px solid #e5e7eb;
    border-radius:4px;
    font-size:12px;
    font-family:Menlo,Consolas,monospace;
    color:#374151;
    outline:none;
}
.nm-pt-color-custom input[type="text"]:focus{
    border-color:#e07856;
    box-shadow:0 0 0 2px rgba(224,120,86,0.12);
}

/* 自定义配色面板（8 字段网格） */
.nm-pt-custom-theme-panel{
    padding:10px 14px;
    border-bottom:1px solid #eef0f3;
    background:#f9fafb;
    display:none;
}
.nm-pt-custom-theme-panel.nm-pt-show{display:block;}
.nm-pt-custom-theme-grid{
    display:grid;
    grid-template-columns:repeat(4,1fr);
    gap:8px;
}
.nm-pt-custom-theme-item{
    display:flex;
    flex-direction:column;
    gap:3px;
}
.nm-pt-custom-theme-item label{
    font-size:11px;
    color:#6b7280;
    font-weight:500;
}
.nm-pt-custom-theme-item input[type="color"]{
    width:100%;
    height:30px;
    border:1px solid #e5e7eb;
    border-radius:4px;
    cursor:pointer;
    padding:2px;
    background:#fff;
}

/* ==================== 行高列宽设置面板 ==================== */
.nm-pt-size-panel{
    max-height:60vh;
    overflow-y:auto;
}
.nm-pt-size-row{
    display:flex;
    align-items:center;
    gap:8px;
    margin-bottom:6px;
}
.nm-pt-size-label{
    font-size:12px;
    color:#6b7280;
    width:40px;
    flex-shrink:0;
}
.nm-pt-size-input{
    flex:1;
    min-width:0;
    padding:4px 8px;
    border:1px solid #e5e7eb;
    border-radius:4px;
    font-size:12px;
    font-family:Menlo,Consolas,monospace;
    outline:none;
}
.nm-pt-size-input:focus{
    border-color:#e07856;
}

/* ==================== 编辑页已有表格列表 ==================== */
.nm-pt-edit-list{
    margin:10px;
    padding:10px;
    border:1px solid #e5e7eb;
    border-radius:8px;
    background:#fafbfc;
    font-family:inherit;
}
.nm-pt-edit-list-title{
    font-size:13px;
    font-weight:600;
    color:#4b5563;
    margin-bottom:8px;
}
.nm-pt-edit-item{
    display:flex;
    align-items:center;
    gap:8px;
    padding:6px 8px;
    border-radius:6px;
    background:#fff;
    border:1px solid #eee;
    margin-bottom:4px;
    font-size:12px;
}
.nm-pt-edit-item-title{
    flex:1;
    min-width:0;
    font-weight:600;
    color:#1a1d26;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.nm-pt-edit-item-insert,
.nm-pt-edit-item-edit,
.nm-pt-edit-item-del{
    padding:3px 10px;
    border:1px solid #e5e7eb;
    border-radius:4px;
    background:#fff;
    cursor:pointer;
    font-size:11px;
    color:#4b5563;
    flex-shrink:0;
    font-family:inherit;
    transition:all 0.15s ease;
}
.nm-pt-edit-item-insert{
    color:#2563eb;
    border-color:#bfdbfe;
}
.nm-pt-edit-item-insert:hover{
    background:#eff6ff;
    border-color:#2563eb;
}
.nm-pt-edit-item-edit:hover{
    color:#e07856;
    border-color:#e07856;
}
.nm-pt-edit-item-del{
    color:#ef4444;
    border-color:#fecaca;
}
.nm-pt-edit-item-del:hover{background:#fef2f2;}

/* ==================== toast 提示 ==================== */
.nm-pt-toast{
    position:fixed;
    top:80px;
    left:50%;
    transform:translateX(-50%);
    background:rgba(0,0,0,0.82);
    color:#fff;
    padding:7px 14px;
    border-radius:6px;
    font-size:13px;
    opacity:0;
    transition:opacity 0.2s ease;
    z-index:10001;
    pointer-events:none;
    font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;
}
.nm-pt-toast-show{opacity:1;}

/* ==================== 暗色主题（obsidian）渲染适配 ====================
   暗色主题下表格文字色与边框协调，无需额外覆盖，CSS 变量已驱动配色
   此处仅微调暗色主题下的链接与图片样式 */
.nm-pt-theme-obsidian td a{color:#6bb6ff;}
.nm-pt-theme-obsidian td a:hover{color:#8ec9ff;}
.nm-pt-theme-obsidian td img{background:#2d3748;}

/* ==================== 渲染态表格内嵌内容适配 ==================== */
.nm-pt-table td img{max-width:100%;height:auto;}
.nm-pt-table td a{color:inherit;text-decoration:underline;}
.nm-pt-table td code{
    background:rgba(0,0,0,0.06);
    padding:1px 4px;
    border-radius:3px;
    font-size:0.9em;
}
.nm-pt-theme-obsidian td code{background:rgba(255,255,255,0.1);}

/* ==================== 导出按钮 ====================
   帖子页表格卡片右上角，默认半透明，悬停高亮 */
.nm-pt-export-btn{
    position:absolute;
    top:6px;
    right:6px;
    width:28px;
    height:28px;
    border:none;
    border-radius:5px;
    background:rgba(255,255,255,0.18);
    color:var(--nm-pt-caption-text,#fff);
    cursor:pointer;
    opacity:0;
    transition:opacity 0.2s ease,background 0.2s ease;
    z-index:5;
    padding:0;
    display:flex;
    align-items:center;
    justify-content:center;
}
.nm-pt-export-btn::before{
    content:"";
    width:14px;
    height:14px;
    background:currentColor;
    -webkit-mask:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 3a1 1 0 0 1 1 1v9.59l3.3-3.3a1 1 0 1 1 1.4 1.42l-5 5a1 1 0 0 1-1.4 0l-5-5a1 1 0 1 1 1.4-1.42l3.3 3.3V4a1 1 0 0 1 1-1zM5 19a1 1 0 0 1 0-2h14a1 1 0 0 1 0 2H5z'/></svg>") center/contain no-repeat;
    mask:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 3a1 1 0 0 1 1 1v9.59l3.3-3.3a1 1 0 1 1 1.4 1.42l-5 5a1 1 0 0 1-1.4 0l-5-5a1 1 0 1 1 1.4-1.42l3.3 3.3V4a1 1 0 0 1 1-1zM5 19a1 1 0 0 1 0-2h14a1 1 0 0 1 0 2H5z'/></svg>") center/contain no-repeat;
}
.nm-pt-table:hover .nm-pt-export-btn{
    opacity:1;
}
.nm-pt-export-btn:hover{
    background:rgba(255,255,255,0.32);
}
.nm-pt-export-btn:active{
    transform:scale(0.92);
}
/* 编辑器预览中不显示导出按钮 */
.nm-pt-modal-grid .nm-pt-export-btn{
    display:none !important;
}

/* ==================== 富文本工具栏按钮 ====================
   加粗/斜体/链接/图片：固定宽度图标按钮，禁用态半透明 */
.nm-pt-rt-btn{
    min-width:30px;
    font-weight:600;
    font-size:13px;
}
.nm-pt-rt-btn b,
.nm-pt-rt-btn i{
    font-style:italic;
    font-weight:inherit;
    pointer-events:none;
}
.nm-pt-rt-btn b{font-weight:700;}
.nm-pt-rt-btn i{font-style:italic;}

/* ==================== 框选拖动视觉反馈 ====================
   拖选中单元格用更鲜明的选中态（.nm-pt-selected 已有）
   拖选过程中网格禁用文本选中 */
.nm-pt-modal-grid.nm-pt-dragging{
    user-select:none;
    -webkit-user-select:none;
    cursor:cell;
}
/* 拖选中实时高亮的格子用更亮的高亮（覆盖 .nm-pt-selected） */
.nm-pt-modal-grid.nm-pt-dragging td.nm-pt-selected,
.nm-pt-modal-grid.nm-pt-dragging th.nm-pt-selected{
    background:#fde8e0;
    box-shadow:inset 0 0 0 2px rgba(224,120,86,0.55);
}

/* ==================== 双击编辑模式视觉反馈 ====================
   contenteditable=true 时编辑态高亮（.nm-pt-editing 已有，此处补充默认态） */
.nm-pt-modal-grid td[contenteditable="false"],
.nm-pt-modal-grid th[contenteditable="false"]{
    cursor:default;
}
/* 非编辑态悬停提示可双击编辑（!important 覆盖内联 bg_color/text_color，保证悬停反馈可见） */
.nm-pt-modal-grid td[contenteditable="false"]:hover,
.nm-pt-modal-grid th[contenteditable="false"]:hover{
    background:#f9fafb !important;
    color:#1a1d26 !important;
}
.nm-pt-modal-grid td[contenteditable="false"].nm-pt-selected:hover,
.nm-pt-modal-grid th[contenteditable="false"].nm-pt-selected:hover{
    background:#fef3f0 !important;
    color:#1a1d26 !important;
}
