:root {
  color-scheme: light;
  --ink: #20252d;
  --muted: #66717f;
  --line: #d9dee5;
  --surface: #ffffff;
  --page: #f1f4f7;
  --accent: #1f5f8b;
  --accent-dark: #174969;
  --danger: #a93636;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Noto Sans CJK SC", "Microsoft YaHei", sans-serif; }
.topbar { min-height: 72px; padding: 14px clamp(18px, 4vw, 56px); background: #162b3a; color: #fff; display: flex; justify-content: space-between; align-items: center; }
.brand { font-size: 20px; font-weight: 700; }
.subtitle { margin-top: 4px; color: #c6d2dc; font-size: 13px; }
.health { color: #d6f0dd; font-size: 13px; text-decoration: none; border: 1px solid #5f9070; padding: 6px 10px; border-radius: 4px; }
.workspace { max-width: 1500px; margin: 0 auto; padding: 22px clamp(14px, 4vw, 56px) 40px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 2px 8px rgba(23, 39, 55, .04); }
.toolbar { padding: 14px 16px; display: flex; gap: 18px; align-items: center; justify-content: space-between; }
.template-picker { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.draft-toolbar { margin-top: 12px; padding: 11px 16px; }
.draft-picker { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; flex: 1; }
.draft-picker select { width: min(620px, 65vw); }
.data-note { color: var(--muted); font-size: 12px; white-space: nowrap; }
label { font-size: 14px; font-weight: 600; }
select, input, textarea { width: 100%; border: 1px solid #c7cfd8; border-radius: 4px; padding: 9px 10px; background: #fff; color: var(--ink); font: inherit; }
.template-picker select { width: min(340px, 55vw); }
.upload-label { color: var(--muted); font-size: 13px; }
.current-template { color: var(--muted); font-size: 13px; white-space: nowrap; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; border-radius: 4px; padding: 8px 14px; font: inherit; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; border: 1px solid transparent; }
.button.primary { background: var(--accent); color: #fff; }
.button.primary:hover { background: var(--accent-dark); }
.button.secondary { background: #fff; color: #2e4d63; border-color: #b9c4ce; }
.notice { margin-top: 14px; padding: 11px 14px; border-radius: 4px; font-size: 14px; }
.notice.error { color: var(--danger); background: #fff0f0; border: 1px solid #e7bcbc; }
.content-grid { margin-top: 18px; display: grid; grid-template-columns: minmax(320px, .82fr) minmax(440px, 1.7fr); gap: 18px; align-items: stretch; }
.form-panel, .preview-panel { min-height: calc(100vh - 180px); padding: 20px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 18px; }
.panel-heading.compact { margin-bottom: 14px; }
h1 { margin: 0; font-size: 18px; }
.panel-heading p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.field { margin-bottom: 15px; }
.field label { display: block; margin-bottom: 7px; }
.required { color: var(--danger); }
textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
.actions { display: flex; gap: 9px; padding-top: 6px; }
.empty, .preview-empty { color: var(--muted); text-align: center; padding: 80px 20px; line-height: 1.8; }
.pdf-viewer { width: 100%; height: calc(100vh - 278px); min-height: 580px; border: 1px solid var(--line); background: #e9edf1; }
code { background: #eef1f4; padding: 2px 4px; border-radius: 3px; }
@media (max-width: 900px) {
  .toolbar { align-items: flex-start; flex-direction: column; }
  .current-template { white-space: normal; }
  .data-note { white-space: normal; }
  .content-grid { grid-template-columns: 1fr; }
  .form-panel, .preview-panel { min-height: auto; }
  .pdf-viewer { min-height: 600px; }
}
