.estimate-generator-app { box-sizing: border-box; width: 100%; max-width: 100%; color: #172033; }
.estimate-generator-app *, .estimate-generator-app *::before, .estimate-generator-app *::after { box-sizing: border-box; }
.estimate-generator-app h2 { margin-top: 0; }
.estimate-generator-intro { color: #536174; }
.estimate-editor, .estimate-preview-pane { min-width: 0; }
.estimate-form { display: grid; gap: 18px; }
.estimate-fieldset { min-width: 0; margin: 0; padding: 16px; border: 1px solid #dce3ec; border-radius: 9px; }
.estimate-fieldset legend { padding: 0 7px; font-weight: 700; }
.estimate-field { display: flex; min-width: 0; flex-direction: column; gap: 5px; margin: 0 0 12px; }
.estimate-field:last-child { margin-bottom: 0; }
.estimate-field label { font-size: .9rem; font-weight: 600; }
.estimate-field input, .estimate-field textarea, .estimate-field select { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid #bac5d2; border-radius: 6px; background: #fff; color: #172033; font: inherit; }
.estimate-field textarea { min-height: 68px; resize: vertical; }
.estimate-field input[readonly] { background: #f5f7fa; color: #536174; }
.estimate-field input:focus, .estimate-field textarea:focus, .estimate-field select:focus, .estimate-button:focus-visible, .estimate-remove-item:focus-visible { outline: 3px solid rgba(37, 99, 235, .25); outline-offset: 2px; border-color: #2563eb; }
.estimate-field input[aria-invalid="true"] { border-color: #b42318; background: #fff8f7; }
.estimate-validation { margin: 0; padding: 10px 12px; border-radius: 6px; background: #fff5f4; color: #8e2118; }
.estimate-validation[hidden] { display: none; }
.estimate-help { margin: 0 0 12px; color: #536174; font-size: .88rem; }
.estimate-item-rows { display: grid; gap: 12px; }
.estimate-item-editor { display: grid; grid-template-columns: minmax(55px, .65fr) minmax(80px, 1.5fr) minmax(48px, .55fr) minmax(45px, .5fr) minmax(65px, .9fr) minmax(75px, 1fr); gap: 9px; align-items: end; padding: 12px; border: 1px solid #e2e8f0; border-radius: 8px; }
.estimate-item-editor-head { display: flex; grid-column: 1 / -1; align-items: center; justify-content: space-between; }
.estimate-remove-item { padding: 5px 8px; border: 0; background: transparent; color: #9b1c1c; font: inherit; font-size: .88rem; cursor: pointer; text-decoration: underline; }
.estimate-remove-item:disabled { color: #7b8491; cursor: not-allowed; text-decoration: none; }
.estimate-adjustments { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.estimate-adjustments legend { grid-column: 1 / -1; }
.estimate-adjustments .estimate-field { margin: 0; }
.estimate-button { min-height: 42px; padding: 9px 14px; border: 1px solid #c4ceda; border-radius: 7px; background: #fff; color: #172033; font: inherit; font-weight: 600; cursor: pointer; }
.estimate-button:hover { background: #f5f7fa; }
.estimate-button.is-primary { border-color: #1d4ed8; background: #1d4ed8; color: #fff; }
.estimate-add-item { margin-top: 12px; }
.estimate-editor-actions { display: flex; justify-content: flex-end; }
.estimate-preview-pane { margin-top: 28px; }
.estimate-preview-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.estimate-preview-header h3 { margin: 0; }
.estimate-preview-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.estimate-print-hint { margin: 0 0 12px; color: #536174; font-size: .88rem; }
.estimate-document { min-width: 0; padding: clamp(18px, 3vw, 36px); border: 1px solid #dce3ec; border-radius: 8px; background: #fff; box-shadow: 0 3px 16px rgba(15, 23, 42, .07); }
.estimate-paper { width: 100%; max-width: 880px; margin: 0 auto; overflow-wrap: anywhere; }
.estimate-document-top { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 22px; border-bottom: 2px solid #334155; }
.estimate-business-block { min-width: 0; }
.estimate-business-name { min-height: 1em; margin: 0 0 8px; font-size: 1.25rem; }
.estimate-business-block p, .estimate-prepared-for p, .estimate-extra p { margin: 4px 0; white-space: pre-line; }
.estimate-title-block { min-width: 190px; text-align: right; }
.estimate-title-block h1 { margin: 0 0 12px; color: #0f766e; font-size: 2rem; letter-spacing: .07em; }
.estimate-meta { margin: 0; }
.estimate-meta-row { display: grid; grid-template-columns: auto auto; justify-content: end; gap: 10px; margin: 5px 0; font-size: .88rem; }
.estimate-meta-row dt { color: #536174; }
.estimate-meta-row dd { margin: 0; text-align: right; font-weight: 600; }
.estimate-project-block { margin: 20px 0; padding: 14px 16px; border-left: 4px solid #0f766e; background: #f0fdfa; }
.estimate-project-block > h2 { margin: 0 0 9px; font-size: 1.2rem; }
.estimate-project-block h3, .estimate-extra h3 { margin: 10px 0 5px; font-size: .9rem; text-transform: uppercase; letter-spacing: .04em; }
.estimate-project-description { margin: 0; white-space: pre-line; }
.estimate-project-dates .estimate-meta-row { justify-content: start; grid-template-columns: auto auto; }
.estimate-prepared-for { padding: 18px 0; }
.estimate-prepared-for h3 { margin: 0 0 8px; font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; }
.estimate-table-wrap { width: 100%; overflow-x: auto; }
.estimate-items-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.estimate-items-table th, .estimate-items-table td { padding: 9px 6px; border-bottom: 1px solid #e2e8f0; text-align: right; overflow-wrap: anywhere; }
.estimate-items-table th { background: #f0fdfa; font-size: .82rem; }
.estimate-items-table .column-description { width: 30%; text-align: left; }
.estimate-totals-section { width: min(100%, 390px); margin: 16px 0 0 auto; }
.estimate-totals { margin: 0; }
.estimate-totals .estimate-meta-row { padding: 3px 0; }
.estimate-total-row { display: flex; justify-content: space-between; gap: 16px; margin-top: 10px; padding: 13px 0; border-top: 2px solid #0f766e; color: #0f514b; font-size: 1.15rem; }
.estimate-extra { margin-top: 20px; padding-top: 12px; border-top: 1px solid #e2e8f0; }

@media (min-width: 1100px) {
	.estimate-generator-app { display: grid; grid-template-columns: minmax(390px, .9fr) minmax(0, 1.1fr); column-gap: 24px; align-items: start; }
	.estimate-generator-app > h2, .estimate-generator-app > .estimate-generator-intro { grid-column: 1 / -1; }
	.estimate-generator-app > h2 { margin-bottom: 0; }
	.estimate-generator-app > .estimate-generator-intro { margin-top: 5px; }
	.estimate-editor, .estimate-preview-pane { margin-top: 0; }
	.estimate-editor { grid-column: 1; grid-row: 3; }
	.estimate-preview-pane { grid-column: 2; grid-row: 3; }
}
@media (max-width: 760px) {
	.estimate-item-editor { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.estimate-item-editor-head { grid-column: 1 / -1; }
	.estimate-adjustments { grid-template-columns: 1fr; }
	.estimate-document { padding: 16px 12px; }
	.estimate-document-top { gap: 12px; }
	.estimate-title-block { min-width: 145px; }
	.estimate-title-block h1 { font-size: 1.55rem; }
	.estimate-items-table { min-width: 660px; }
	.estimate-items-table th, .estimate-items-table td { padding: 8px 4px; font-size: .82rem; }
}
@media print {
	@page { size: auto; margin: 14mm; }
	body * { visibility: hidden !important; }
	#tool-engine-app, #tool-engine-app * { visibility: visible !important; }
	#tool-engine-app { position: absolute !important; inset: 0 auto auto 0 !important; width: 100% !important; max-width: none !important; margin: 0 !important; padding: 0 !important; }
	.estimate-generator-app { display: block !important; width: 100% !important; margin: 0 !important; padding: 0 !important; }
	.estimate-generator-app > h2, .estimate-generator-app > .estimate-generator-intro { display: none !important; }
	.no-print, .estimate-editor, .estimate-preview-header, .estimate-print-hint { display: none !important; }
	.estimate-preview-pane { display: block !important; margin: 0 !important; }
	.estimate-document { display: block !important; width: 100% !important; margin: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; }
	.estimate-paper { max-width: none !important; }
	.estimate-items-table { min-width: 0 !important; page-break-inside: auto; }
	.estimate-items-table tr { page-break-inside: avoid; }
}
