:root {
  font: 16px/1.55 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: #111827;
  --blue: #2563eb;
  --line: #dce2eb;
}
* { box-sizing: border-box; }
body, h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
a { color: inherit; }
:focus-visible { outline: 3px solid #b45309; outline-offset: 2px; }
.wrap { max-width: 1260px; margin: auto; padding-inline: 24px; }
.top, .foot { background: #111827; color: white; }
.top { border-bottom: 4px solid #3b82f6; }
.top-inner, .foot .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-block: 14px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand strong, .brand small { display: block; }
.brand small { color: #d1d5db; }
.mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 6px; background: var(--blue); font-size: 27px; font-weight: 900; }
.lab { color: #111827; background: #fbbf24; border-radius: 5px; padding: 2px 7px; font-size: 12px; align-self: flex-start; }
nav { display: flex; gap: 16px; font-size: 14px; }
.hero { background: #eff6ff; border-bottom: 1px solid #bfdbfe; }
.hero .wrap { padding-block: 24px 28px; }
.hero h1 { font-size: clamp(26px, 4vw, 38px); margin-bottom: 6px; }
.hero p { color: #334155; max-width: 880px; }
.main { padding-block: 24px 36px; }
.workspace { display: grid; grid-template-columns: minmax(310px, 395px) minmax(0, 1fr); gap: 18px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 7px; overflow: hidden; min-width: 0; }
.head { padding: 14px 16px; border-bottom: 1px solid var(--line); background: #f8fafc; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.head h2 { font-size: 18px; }
.head a { color: #1d4ed8; font-size: 14px; }
.body { padding: 16px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
.wide { grid-column: 1 / -1; }
label, legend { display: block; font-weight: 700; font-size: 14px; margin-bottom: 5px; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { width: 100%; min-width: 0; border: 1px solid #aab5c6; border-radius: 6px; padding: 7px 9px; min-height: 42px; margin-bottom: 12px; background: white; }
textarea { resize: vertical; }
button, .button { display: inline-flex; align-items: center; justify-content: center; padding: 8px 11px; min-height: 41px; border: 1px solid #aab5c6; border-radius: 6px; font-size: 14px; font-weight: 700; text-decoration: none; background: #f8fafc; cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { color: white; background: var(--blue); border-color: var(--blue); }
.primary:hover:not(:disabled) { background: #1d4ed8; }
fieldset { padding: 8px; border: 1px solid var(--line); border-radius: 6px; margin: 0 0 12px; }
.item-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 5px; margin-bottom: 6px; }
.item-row input { margin: 0; }
.item-row button { padding-inline: 7px; }
.hint { margin-top: 8px; color: #475569; font-size: 14px; }
.amount-display, .error:not(:empty) { margin-bottom: 10px; padding: 8px; font-size: 14px; overflow-wrap: anywhere; }
.amount-display { color: #1e40af; background: #eff6ff; }
.error:not(:empty) { color: #991b1b; background: #fef2f2; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.stage { background: #eef2f7; padding: 16px; }
.paper { background: white; border: 1px solid var(--line); padding: clamp(12px, 3vw, 40px); min-height: 520px; }
.document { font-size: 14px; color: #111827; }
.document h2 { text-align: center; margin: 0 0 18px; font-size: 26px; }
.details { margin: 0 0 12px; }
.detail { display: grid; grid-template-columns: minmax(100px, 31%) 1fr; gap: 6px; border-bottom: 1px solid #aab5c6; min-height: 31px; align-items: center; padding-block: 4px; break-inside: avoid; }
.detail dt { font-weight: 700; }
.detail dd { margin: 0; overflow-wrap: anywhere; }
.item-table { border-collapse: collapse; width: 100%; margin: 12px 0; }
.item-table th, .item-table td { border: 1px solid #aab5c6; padding: 4px 6px; height: 28px; text-align: left; overflow-wrap: anywhere; }
.item-table th:last-child, .item-table td:last-child { width: 35%; text-align: right; }
.item-table tr, .note { break-inside: avoid; }
.note { border-bottom: 1px solid #aab5c6; padding-bottom: 3px; }
.note p { min-height: 28px; white-space: pre-wrap; overflow-wrap: anywhere; }
.signature { margin-top: 14px; min-height: 42px; break-inside: avoid; }
.guide { margin-top: 24px; }
.guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.guide h3 { font-size: 16px; margin-bottom: 6px; }
.guide p { color: #475569; }
.foot { border-top: 4px solid #3b82f6; }
#print-root { display: none; }
@media (max-width: 730px) {
  .wrap { padding-inline: 14px; }
  .workspace, .guide-grid { grid-template-columns: minmax(0, 1fr); }
  .brand strong { font-size: 14px; }
  .stage { padding: 10px; }
  .paper { min-height: 0; }
}
@page { size: A4 portrait; margin: 14mm; }
@media print {
  body > :not(#print-root) { display: none !important; }
  #print-root { display: block; }
  .document { font-size: 11pt; }
  .detail { grid-template-columns: 36mm 1fr; }
  .item-table thead { display: table-header-group; }
}
