:root { --ink: #1f2937; --muted: #64748b; --line: #d8dee8; --accent: #2563eb; --paper-width: 210mm; --paper-height: 297mm; --page-top: 22mm; --page-right: 20mm; --page-bottom: 20mm; --page-left: 20mm; }
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #eef2f7; font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.app-bar { height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--line); }
.subtle { margin-left: 12px; color: var(--muted); font-size: 12px; }
.app-version { display: inline-block; margin-left: 10px; padding: 2px 6px; border: 1px solid #bfdbfe; border-radius: 4px; color: #1d4ed8; background: #eff6ff; font: 600 11px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; }
button, select, input { font: inherit; }
button { border: 1px solid #b9c4d3; border-radius: 5px; padding: 7px 12px; color: #17345e; background: #fff; cursor: pointer; }
button:hover { border-color: var(--accent); color: var(--accent); }
button.active { background: #e8f0ff; border-color: var(--accent); color: #174ea6; }
.actions { display: flex; gap: 8px; }
.backend-status { align-self: center; color: #b45309; font-size: 11px; }
.backend-status.connected { color: #15803d; }
.workspace { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: calc(100vh - 58px); }
.inspector { padding: 20px 18px; background: #f8fafc; border-right: 1px solid var(--line); }
.inspector h1 { margin: 0 0 18px; font-size: 17px; }
.tool-group { margin: 12px 0 10px; }
.group-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.tool-row { display: flex; flex-wrap: wrap; gap: 5px; }
.tool-row button { min-width: 34px; padding: 6px 8px; }
.inspector label { display: block; margin: 13px 0; color: #334155; font-size: 12px; }
.inspector input, .inspector select { width: 100%; margin-top: 5px; border: 1px solid #cbd5e1; border-radius: 4px; padding: 6px; background: white; }
.inspector input[type=number] { width: 84px; }
.margin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 5px; }
.margin-grid input { width: 100%; }
.hint { margin: 18px 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.6; }
.diagnostics { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; }
.diagnostics h2 { margin: 0 0 10px; font-size: 13px; }
.standard-check { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; }
.standard-check h2 { margin: 0 0 8px; font-size: 13px; }
.standard-check ul { padding: 0; margin: 0; list-style: none; font-size: 12px; line-height: 1.7; }
.standard-check .ok { color: #15803d; }
.standard-check .warn { color: #b45309; }
dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; margin: 0; font-size: 12px; }
dt { color: var(--muted); } dd { margin: 0; font-variant-numeric: tabular-nums; }
details { margin-top: 18px; font-size: 12px; } pre { max-height: 180px; overflow: auto; white-space: pre-wrap; color: #475569; }
.stage { padding: 28px 36px 60px; overflow: auto; }
.pages { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.loading-state { width: min(620px, 100%); margin: 80px auto; padding: 22px; border: 1px dashed #b9c4d3; border-radius: 6px; color: var(--muted); background: #fff; text-align: center; }
.loading-state.error { border-color: #fca5a5; color: #b91c1c; background: #fff7f7; text-align: left; line-height: 1.6; }
.page { position: relative; width: var(--paper-width); height: var(--paper-height); flex: 0 0 auto; overflow: hidden; background: var(--page-bg, #fff); border: var(--border-width, 1px) solid var(--border-color, #d8dee8); box-shadow: 0 8px 24px rgba(15, 23, 42, .12); }
.page-header, .page-footer { position: absolute; left: var(--page-left); right: var(--page-right); color: #64748b; font-size: 10px; line-height: 1.2; }
.page-header { top: 8mm; padding-bottom: 2mm; border-bottom: 1px solid #e5e7eb; font-family: FangSong, 仿宋, STFangsong, serif; color: #000; }
.header-top { display: flex; justify-content: space-between; min-height: 5mm; font-size: 16px; }
.org-title { margin: 3mm 0 1mm; color: #d92121; font-family: SimSun, 宋体, serif; font-size: 22px; font-weight: 700; text-align: center; letter-spacing: 2px; }
.header-reference { display: flex; justify-content: space-between; font-size: 16px; }
.red-line { height: .35mm; margin-top: 4mm; background: #d92121; }
.page-footer { bottom: 8mm; display: flex; justify-content: space-between; padding-top: 2mm; border-top: 1px solid #e5e7eb; font-family: FangSong, 仿宋, STFangsong, serif; font-size: 14px; color: #000; }
.page-number { min-width: 26mm; font-family: Arial, sans-serif; font-size: 14px; }
.page-number.left { text-align: left; }
.page-number.right { text-align: right; }
.page-content { position: absolute; top: var(--page-top); right: var(--page-right); bottom: var(--page-bottom); left: var(--page-left); overflow: hidden; }
.grid-visible .page-content { background-image: linear-gradient(to bottom, transparent calc(100% - 1px), rgba(37, 99, 235, .14) calc(100% - 1px)); background-size: 100% calc(225mm / 22); }
.block { margin: 0 0 4mm; outline: none; white-space: pre-wrap; overflow-wrap: anywhere; }
.block:empty { min-height: 1em; }
.page-content:focus { outline: none; }
.block[contenteditable=true]:focus { outline: none; }
.heading { margin-bottom: 6mm; }
.doc-table { width: 100%; border-collapse: collapse; margin: 0 0 4mm; font-size: 11px; }
.doc-table th, .doc-table td { border: 1px solid #b8c2d1; padding: 2.5mm 3mm; text-align: left; vertical-align: middle; }
.doc-table th { background: #e8eef7; color: #17345e; font-weight: 650; }
.selected { outline: 2px solid rgba(37, 99, 235, .34); outline-offset: 2px; }
.overflow-marker { position: absolute; inset: 0; pointer-events: none; border: 2px solid #dc2626; }
@page { size: A4 portrait; margin: 0; }
@media print { body { background: white; } .app-bar, .inspector { display: none !important; } .workspace, .stage { display: block; padding: 0; min-height: 0; } .pages { display: block; } .page { height: 290mm; margin: 0; border: var(--border-width, 1px) solid var(--border-color, #d8dee8); box-shadow: none; break-after: auto; page-break-after: auto; } }
@media (max-width: 900px) { .workspace { grid-template-columns: 1fr; } .inspector { border-right: 0; border-bottom: 1px solid var(--line); } .stage { padding: 20px 8px; } }
