/* Shared company branding on screens only. Layered important dimensions keep
   legacy document and public-preview overrides on the same sizing contract. */
@layer datacore-document-branding {
    @media screen {
        img.max-logo-size {
            width: auto !important;
            height: auto !important;
            max-width: min(200px, 100%) !important;
            max-height: 140px !important;
            object-fit: contain !important;
        }
    }
}

/* Staff Invoice and Estimate details share screen geometry. The wrappers are
   absent from PDF templates; print keeps the existing document styling. */
@media screen {
    .document-screen-header table.header-style {
        width: 100%;
        table-layout: fixed;
        border-collapse: collapse;
        margin: 0;
    }
    .document-screen-header .header-style > tbody > tr > td {
        width: 40% !important;
        padding: 0 !important;
        margin: 0 !important;
        vertical-align: top;
        overflow-wrap: anywhere;
    }
    .document-screen-header .header-style > tbody > tr > td:nth-child(2) {
        width: 20% !important;
    }
    .document-screen-header table.header-style + table.header-style {
        margin-top: 20px;
    }
    .document-screen-header--estimate .header-style > tbody > tr:nth-child(2) {
        height: 20px;
    }
    .document-screen-header .header-style img.max-logo-size {
        display: block;
        margin: 0;
    }
    .document-screen-header .invoice-preview-header-row > td:last-child img.max-logo-size {
        margin-inline-start: auto;
    }

    @media (max-width: 575px) {
        .document-screen-header .header-style,
        .document-screen-header .header-style > tbody,
        .document-screen-header .header-style > tbody > tr,
        .document-screen-header .header-style > tbody > tr > td {
            display: block;
            width: 100% !important;
        }
        .document-screen-header .header-style > tbody > tr > td:nth-child(2),
        .document-screen-header--estimate .header-style > tbody > tr:nth-child(2) {
            display: none;
        }
        .document-screen-header .header-style > tbody > tr > td:last-child,
        .document-screen-header--estimate .header-style > tbody > tr:last-child {
            margin-top: 20px !important;
        }
        .document-screen-header .header-style .invoice-info-container {
            text-align: start !important;
        }
        .document-screen-header .header-style img.max-logo-size,
        .document-screen-header .invoice-preview-header-row > td:last-child img.max-logo-size {
            margin-inline: 0 !important;
        }
    }
}
