/* The paper table uses the runtime/PDF metrics. Editing tools live in the
   paper margin, so focus, selection and actions never increase a row's height. */
.project-quotes-panel .quote-editor-view .quote-document-edit-feedback {
    position: sticky;
    top: 0;
    z-index: 30;
    width: min(794px, 100%);
    margin: 0 auto 10px;
    padding: 8px 12px;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-left: 3px solid #075985;
    background: #f8fafc;
    color: #334155;
    font-size: 12px;
    box-shadow: 0 2px 8px #0f172a0d;
}

.project-quotes-panel .quote-editor-view .quote-document-edit-feedback .btn {
    margin-left: 10px;
    min-height: 26px;
    padding: 3px 8px;
    font-size: 11px;
}

.project-quotes-panel .quote-editor-view .quote-document-inline-errors:empty {
    display: none;
}

/* Document-only mode hides legacy position details. Keep its explicit archive
   and restore confirmations reachable without changing the paper's columns. */
.project-quotes-panel .quote-editor-view[data-quote-editor-layout="document-and-position-list"] .quote-side-panel:has(.quote-position-archive-dialog) {
    display: block;
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 40;
    width: min(360px, calc(100% - 24px));
    min-width: 0;
    max-height: calc(100% - 24px);
    overflow: auto;
    border-color: #94a3b8;
    box-shadow: 0 8px 24px #0f172a26;
    font-size: 12px;
}

.project-quotes-panel .quote-editor-view .quote-side-panel:has(.quote-position-archive-dialog) > .quote-side-tabs,
.project-quotes-panel .quote-editor-view .quote-side-panel:has(.quote-position-archive-dialog) .quote-side-body > :not([data-quote-selected-card]),
.project-quotes-panel .quote-editor-view .quote-side-panel:has(.quote-position-archive-dialog) [data-quote-selected-card] > :not(.quote-position-archive-dialog) {
    display: none;
}

.project-quotes-panel .quote-editor-view .quote-side-panel:has(.quote-position-archive-dialog) .quote-side-body {
    padding: 0;
    gap: 0;
}

.project-quotes-panel .quote-editor-view .quote-side-panel:has(.quote-position-archive-dialog) .quote-position-archive-dialog {
    border: 0;
    padding: 14px;
}

.project-quotes-panel .quote-editor-view .quote-document-table-heading {
    min-height: 8mm;
    margin: 0;
    color: #075985;
    font: 700 11pt/1.2 Inter, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

/* The background projection already suppresses the replaced table. Leave the
   unused anchor area transparent so template footer text is not partly covered. */
.project-quotes-panel .quote-editor-view .quote-positions-dropzone[data-quote-template-live-position-anchor="true"] {
    background: transparent;
}

.project-quotes-panel .quote-editor-view .quote-positions-dropzone[data-quote-template-live-position-anchor="true"] .quote-table {
    width: 100%;
    margin: 0;
    border: 0;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: var(--quote-table-font);
    line-height: var(--quote-table-line);
    color: #1f2937;
    background: #fff;
    font-variant-numeric: tabular-nums;
}

.project-quotes-panel .quote-editor-view .quote-table thead[hidden] {
    display: none;
}

.project-quotes-panel .quote-editor-view .quote-table tr {
    position: relative;
    break-inside: avoid;
}

.project-quotes-panel .quote-editor-view .quote-positions-dropzone[data-quote-template-live-position-anchor="true"] .quote-table th {
    height: var(--quote-table-header-height);
    padding: var(--quote-table-header-pad) var(--quote-table-pad-x);
    border-top: var(--quote-table-header-top) solid #334155;
    border-bottom: var(--quote-table-header-bottom) solid #334155;
    background: #f1f5f9;
    color: #334155;
    vertical-align: middle;
    font-size: var(--quote-table-header-font);
    font-weight: 600;
    line-height: var(--quote-table-header-line);
    white-space: normal;
    overflow-wrap: anywhere;
}

.project-quotes-panel .quote-editor-view .quote-positions-dropzone[data-quote-template-live-position-anchor="true"] .quote-table td {
    padding: var(--quote-table-pad-y) var(--quote-table-pad-x);
    border-bottom: var(--quote-table-rule) solid #cbd5e1;
    vertical-align: top;
    font-size: inherit;
    line-height: var(--quote-table-line);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.project-quotes-panel .quote-editor-view .quote-positions-dropzone[data-quote-template-live-position-anchor="true"] .quote-table .num,
.project-quotes-panel .quote-editor-view .quote-positions-dropzone[data-quote-template-live-position-anchor="true"] .quote-table .pos {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    overflow: visible;
    max-width: none;
}

.project-quotes-panel .quote-editor-view .quote-positions-dropzone[data-quote-template-live-position-anchor="true"] .quote-row-pos-value {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    overflow: visible;
    text-overflow: clip;
}

.project-quotes-panel .quote-editor-view .quote-table td:nth-child(3) {
    text-align: center;
}

.project-quotes-panel .quote-editor-view .quote-positions-dropzone[data-quote-template-live-position-anchor="true"] .quote-doc-inline-input {
    display: block;
    width: 100%;
    height: var(--quote-table-line);
    min-height: 0;
    margin: 0;
    padding: 0;
    border: .18mm solid transparent;
    border-radius: 2px;
    font-size: inherit;
    line-height: normal;
    background-color: transparent;
    color: inherit;
    box-shadow: none;
}

.project-quotes-panel .quote-editor-view .quote-positions-dropzone[data-quote-template-live-position-anchor="true"] .quote-doc-inline-select {
    text-align: center;
    text-align-last: center;
}

.project-quotes-panel .quote-editor-view .quote-doc-inline-input:focus-visible {
    border-color: #1674a6;
    outline: 2px solid #1674a630;
    outline-offset: 0;
    background-color: #fff;
}

.project-quotes-panel .quote-editor-view .quote-doc-inline-input[aria-invalid="true"] {
    border-color: #b42318;
    background-color: #fff1f0;
}

.project-quotes-panel .quote-editor-view .quote-doc-inline-input[data-inline-state="unsaved"] {
    border-bottom-color: #b7791f;
    background-color: #fffaf0;
}

.project-quotes-panel .quote-editor-view .quote-positions-dropzone[data-quote-template-live-position-anchor="true"] .quote-col-drag,
.project-quotes-panel .quote-editor-view .quote-positions-dropzone[data-quote-template-live-position-anchor="true"] .quote-col-actions,
.project-quotes-panel .quote-editor-view .quote-positions-dropzone[data-quote-template-live-position-anchor="true"] .quote-drag-head,
.project-quotes-panel .quote-editor-view .quote-positions-dropzone[data-quote-template-live-position-anchor="true"] .quote-actions-head {
    display: none;
}

.project-quotes-panel .quote-editor-view .quote-table .quote-drag-cell,
.project-quotes-panel .quote-editor-view .quote-table .quote-row-actions-cell {
    position: absolute;
    top: 0;
    width: 6mm;
    height: 5.5mm;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.project-quotes-panel .quote-editor-view .quote-table .quote-drag-cell {
    right: 100%;
}

.project-quotes-panel .quote-editor-view .quote-table .quote-row-actions-cell {
    left: 100%;
}

.project-quotes-panel .quote-editor-view .quote-doc-row-item:focus-within .quote-row-drag-handle,
.project-quotes-panel .quote-editor-view .quote-doc-row-item:focus-within .quote-row-remove-button {
    opacity: 1;
    pointer-events: auto;
}

.project-quotes-panel .quote-editor-view .quote-positions-dropzone[data-quote-template-live-position-anchor="true"] .quote-table tbody tr:nth-child(even) td {
    background-color: #f8fafc;
}

.project-quotes-panel .quote-editor-view .quote-positions-dropzone[data-quote-template-live-position-anchor="true"] .quote-table tbody tr:focus-within td,
.project-quotes-panel .quote-editor-view .quote-positions-dropzone[data-quote-template-live-position-anchor="true"] .quote-table tbody tr.is-selected td {
    background-color: #edf5fb;
    box-shadow: none;
}

.project-quotes-panel .quote-editor-view .quote-positions-dropzone[data-quote-template-live-position-anchor="true"] .quote-table .quote-doc-commercial-row td,
.project-quotes-panel .quote-editor-view .quote-positions-dropzone[data-quote-template-live-position-anchor="true"] .quote-table .quote-doc-row-item[data-quote-document-row-type="heading"] td {
    border-top: var(--quote-table-strong-rule) solid #334155;
    font-weight: 600;
}

.project-quotes-panel .quote-editor-view .quote-positions-dropzone[data-quote-template-live-position-anchor="true"] .quote-table .row-chapter-total td,
.project-quotes-panel .quote-editor-view .quote-positions-dropzone[data-quote-template-live-position-anchor="true"] .quote-table .row-subchapter-total td {
    border-bottom: var(--quote-table-total-rule) solid #334155;
}

.project-quotes-panel .quote-editor-view .quote-template-live-totals {
    width: 100%;
    margin-top: 4mm;
    gap: 0;
    font-size: 8pt;
    line-height: 1.25;
}

.project-quotes-panel .quote-editor-view .quote-template-live-totals > div {
    display: grid;
    box-sizing: border-box;
    gap: 0;
    margin-left: auto;
    padding: 0.75mm 0;
}

.project-quotes-panel .quote-editor-view .quote-template-live-totals > div > span {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.project-quotes-panel .quote-editor-view .quote-template-live-totals > div > strong {
    text-align: right;
    font-weight: 600;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.project-quotes-panel .quote-editor-view .quote-template-live-totals > div.is-grand-total {
    padding: 0.75mm 0;
    font-size: 9.5pt;
    line-height: 1.25;
}

.project-quotes-panel .quote-editor-view .quote-document-table-footer {
    margin: 4mm 0 0;
    color: #64748b;
    font-size: 8pt;
    line-height: 1.35;
    white-space: pre-wrap;
}

@media print {
    .project-quotes-panel .quote-editor-view .quote-side-panel:has(.quote-position-archive-dialog) {
        display: none !important;
    }

    .quote-document-edit-feedback,
    [data-quote-document-position-table] .quote-drag-cell,
    [data-quote-document-position-table] .quote-row-actions-cell {
        display: none !important;
    }
}
