* { box-sizing: border-box; }
:root { --border: #111; --panel: #fff; --bg: #f3f4f6; }
body { margin: 0; font-family: "Microsoft YaHei", system-ui, sans-serif; background: var(--bg); color: #111; }
.app-shell { padding: 20px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.topbar h1 { margin: 0 0 6px; }
.topbar p { margin: 0; color: #555; }
.actions { display: flex; gap: 10px; }
button { border: 0; border-radius: 10px; padding: 12px 16px; cursor: pointer; }
.primary { background: #2563eb; color: #fff; }
.secondary { background: #e5e7eb; }
.layout { display: grid; grid-template-columns: 360px 1fr; gap: 16px; align-items: start; }
.panel { background: var(--panel); border-radius: 16px; padding: 16px; box-shadow: 0 10px 28px rgba(0,0,0,.08); }
.grid-form { display: grid; gap: 8px; grid-template-columns: 1fr; }
.compact-form { max-height: none; overflow: visible; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
input, textarea, select { border: 1px solid #bbb; border-radius: 8px; padding: 8px 10px; font: inherit; width: 100%; }
textarea { resize: vertical; min-height: 92px; }
.full { grid-column: 1 / -1; }
.paper-wrap { overflow: auto; background: #e5e7eb; padding: 12px; border-radius: 16px; }
.paper { width: 148mm; height: 210mm; background: #fff; margin: 0 auto; padding: 4mm 3mm 4mm; }
.title-block { text-align: center; font-weight: 900; margin: 3mm 0 3mm; }
.title-line { font-size: 31px; line-height: 1.18; letter-spacing: 0; }
.template-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-weight: 700; font-size: 15px; }
.template-table th, .template-table td { border: 2px solid var(--border); padding: 1px 3px; text-align: center; vertical-align: middle; word-break: break-all; }
.template-table th { background: #fff; }
.c1 { width: 16%; } .c2 { width: 17%; } .c3 { width: 17%; } .c4 { width: 17%; } .c5 { width: 16%; } .c6 { width: 17%; }
.template-table tr { height: 18mm; }
.template-table tr:nth-child(2) { height: 16mm; }
.template-table tr:nth-child(3) { height: 16mm; }
.config-row td { height: 76mm; text-align: center; vertical-align: middle; }
.config-row .vertical { width: 12%; writing-mode: vertical-rl; text-orientation: upright; letter-spacing: 0; font-size: 17px; }
.config-text { white-space: pre-wrap; font-size: 13px; line-height: 1.25; font-weight: 700; text-align: center; }
.grade-cell { font-size: 22px; font-weight: 900; }
.grade-value { font-size: 46px; font-weight: 900; }
#paperBusinessTerms { text-align: left; }
@media print {
  @page { size: A5 portrait; margin: 0; }
  body { background: #fff; }
  .no-print { display: none !important; }
  .app-shell { padding: 0; }
  .layout { display: block; }
  .paper-wrap { padding: 0; background: #fff; }
  .paper { width: 148mm; height: 210mm; margin: 0; padding: 5mm 4mm 2mm; }
}
