/* RichEditor 公文模式
 * A4 纸面 + GB/T 9704 常用排版
 */

.gw-stage {
    display: none;
    padding: 24px 12px 40px;
    background: #e9edf3;
    border-top: 1px solid rgba(127, 127, 127, .25);
    max-height: 78vh;
    overflow: auto;
}

.re-shell.is-gw .gw-stage { display: block; }
.re-shell.is-gw .re-pane,
.re-shell.is-gw .re-outline { display: none !important; }

.gw-page {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    padding: 37mm 26mm 35mm 28mm;
    box-sizing: border-box;
    background: #fff;
    color: #000;
    box-shadow: 0 6px 24px rgba(15, 23, 42, .18);
    outline: none;
    font-family: "仿宋_GB2312", "FangSong", "仿宋", "STFangsong", serif;
    font-size: 16pt;
    line-height: 28pt;
}

.gw-page:focus { box-shadow: 0 6px 24px rgba(15, 23, 42, .18), 0 0 0 2px rgba(1, 82, 147, .18); }

/* 公文必须黑字，挡住主题/后台样式干扰 */
.gw-page,
.gw-page p,
.gw-page h1,
.gw-page h2,
.gw-page h3,
.gw-page h4,
.gw-page div,
.gw-page td,
.gw-page th {
    color: #000;
}

.gw-page .gw-redhead { color: #d0021b; }

/* 版头 */
.gw-redhead {
    margin: 0 0 6mm;
    padding-bottom: 4mm;
    border-bottom: 2px solid #d0021b;
    color: #d0021b;
    text-align: center;
    font-family: "方正小标宋简体", "FZXiaoBiaoSong-B05S", "宋体", serif;
    font-size: 34pt;
    line-height: 1.3;
    letter-spacing: 2px;
}

.gw-docno {
    margin: 0 0 8mm;
    text-align: center;
    font-family: "仿宋_GB2312", "FangSong", serif;
    font-size: 16pt;
}

/* 标题层级 */
.gw-title {
    margin: 0 0 8mm;
    text-align: center;
    font-family: "方正小标宋简体", "FZXiaoBiaoSong-B05S", "宋体", serif;
    font-size: 22pt;
    font-weight: normal;
    line-height: 1.5;
    letter-spacing: 1px;
}

.gw-to {
    margin: 0 0 4mm;
    font-size: 16pt;
    text-indent: 0;
}

.gw-p {
    margin: 0;
    text-indent: 2em;
    text-align: justify;
    font-size: 16pt;
    line-height: 28pt;
}

.gw-h1 {
    margin: 0;
    text-indent: 2em;
    font-family: "黑体", "SimHei", sans-serif;
    font-size: 16pt;
    font-weight: normal;
    line-height: 28pt;
}

.gw-h2 {
    margin: 0;
    text-indent: 2em;
    font-family: "楷体_GB2312", "KaiTi", "楷体", serif;
    font-size: 16pt;
    font-weight: normal;
    line-height: 28pt;
}

.gw-h3 {
    margin: 0;
    text-indent: 2em;
    font-family: "仿宋_GB2312", "FangSong", serif;
    font-size: 16pt;
    font-weight: bold;
    line-height: 28pt;
}

.gw-sign {
    margin: 10mm 0 0;
    text-align: right;
    font-size: 16pt;
    line-height: 28pt;
}

.gw-date {
    margin: 0;
    text-align: right;
    font-size: 16pt;
    line-height: 28pt;
}

.gw-cc {
    margin: 8mm 0 0;
    padding-top: 3mm;
    border-top: 1px solid #000;
    font-size: 14pt;
    line-height: 24pt;
}

.gw-print {
    margin: 4mm 0 0;
    padding-top: 2mm;
    border-top: 1px solid #000;
    font-size: 14pt;
    line-height: 24pt;
}

.gw-pagebreak {
    display: block;
    height: 0;
    margin: 0;
    border: 0;
    page-break-after: always;
    break-after: page;
}

.gw-pagebreak::after {
    content: "— 分页 —";
    display: block;
    margin: 6px 0;
    padding: 4px 0;
    border-top: 1px dashed #c0c7d2;
    border-bottom: 1px dashed #c0c7d2;
    color: #98a2b3;
    font-family: -apple-system, "Microsoft YaHei", sans-serif;
    font-size: 11px;
    text-align: center;
    text-indent: 0;
}

/* 页面内的表格 */
.gw-page table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 4mm;
    font-size: 14pt;
}

.gw-page th,
.gw-page td {
    border: 1px solid #000;
    padding: 6px 10px;
    line-height: 1.7;
    vertical-align: middle;
}

.gw-page th { background: #f2f2f2; font-weight: bold; text-align: center; }

.gw-page img { max-width: 100%; height: auto; }

/* 公文工具栏 */
.gw-bar {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 7px 9px;
    border-bottom: 1px solid rgba(127, 127, 127, .22);
    background: rgba(255, 255, 255, .6);
}

.re-shell.is-gw .gw-bar { display: flex; }

.gw-bar .gw-sep { width: 1px; height: 18px; background: rgba(127, 127, 127, .3); margin: 0 4px; }

.gw-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 27px;
    padding: 0 9px;
    border: 1px solid rgba(127, 127, 127, .28);
    border-radius: 3px;
    background: transparent;
    color: inherit;
    font-family: -apple-system, "Microsoft YaHei", sans-serif;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.gw-btn:hover { border-color: #015293; color: #015293; background: rgba(1, 82, 147, .06); }
.gw-btn.is-on { border-color: #015293; color: #015293; background: rgba(1, 82, 147, .1); }
.gw-btn.gw-primary { background: #015293; border-color: #015293; color: #fff; }
.gw-btn.gw-primary:hover { background: #0b3a66; color: #fff; }
.gw-btn.gw-danger { color: #c9302c; border-color: rgba(201, 48, 44, .35); }

.gw-select {
    height: 27px;
    padding: 0 6px;
    border: 1px solid rgba(127, 127, 127, .28);
    border-radius: 3px;
    background: transparent;
    color: inherit;
    font-size: 12px;
    outline: none;
}

.gw-tip {
    display: none;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(127, 127, 127, .18);
    background: rgba(1, 82, 147, .05);
    color: #0f5f9e;
    font-family: -apple-system, "Microsoft YaHei", sans-serif;
    font-size: 11.5px;
    line-height: 1.7;
}

.re-shell.is-gw .gw-tip { display: block; }

/* 打印：只输出纸面 */
@media print {
    body * { visibility: hidden; }
    .gw-page, .gw-page * { visibility: visible; }
    .gw-page {
        position: absolute;
        left: 0;
        top: 0;
        width: 210mm;
        min-height: auto;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }
    @page { size: A4; margin: 37mm 26mm 35mm 28mm; }
    .gw-pagebreak::after { display: none; }
}

@media (max-width: 900px) {
    .gw-stage { padding: 12px 4px 24px; }
    .gw-page { width: 100%; min-height: auto; padding: 20mm 14mm; }
    .gw-bar { overflow-x: auto; flex-wrap: nowrap; }
}
