.tool-main { max-width: 1440px; }
.tool-intro { max-width: 50rem; }
.tool-lead { max-width: 38rem; margin-top: 1.5rem; color: var(--color-muted); font-size: 1.08rem; line-height: 1.7; }
.privacy-note { display: inline-flex; align-items: center; gap: .65rem; margin-top: 1.15rem; border: 1px solid #e3e7d7; border-radius: 999px; background: #f0f3e8; padding: .55rem .8rem; color: #5e6848; font-size: .76rem; }
.privacy-note > span:first-child { color: #839d38; font-size: .95rem; }
.tool-layout { display: grid; align-items: start; gap: 1.5rem; margin-top: 3.25rem; }
.form-panel, .preview-panel { min-width: 0; border: 1px solid var(--color-line); border-radius: 1rem; background: #fff; }
.form-panel { padding: 1.2rem; }
.panel-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; padding: .3rem .2rem 1.25rem; border-bottom: 1px solid var(--color-line); }
.required-note { color: var(--color-muted); font-size: .68rem; }
.field-group { min-width: 0; margin: 0; padding: 1.35rem .2rem; border: 0; border-bottom: 1px solid var(--color-line); }
.field-group legend { margin-bottom: .8rem; padding: 0; font-size: .86rem; font-weight: 700; letter-spacing: -.015em; }
.field-grid { display: grid; gap: .8rem; }
.field-grid-three { grid-template-columns: 1fr 1fr; }
.field { display: grid; min-width: 0; gap: .42rem; color: #52574e; font-size: .72rem; font-weight: 600; }
.field > span i { color: #a35843; font-style: normal; }
.field input, .field textarea, .field select, .item-row input { width: 100%; min-width: 0; border: 1px solid #dcdfd6; border-radius: .55rem; outline: none; background: #fdfdfa; padding: .72rem .75rem; color: var(--color-ink); font: 500 .84rem/1.45 var(--font-sans); transition: border-color .15s ease, box-shadow .15s ease; }
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus, .item-row input:focus { border-color: #879b52; box-shadow: 0 0 0 3px #d8f36a55; }
.field-grid-three .field-wide { grid-column: 1 / -1; }
.template-options { display: grid; gap: .5rem; }
.template-option { display: flex; align-items: flex-start; gap: .65rem; cursor: pointer; border: 1px solid #e2e4dc; border-radius: .65rem; padding: .7rem; transition: border-color .15s ease, background .15s ease; }
.template-option:has(input:checked) { border-color: #a8bb69; background: #f7f9f0; }
.template-option input { flex: 0 0 auto; margin: .18rem 0 0; accent-color: #758e35; }
.template-option b, .template-option small { display: block; }
.template-option b { color: var(--color-ink); font-size: .77rem; }
.template-option small { margin-top: .18rem; color: var(--color-muted); font-size: .66rem; line-height: 1.4; }
.field-hint { margin: -.28rem 0 .75rem; color: var(--color-muted); font-size: .68rem; line-height: 1.5; }
.item-list { display: grid; gap: .65rem; }
.item-row { display: grid; grid-template-columns: minmax(0, 1fr) 4rem 5.3rem 2rem; align-items: end; gap: .4rem; }
.item-field { display: grid; min-width: 0; gap: .3rem; color: var(--color-muted); font-size: .62rem; font-weight: 600; }
.item-row input { padding: .65rem .55rem; font-size: .75rem; }
.item-row .item-description input { min-height: 2.55rem; }
.remove-item { display: grid; width: 2rem; height: 2.55rem; place-items: center; border: 0; border-radius: .5rem; background: transparent; color: #777d71; cursor: pointer; font-size: 1.1rem; }
.remove-item:hover { background: #f5eee9; color: #8f4d38; }
.add-item { display: inline-flex; align-items: center; gap: .35rem; margin-top: .75rem; border: 0; background: transparent; padding: .35rem 0; color: #5e7132; cursor: pointer; font: 700 .76rem var(--font-sans); }
.add-item:hover { color: var(--color-ink); }
.form-actions { display: grid; justify-items: start; gap: .7rem; padding: 1.2rem .2rem .25rem; }
.form-actions p { margin: 0; color: var(--color-muted); font-size: .7rem; }
.form-actions p b { color: var(--color-ink); }
.preview-panel { position: sticky; top: 1rem; overflow: hidden; background: #efefe9; }
.preview-toolbar { display: flex; align-items: end; justify-content: space-between; gap: .5rem; padding: 1rem; }
.preview-toolbar h2 { margin: 0; font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; letter-spacing: -.04em; }
.preview-live { display: inline-flex; align-items: center; gap: .35rem; color: #6c735f; font-size: .61rem; white-space: nowrap; }
.preview-live span { width: .38rem; height: .38rem; border-radius: 50%; background: #8aa741; }
.document-preview { margin: 0 .65rem; border: 1px solid #e7e8e1; background: #fff; padding: 1.2rem .95rem; color: #282a25; box-shadow: 0 8px 30px #28291b0c; }
.document-topline { display: flex; justify-content: space-between; gap: .5rem; padding-bottom: .8rem; border-bottom: 2px solid #292d25; }
.document-mark, .document-number, .document-label { color: #74796e; font-size: .55rem; font-weight: 700; letter-spacing: .13em; }
.document-title { margin: 1rem 0 .7rem; font-family: var(--font-display); font-size: 1.75rem; font-weight: 650; letter-spacing: -.055em; line-height: 1.05; }
.document-dates { display: grid; grid-template-columns: auto 1fr; gap: .28rem .7rem; max-width: 18rem; color: #6c7168; font-size: .63rem; }
.document-dates b { color: #292d25; font-weight: 600; }
.document-parties { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin: 1.15rem 0; border-top: 1px solid #e5e6df; border-bottom: 1px solid #e5e6df; padding: .8rem 0; }
.document-parties section { min-width: 0; }
.document-parties b { display: block; margin-top: .3rem; overflow-wrap: anywhere; font-size: .7rem; }
.document-parties p { margin: .22rem 0 0; overflow-wrap: anywhere; white-space: pre-line; color: #686d63; font-size: .61rem; line-height: 1.45; }
.document-table-wrap { overflow-x: auto; }
.document-table { width: 100%; border-collapse: collapse; text-align: left; }
.document-table th { border-bottom: 1px solid #dfe1d9; padding: .45rem .2rem; color: #777d72; font-size: .52rem; font-weight: 700; }
.document-table td { border-bottom: 1px solid #eff0ec; padding: .5rem .2rem; font-size: .61rem; vertical-align: top; }
.document-table th:not(:first-child), .document-table td:not(:first-child) { text-align: right; white-space: nowrap; }
.document-table td:first-child { min-width: 5rem; overflow-wrap: anywhere; }
.document-tax-summary { display: grid; justify-items: end; gap: .45rem; padding: .85rem 0; }
.document-tax-summary > div { display: flex; align-items: baseline; justify-content: flex-end; gap: .7rem; }
.document-tax-summary span { color: #63695e; font-size: .7rem; font-weight: 600; }
.document-tax-summary strong { font-size: .85rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.document-tax-summary small { color: #7c8177; font-size: .55rem; }
.document-grand-total { border-top: 1px solid #dfe1d9; padding-top: .55rem; }
.document-grand-total strong { font-family: var(--font-display); font-size: 1.25rem; letter-spacing: -.04em; }
.document-notes { border-top: 1px solid #e5e6df; padding-top: .7rem; }
.document-notes p { margin: .35rem 0 0; color: #555a51; font-size: .62rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.document-footer { margin-top: 1.1rem; border-top: 1px solid #e5e6df; padding-top: .55rem; color: #8a8e85; font-size: .52rem; }
.preview-disclaimer { margin: 0; padding: .75rem 1rem .9rem; color: #74796f; font-size: .62rem; line-height: 1.5; }
@media (min-width: 700px) { .form-panel { padding: 1.65rem; }.field-grid { grid-template-columns: 1fr 1fr; }.field-grid-three { grid-template-columns: repeat(3, 1fr); }.field-grid-three .field-wide { grid-column: auto; }.template-options { grid-template-columns: repeat(3, 1fr); }.tool-layout { gap: 2rem; }.document-preview { padding: 1.6rem 1.4rem; }.document-title { font-size: 2rem; } }
@media (min-width: 1060px) { .tool-layout { grid-template-columns: minmax(0, 1fr) minmax(390px, .78fr); gap: 2rem; }.form-panel { padding: 1.8rem; }.document-preview { margin: 0 .85rem; padding: 1.75rem 1.5rem; }.preview-toolbar { padding: 1.2rem 1.4rem; }.document-parties { gap: 1rem; }.document-table td, .document-parties b { font-size: .68rem; } }
@media (max-width: 380px) { .item-row { grid-template-columns: minmax(0, 1fr) 3.2rem 4.3rem 1.7rem; gap: .25rem; }.item-row input { padding-inline: .35rem; font-size: .68rem; }.remove-item { width: 1.7rem; }.preview-live { font-size: .55rem; } }
@media print {
  @page { size: A4; margin: 14mm; }
  html, body { background: #fff !important; color: #20231e !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  body > * { display: none !important; }
  body.print-document #main { display: block !important; max-width: none; margin: 0; padding: 0; }
  body.print-document #main > *:not(.tool-layout) { display: none !important; }
  body.print-document .tool-layout { display: block; margin: 0; }
  body.print-document .tool-layout > *:not(.preview-panel) { display: none !important; }
  body.print-document .preview-panel { position: static; display: block; overflow: visible; border: 0; border-radius: 0; background: #fff; }
  body.print-document .preview-toolbar, body.print-document .preview-disclaimer { display: none !important; }
  body.print-document .document-preview { display: block; margin: 0; border: 0; padding: 0; box-shadow: none; font-size: 10pt; }
  body.print-document .document-topline { padding-bottom: 5mm; }
  body.print-document .document-title { margin: 7mm 0 4mm; font-size: 23pt; }
  body.print-document .document-dates { gap: 2mm 5mm; font-size: 9pt; }
  body.print-document .document-parties { gap: 8mm; margin: 7mm 0; padding: 5mm 0; }
  body.print-document .document-label, body.print-document .document-mark, body.print-document .document-number { font-size: 7pt; }
  body.print-document .document-parties b { font-size: 10pt; }
  body.print-document .document-parties p { font-size: 9pt; }
  body.print-document .document-table th { padding: 3mm 1mm; font-size: 8pt; }
  body.print-document .document-table td { padding: 3mm 1mm; font-size: 9pt; }
  body.print-document .document-tax-summary { gap: 2mm; padding: 5mm 0; }
  body.print-document .document-tax-summary span, body.print-document .document-tax-summary strong { font-size: 10pt; }
  body.print-document .document-grand-total strong { font-size: 18pt; }
  body.print-document .document-notes p { font-size: 9pt; }
  body.print-document .document-footer { margin-top: 10mm; font-size: 8pt; }
  body.print-document .document-table tr, body.print-document .document-parties, body.print-document .document-tax-summary, body.print-document .document-notes { break-inside: avoid; }
}
