.budget-editor { border: 1px solid var(--line); border-radius: 10px; background: var(--panel, #161c23); overflow: hidden; }
.budget-editor fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.budget-intro { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.budget-intro p, .budget-intro small { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 5px 0 0; }
.budget-header-fields, .budget-section-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 16px 20px; }
.budget-editor label { display: grid; gap: 6px; font-size: 13px; min-width: 0; }
.budget-merge-control { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 0 20px 16px; }
.budget-merge-control label { display: flex; align-items: center; gap: 8px; }
.budget-merge-control small { color: var(--muted); font-size: 12px; }
.budget-editor .input, .budget-editor .select { width: 100%; height: 42px; min-width: 0; margin: 0; padding: 8px 10px; font-size: 14px; }
.budget-work-item { border-top: 1px solid var(--line); }
.budget-section-head { padding: 16px 20px 4px; display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.budget-section-head h2 { font-size: 18px; margin: 4px 0; overflow-wrap: anywhere; }
.budget-section-head p { margin: 0; color: var(--muted); font-size: 13px; white-space: pre-wrap; }
.budget-section-head span, .budget-unit-total small { color: var(--muted); font-size: 12px; }
.budget-unit-total { text-align: right; display: grid; gap: 3px; flex: 0 0 auto; }
.budget-unit-total strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.budget-section-fields { max-width: 100%; }
.budget-unit-help { margin: 0; padding: 0 20px 16px; color: var(--muted); font-size: 12px; }
.budget-code-field { display: grid; gap: 8px; }
.budget-editor .budget-code-toggle { display: flex; align-items: center; gap: 8px; }
.budget-table-scroll { overflow-x: auto; }
.budget-entry-table { width: 100%; min-width: 860px; table-layout: fixed; border-collapse: collapse; font-size: 13px; }
.budget-entry-table th, .budget-entry-table td { padding: 10px 12px; vertical-align: middle; overflow-wrap: anywhere; border-bottom: 1px solid var(--line); }
.budget-entry-table td small { display: block; color: var(--muted); white-space: pre-wrap; margin-top: 3px; }
.budget-entry-table td small:empty { display: none; }
.budget-row-text { display: grid; gap: 6px; }
.budget-editor .budget-row-text .input { height: 34px; font-size: 13px; padding: 6px 8px; }
.budget-original { color: var(--muted); font-size: 12px; }
.budget-original summary { cursor: pointer; overflow-wrap: anywhere; }
.budget-original small { padding: 4px 0; line-height: 1.5; }
.budget-name-col { width: 24%; }.budget-unit-col { width: 9%; }.budget-number-col { width: 11%; }.budget-category-col { width: 12%; }.budget-note-col { width: 22%; }
.budget-num { text-align: right; font-variant-numeric: tabular-nums; }
.budget-classification, .budget-print-summary { display: flex; flex-wrap: wrap; gap: 12px 28px; padding: 14px 20px; }
.budget-classification span, .budget-print-summary span { display: flex; gap: 12px; align-items: baseline; }
.budget-classification b { font-weight: 400; color: var(--muted); font-size: 13px; }
.budget-classification strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.budget-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding: 16px 20px; border-top: 1px solid var(--line); }
[data-budget-feedback] { font-size: 13px; color: var(--muted); } [data-budget-feedback].is-error { color: #ef9595; }
.budget-warning { margin: 14px 20px; padding: 12px 16px; border: 1px solid #a17b31; background: #fff4d8; color: #5e4212; border-radius: 6px; line-height: 1.6; }
.budget-warning button { margin: 8px; }
.budget-preview-tools { max-width: 194mm; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 auto 18px; }
.budget-preview-tools p { flex-basis: 100%; font-size: 13px; margin: 0; color: var(--muted); }
.budget-preview-tools .btn.outline { color: #193b60; border-color: #72879d; background: #fff; }
.budget-preview-tools p { color: #526171; }
.budget-sheet { box-sizing: border-box; background: white; color: #111; width: 194mm; max-width: 100%; margin: 0 auto 22px; padding: 12mm 9mm; font-family: 'PMingLiU', 'Noto Serif TC', serif; border: 1px solid #bfc4ca; }
.budget-sheet header { text-align: center; margin-bottom: 16px; }
.budget-sheet header p { margin: 0 0 8px; font-size: 15px; }
.budget-sheet h1 { margin: 0; font-size: 22px; letter-spacing: .12em; color: #111; }
.budget-print-meta { display: grid; gap: 8px; font-size: 14px; margin-bottom: 14px; }
.budget-print-meta div { display: flex; gap: 14px; }.budget-print-meta b { flex: 0 0 84px; font-weight: 400; white-space: nowrap; }.budget-print-meta span { min-height: 20px; overflow-wrap: anywhere; white-space: pre-wrap; }
.budget-print-item { font-size: 13px; }
.budget-print-item div { overflow-wrap: anywhere; white-space: pre-wrap; }.budget-print-item b { font-weight: 400; }
.budget-sheet .budget-print-table { width: 100%; min-width: 0; table-layout: fixed; border-collapse: collapse; font-size: 12px; }
.budget-sheet .budget-print-table th, .budget-sheet .budget-print-table td { border: 1px solid #333; padding: 8px 5px; line-height: 1.45; color: #111; background: white; white-space: normal; overflow-wrap: anywhere; }
.budget-sheet .budget-print-table th { text-align: center; font-weight: 400; background: white; color: #111; }
.budget-sheet .budget-print-item th:nth-child(2), .budget-sheet .budget-print-item th:last-child { text-align: left; }
.budget-print-table th small { display: block; font-size: 11px; white-space: pre-wrap; }
.budget-blank-row { height: 24px; }
.budget-company-summary td { font-size: 12px; font-weight: 400; }
.budget-company-summary div { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.budget-sheet .budget-print-table tbody tr > td:first-child, .budget-sheet .budget-print-table thead tr:not(.budget-print-item) > th:first-child { border: 0; }
.budget-print-table td small { display: block; font-size: 11px; white-space: pre-wrap; }
.budget-print-table thead { display: table-header-group; }.budget-print-table tr { break-inside: avoid; }
.budget-sheet .budget-print-table .budget-total-row td { border-top: 2px solid #333; border-bottom: 1px solid #333; font-weight: 600; }
.budget-sheet .budget-closing-info > td { border: 0; padding: 0; }
.budget-print-summary { padding: 12px 0; font-size: 13px; gap: 10px 24px; border-bottom: 1px solid #222; }
.budget-print-summary b, .budget-print-summary strong { font-weight: 400; font-variant-numeric: tabular-nums; }
.budget-sheet footer { padding-top: 10px; font-size: 13px; display: grid; gap: 7px; }
.budget-sheet footer small { font-size: 10px; color: #555; }
@media (max-width: 700px) {
  .budget-header-fields { grid-template-columns: 1fr; }.budget-section-head { flex-direction: column; gap: 8px; }.budget-unit-total { text-align: left; }
  .budget-preview { padding: 12px 6px; }.budget-sheet { padding: 7mm 4mm; }.budget-print-table { font-size: 11px; }
}
@media print {
  body:has(.budget-preview) { min-height: 0; }
  .budget-preview-tools { display: none !important; }.budget-preview { min-height: 0; padding: 0 !important; margin: 0 !important; background: white !important; }
  .budget-sheet { width: 100%; max-width: none; border: 0; padding: 0 .3mm; margin: 0; break-after: page; }
  .budget-sheet:last-child { break-after: auto; }.budget-sheet header, .budget-print-meta, .budget-print-item { break-after: avoid; }
  .budget-sheet footer, .budget-print-summary, .budget-closing-body { break-inside: avoid; }
}
