
.related-widget-wrapper-link img,
.related-widget-wrapper-link svg {
    width: 13px !important;
    height: 13px !important;
    vertical-align: middle;
}
p.file-upload a {
    font-size: 20px !important;
}

.module {
    margin-bottom: 15px !important;
}

#container > header,
#container > nav,
#container > footer {
    flex-shrink: 0;
}

.aligned label {
    width: 110px !important;
    padding: 0px, 0px, 0px, 0px !important;
}


div.fieldBox.field-customer {
    width: 450px !important;
}

/* Widen customer select2 autocomplete */
.field-customer .select2-container,
.field-customer .select2-selection--single {
    /* width: 100% !important; */
    min-width: 500px !important;
}

/* Ensure flex-container customer field stretches when errors are shown */
.flex-container.fieldBox.field-customer {
    width: 500px !important;
}

.flex-container.fieldBox.field-customer .related-widget-wrapper,
.flex-container.fieldBox.field-customer .select2-container,
.flex-container.fieldBox.field-customer .select2-selection--single {
    width: 100% !important;
    min-width: 450px !important;
}

/* Offer form: customer field in delivery row */
.form-row.field-customer.field-delivery_type.field-transportation_cost_gross .fieldBox.field-customer {
    width: 600px !important;
    min-width: 600px !important;
}

.form-row.field-customer.field-delivery_type.field-transportation_cost_gross
    .fieldBox.field-customer
    .related-widget-wrapper {
    width: auto !important;
    min-width: 380px !important;
    display: flex !important;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    overflow: visible !important;
}

.form-row.field-customer.field-delivery_type.field-transportation_cost_gross
    .fieldBox.field-customer
    .select2-container,
.form-row.field-customer.field-delivery_type.field-transportation_cost_gross
    .fieldBox.field-customer
    .select2-selection--single {
    width: 380px !important;
    min-width: 380px !important;
    flex: 0 0 380px;
}

.form-row.field-customer.field-delivery_type.field-transportation_cost_gross
    .fieldBox.field-customer
    .related-widget-wrapper-link {
    flex: 0 0 auto;
}

/* Hide customer view button; keep add/change available in offer/order forms */
.form-row.field-customer.field-delivery_type.field-transportation_cost_gross
    .fieldBox.field-customer
    .related-widget-wrapper-link.view-related {
    display: none !important;
}

.form-row.field-customer.field-delivery_type.field-transportation_cost_gross
    .fieldBox.field-customer
    .select2-selection--single {
    width: 380px !important;
}

/* Order form: reduce paid in advance date offset */
.form-row.field-paid_in_advance_date p.date {
    margin-left: 120px !important;
}

#offer_form > div > fieldset:nth-child(7) > div.form-row.field-follow_up_date.field-attention > div > div:nth-child(1) > div {
    width: 450px !important;
}

input#id_email_subject.vTextField {
    width: 300px !important;
}

input#id_sms_text.vTextField {
    width: 500px !important;
}

input#id_customer_project.vTextField {
    width: 300px !important;
}

div.fieldBox.field-delivery_note {
    width: 470px !important;
}

input#id_delivery_note.vTextField {
    width: 290px !important;
}

.vTextField {
    width: 150px !important;
}

select {
    width: 150px !important;
}

.selector select,
#id_groups_from,
#id_groups_to {
    width: 380px !important;
    min-width: 380px !important;
}

input[type=number] {
    width: 136px !important;
}

fieldset .fieldBox {
    width: 300px !important;
}

#content-main .form-row.field-rebate_windows label,
#content-main .form-row.field-rebate_doors label,
#content-main .form-row.field-rebate_sliding_doors label,
#content-main .form-row.field-rebate_folding_doors label,
#content-main .form-row.field-rebate_fences label,
#content-main .form-row.field-rebate_fence_accessories label,
#content-main .form-row.field-rebate_window_accessories label {
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
    white-space: nowrap;
}

.form-row.form-multiline.field-rebate_windows,
.form-row.form-multiline.field-rebate_doors {
    column-gap: 110px;
}

.form-row.form-multiline.field-rebate_windows > .fieldBox,
.form-row.form-multiline.field-rebate_doors > .fieldBox {
    flex: 0 0 auto !important;
    width: auto !important;
}

.form-row.form-multiline.field-phone_number_1,
.form-row.form-multiline.field-phone_number_2,
.form-row.form-multiline.field-email {
    column-gap: 110px;
}

.form-row.form-multiline.field-name,
.form-row.form-multiline.field-NIP {
    column-gap: 110px;
}

.form-row.form-multiline.field-name > .fieldBox,
.form-row.form-multiline.field-NIP > .fieldBox,
.form-row.form-multiline.field-status > .fieldBox {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
}

.form-row.form-multiline.field-status {
    column-gap: 124px;
}

.form-row.form-multiline.field-phone_number_1 > .fieldBox,
.form-row.form-multiline.field-phone_number_2 > .fieldBox,
.form-row.form-multiline.field-email > .fieldBox {
    flex: 0 0 auto !important;
    width: auto !important;
}

.form-row.form-multiline.field-delivery_address_street,
.form-row.form-multiline.field-invoice_address_street {
    column-gap: 110px;
}

.form-row.form-multiline.field-delivery_address_street > .fieldBox,
.form-row.form-multiline.field-invoice_address_street > .fieldBox {
    flex: 0 0 auto !important;
    width: auto !important;
}

.fieldBox.field-offer_total_value,
.fieldBox.field-order_total_amount {
    width: 360px !important;
}

fieldset.kystvinduet-documents .form-row {
    padding: 10px 3px !important;
}

.form-row.field-offer_pdf_file.field-client_link_visible_on_pdf .flex-container.form-multiline,
.form-row.field-order_pdf_file.field-client_link_visible_on_pdf .flex-container.form-multiline,
.form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf .flex-container.form-multiline,
.form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf .flex-container.form-multiline {
    display: grid;
    grid-template-columns: 360px 253px 300px;
    column-gap: 12px;
    row-gap: 4px;
    align-items: start;
}

.form-row.field-offer_pdf_file.field-client_link_visible_on_pdf .flex-container.form-multiline > div,
.form-row.field-order_pdf_file.field-client_link_visible_on_pdf .flex-container.form-multiline > div,
.form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf .flex-container.form-multiline > div,
.form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf .flex-container.form-multiline > div {
    min-width: 0;
}

.form-row.field-offer_pdf_file.field-client_link_visible_on_pdf .flex-container.form-multiline > div > .fieldBox,
.form-row.field-order_pdf_file.field-client_link_visible_on_pdf .flex-container.form-multiline > div > .fieldBox,
.form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf .flex-container.form-multiline > div > .fieldBox,
.form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf .flex-container.form-multiline > div > .fieldBox {
    width: 100% !important;
    min-width: 0;
}

.form-row.field-offer_pdf_file.field-client_link_visible_on_pdf .flex-container.form-multiline > div:first-child,
.form-row.field-order_pdf_file.field-client_link_visible_on_pdf .flex-container.form-multiline > div:first-child {
    grid-column: 1 / span 2;
}

.form-row.field-offer_pdf_file.field-client_link_visible_on_pdf .flex-container.form-multiline > div:nth-child(2),
.form-row.field-order_pdf_file.field-client_link_visible_on_pdf .flex-container.form-multiline > div:nth-child(2) {
    grid-column: 3;
}

fieldset.kystvinduet-documents .file-upload {
    margin-left: 120px !important;
}

fieldset.kystvinduet-documents p.file-upload a {
    font-size: 14px !important;
    overflow-wrap: anywhere;
    word-break: break-word;
}

#id_client_link_visible_on_pdf_helptext {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

.fieldBox.field-client_link_visible_on_pdf .vCheckboxLabel {
    white-space: nowrap;
}

.form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf .fieldBox.field-rebate_visible_on_pdf .checkbox-row,
.form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf .fieldBox.field-rebate_visible_on_pdf .checkbox-row,
.form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf .fieldBox.field-rebate_visible_on_pdf .vCheckboxLabel,
.form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf .fieldBox.field-rebate_visible_on_pdf .vCheckboxLabel {
    white-space: nowrap;
}

#id_rebate_helptext,
#id_offer_total_value_helptext,
#id_order_total_amount_helptext {
    margin-left: 120px !important;
    padding-left: 0 !important;
}

#id_rebate_visible_on_pdf_helptext {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

.restore-amount-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #2563eb;
    color: #ffffff;
    border: 0;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    margin-left: 6px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    vertical-align: middle;
}

.restore-amount-button:hover {
    background-color: #1d4ed8;
}

.aligned label+div.readonly {
    margin-left: 120px !important;
}

.form-row {
    padding: 3px !important;
}

/* Ensure offer/order customer row keeps related buttons visible (test hook). */
.form-row.field-customer.field-delivery_type.field-transportation_cost_gross
    .fieldBox.field-customer
    .related-widget-wrapper {
    overflow: visible !important;
}

.form-row.field-customer.field-delivery_type.field-transportation_cost_gross
    .fieldBox.field-customer
    .select2-container,
.form-row.field-customer.field-delivery_type.field-transportation_cost_gross
    .fieldBox.field-customer
    .select2-selection--single {
    width: 380px !important;
}

#result_list>thead>tr>th.sortable>div.text>a {
    padding-left: 5px;
    padding-right: 5px;
    padding-top: 5px;
    padding-bottom: 5px;
}

#result_list>thead>tr>th.sortable.ascending>div.text>a {
    padding-left: 5px;
    padding-right: 5px;
    padding-top: 5px;
    padding-bottom: 5px;
}

#result_list>thead>tr>th.sortable.descending>div.text>a {
    padding-left: 5px;
    padding-right: 5px;
    padding-top: 5px;
    padding-bottom: 5px;
}

#result_list>thead>tr>th.sortable.sorted>div.sortoptions {
    padding-top: 5px;
}

/* Fence design list: widen Offer column, constrain Name. */
.model-fencedesign #result_list th.column-linked_offers,
.model-fencedesign #result_list td.field-linked_offers {
    min-width: 320px;
    width: 320px;
}

.model-fencedesign #result_list th.column-name,
.model-fencedesign #result_list td.field-name {
    max-width: 280px;
    width: 280px;
}

.model-fencedesign #result_list td.field-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#content {
    padding-left: 10px !important;
    padding-right: 10px !important;
}

#changelist-filter {
    margin: 0 0 0 10px !important;
}

:root {
    --primary-lighter: #a4bfcc;
}


fieldset.collapsed h2,
fieldset.collapsed {
    background: var(--primary-lighter) !important;
    color: var(--primary-fg) !important;
}

table {
    caption-side: top !important;
}

.admindatefilter p {
    margin-bottom: 0px;
}

.admindatefilter input {
    height: 12px;
    padding-bottom: 0px;
    padding-top: 0px;
}

.admindatefilter .controls input {
    height: 15px;
    padding-bottom: 0px !important;
    padding-top: 0px !important;
}

#changelist-filter h3 {
    margin-top: 2px !important;
    margin-bottom: 2px !important;
}

.submit-row p.deletelink-box {
    float: left !important;
    margin: 0 !important;
}

.submit-row a.deletelink {
    display: inline-block !important;
    width: auto !important;
    padding: 10px 15px !important;
    margin-left: 0 !important;
    margin-right: auto !important;
    float: left;
}

#user-tools {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    margin-right: 20px;
}

#user-tools .user-tools-welcome,
#user-tools .user-tools-links {
    display: block;
    text-align: right;
}

#user-tools .user-tools-links {
    white-space: nowrap;
}

#user-tools .user-tools-logout {
    display: block;
    text-align: right;
}

#user-tools .i18n_flag {
    width: 20px;
    height: 14px;
    object-fit: contain;
    vertical-align: middle;
}

/* Collapsible admin navigation groups */
.nav-app-group table {
    width: 100%;
}

.nav-app-group .nav-hidden-models[hidden] {
    display: none;
}

.nav-app-group caption {
    position: relative;
    padding-right: 30px;
}

.nav-app-group .nav-group-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    border-radius: 3px;
    cursor: pointer;
    padding: 0;
    color: var(--header-link-color, #fff);
    font-size: 12px;
    line-height: 1;
}

.nav-app-group .nav-group-toggle:hover,
.nav-app-group .nav-group-toggle:focus {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.nav-app-group .nav-toggle-triangle {
    display: inline-block;
    transition: transform 0.15s ease;
}

.nav-app-group.nav-expanded .nav-toggle-triangle {
    transform: rotate(180deg);
}

/* Web order expiry indicator */
.weborder-expiry {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    background: #f3f4f6;
}

.weborder-expiry--warning {
    background: #fef3c7;
    color: #92400e;
    font-weight: 600;
}

.weborder-expiry--expired {
    background: #fee2e2;
    color: #991b1b;
    font-weight: 600;
}

/* Make selected changelist filter values easier to spot */
#changelist-filter li.selected a {
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

nav[aria-label="Breadcrumbs"] {
    background: var(--primary, #79aec8);
}

ol.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    list-style: none;
    margin: 0;
    padding: 10px 40px;
    color: var(--primary-fg, #fff);
    font-size: 14px;
}

ol.breadcrumbs li {
    list-style: none;
}

ol.breadcrumbs li + li::before {
    content: "›";
    margin-right: 0.35rem;
}

ol.breadcrumbs a {
    color: inherit;
}

.form-row.field-offer_pdf_file.field-client_link_visible_on_pdf.flex-container.form-multiline,
.form-row.field-order_pdf_file.field-client_link_visible_on_pdf.flex-container.form-multiline,
.form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf.flex-container.form-multiline,
.form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf.flex-container.form-multiline {
    display: grid;
    grid-template-columns: 360px 253px 300px;
    column-gap: 12px;
    row-gap: 4px;
    align-items: start;
}

.form-row.field-offer_pdf_file.field-client_link_visible_on_pdf.flex-container.form-multiline > fieldset,
.form-row.field-order_pdf_file.field-client_link_visible_on_pdf.flex-container.form-multiline > fieldset {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    align-items: start;
    grid-column: 1 / span 2;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.form-row.field-offer_pdf_file.field-client_link_visible_on_pdf.flex-container.form-multiline > fieldset > legend,
.form-row.field-order_pdf_file.field-client_link_visible_on_pdf.flex-container.form-multiline > fieldset > legend {
    width: 120px;
    margin: 0;
    padding: 4px 10px 0 0;
    color: #333;
    font-size: 13px;
    font-weight: 700;
    line-height: 13px;
}

.form-row.field-offer_pdf_file.field-client_link_visible_on_pdf.flex-container.form-multiline > fieldset > .fieldBox,
.form-row.field-order_pdf_file.field-client_link_visible_on_pdf.flex-container.form-multiline > fieldset > .fieldBox {
    width: 100% !important;
    min-width: 0;
}

.form-row.flex-container.form-multiline .fieldBox.field-offer_total_value,
.form-row.flex-container.form-multiline .fieldBox.field-order_total_amount {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
}

.form-row.flex-container.form-multiline .fieldBox.field-offer_total_value > label,
.form-row.flex-container.form-multiline .fieldBox.field-order_total_amount > label {
    order: 1;
    flex: 0 0 120px;
    width: 120px;
}

.form-row.flex-container.form-multiline .fieldBox.field-offer_total_value > input,
.form-row.flex-container.form-multiline .fieldBox.field-order_total_amount > input {
    order: 2;
    flex: 0 0 136px;
}

.form-row.flex-container.form-multiline .fieldBox.field-offer_total_value > .restore-amount-button,
.form-row.flex-container.form-multiline .fieldBox.field-order_total_amount > .restore-amount-button {
    order: 3;
}

.form-row.flex-container.form-multiline .fieldBox.field-offer_total_value > .help,
.form-row.flex-container.form-multiline .fieldBox.field-order_total_amount > .help {
    order: 4;
    flex: 1 1 100%;
    margin-left: 120px !important;
}

#id_rebate {
    width: 90px !important;
}

.fieldBox.field-rebate > label {
    width: 70px !important;
}

.form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf.flex-container.form-multiline,
.form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf.flex-container.form-multiline {
    grid-template-columns: 360px 190px 300px;
}

.form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf.flex-container.form-multiline > .fieldBox,
.form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf.flex-container.form-multiline > .fieldBox {
    width: 100% !important;
    min-width: 0;
}

@media (max-width: 1279px) {
    .form-row.field-offer_pdf_file.field-client_link_visible_on_pdf.flex-container.form-multiline,
    .form-row.field-order_pdf_file.field-client_link_visible_on_pdf.flex-container.form-multiline,
    .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf.flex-container.form-multiline,
    .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf.flex-container.form-multiline {
        display: flex;
        flex-wrap: wrap;
        gap: 4px 12px;
    }

    .form-row.field-offer_pdf_file.field-client_link_visible_on_pdf.flex-container.form-multiline > div,
    .form-row.field-order_pdf_file.field-client_link_visible_on_pdf.flex-container.form-multiline > div,
    .form-row.field-offer_pdf_file.field-client_link_visible_on_pdf.flex-container.form-multiline > fieldset,
    .form-row.field-order_pdf_file.field-client_link_visible_on_pdf.flex-container.form-multiline > fieldset,
    .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf.flex-container.form-multiline > div,
    .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf.flex-container.form-multiline > div {
        flex: 1 1 240px;
        min-width: 0;
    }

    .form-row.field-offer_pdf_file.field-client_link_visible_on_pdf.flex-container.form-multiline > fieldset,
    .form-row.field-order_pdf_file.field-client_link_visible_on_pdf.flex-container.form-multiline > fieldset {
        flex: 1 1 100%;
    }

    .form-row.field-offer_pdf_file.field-client_link_visible_on_pdf.flex-container.form-multiline > div > .fieldBox,
    .form-row.field-order_pdf_file.field-client_link_visible_on_pdf.flex-container.form-multiline > div > .fieldBox,
    .form-row.field-offer_pdf_file.field-client_link_visible_on_pdf.flex-container.form-multiline > fieldset > .fieldBox,
    .form-row.field-order_pdf_file.field-client_link_visible_on_pdf.flex-container.form-multiline > fieldset > .fieldBox,
    .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf.flex-container.form-multiline > div > .fieldBox,
    .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf.flex-container.form-multiline > div > .fieldBox {
        width: 100% !important;
        min-width: 0;
    }
}

.object-tools .changelist-filter-toggle {
    display: block;
    float: left;
    border: 0;
    border-radius: 15px;
    padding: 3px 12px;
    background: var(--object-tools-bg);
    color: var(--object-tools-fg);
    font: inherit;
    font-size: 0.6875rem;
    font-weight: 400;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
}

.object-tools .changelist-filter-toggle:hover,
.object-tools .changelist-filter-toggle:focus {
    background-color: var(--object-tools-hover-bg);
}

#changelist-filter.filters-collapsed {
    flex: 0 0 40px;
    width: 40px;
    margin-left: 10px;
    overflow: hidden;
}

#changelist-filter.filters-collapsed > *:not(#changelist-filter-header) {
    display: none;
}

#changelist-filter.filters-collapsed #changelist-filter-header {
    box-sizing: border-box;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    width: 100%;
    margin-bottom: 0;
    padding: 12px 4px;
    white-space: nowrap;
    cursor: pointer;
}

#changelist .changelist-form-container.filters-collapsed > div {
    max-width: calc(100% - 60px) !important;
}

@media (max-width: 767px) {
    #changelist-filter.filters-collapsed {
        flex-basis: auto;
        width: 100%;
    }

    #changelist-filter.filters-collapsed #changelist-filter-header {
        writing-mode: horizontal-tb;
    }

    #changelist .changelist-form-container.filters-collapsed > div {
        max-width: 100% !important;
    }
}

/* Order/offer links: keep each label on the same line as its value and align columns. */
#order_form .form-row.field-invoice_link.field-warehouse_link.field-service_link.field-installation_link.field-web_order_link,
#order_form .form-row.field-offer_link.field-window_design_link,
#offer_form .form-row.field-window_design_link.field-cart_link {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    column-gap: 16px !important;
    row-gap: 6px !important;
    align-items: start !important;
}

#order_form .form-row.field-invoice_link.field-warehouse_link.field-service_link.field-installation_link.field-web_order_link > .fieldBox,
#order_form .form-row.field-offer_link.field-window_design_link > .fieldBox,
#offer_form .form-row.field-window_design_link.field-cart_link > .fieldBox {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: baseline !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    float: none !important;
}

#order_form .form-row.field-invoice_link.field-warehouse_link.field-service_link.field-installation_link.field-web_order_link > .fieldBox > label,
#order_form .form-row.field-offer_link.field-window_design_link > .fieldBox > label,
#offer_form .form-row.field-window_design_link.field-cart_link > .fieldBox > label {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    margin-right: 8px !important;
    white-space: nowrap !important;
}

#order_form .form-row.field-invoice_link.field-warehouse_link.field-service_link.field-installation_link.field-web_order_link > .fieldBox > .readonly,
#order_form .form-row.field-offer_link.field-window_design_link > .fieldBox > .readonly,
#offer_form .form-row.field-window_design_link.field-cart_link > .fieldBox > .readonly {
    margin-left: 0 !important;
    padding: 0 !important;
    min-width: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

#offer_form .form-row.field-order_link {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: baseline !important;
    gap: 8px !important;
}

#offer_form .form-row.field-order_link > label {
    flex: 0 0 auto !important;
    width: auto !important;
    margin: 0 !important;
    white-space: nowrap !important;
}

#offer_form .form-row.field-order_link > .readonly {
    margin-left: 0 !important;
    padding: 0 !important;
}

/* Order/offer finance: use the same column widths in every row. */
#order_form .form-row.field-order_value_net.field-order_value_gross.field-order_vat,
#order_form .form-row.field-order_cost_net.field-order_cost_gross.field-order_cost_vat,
#order_form .form-row.field-order_margin_percent.field-order_margin.field-currency,
#order_form .form-row.field-delivery_type.field-transportation_cost_gross,
#order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf,
#offer_form .form-row.field-offer_value_net.field-offer_value_gross.field-offer_vat,
#offer_form .form-row.field-offer_value_after_rebate_net.field-offer_value_after_rebate_gross,
#offer_form .form-row.field-offer_cost_net.field-offer_cost_gross.field-offer_cost_vat,
#offer_form .form-row.field-offer_margin.field-currency,
#offer_form .form-row.field-delivery_type.field-transportation_cost_gross,
#offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf {
    display: grid !important;
    grid-template-columns: 360px 300px 300px !important;
    column-gap: 20px !important;
    row-gap: 6px !important;
    align-items: start !important;
}

#order_form .form-row.field-order_value_net.field-order_value_gross.field-order_vat > .fieldBox,
#order_form .form-row.field-order_cost_net.field-order_cost_gross.field-order_cost_vat > .fieldBox,
#order_form .form-row.field-order_margin_percent.field-order_margin.field-currency > .fieldBox,
#order_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox,
#order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf > .fieldBox,
#offer_form .form-row.field-offer_value_net.field-offer_value_gross.field-offer_vat > .fieldBox,
#offer_form .form-row.field-offer_value_after_rebate_net.field-offer_value_after_rebate_gross > .fieldBox,
#offer_form .form-row.field-offer_cost_net.field-offer_cost_gross.field-offer_cost_vat > .fieldBox,
#offer_form .form-row.field-offer_margin.field-currency > .fieldBox,
#offer_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox,
#offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    float: none !important;
}

#order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-order_total_amount,
#order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate,
#offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-offer_total_value,
#offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
}

#order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf .fieldBox.field-order_total_amount > .help,
#offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf .fieldBox.field-offer_total_value > .help {
    flex: 1 1 100% !important;
    margin-left: 120px !important;
}

@media (max-width: 1279px) {
    #order_form .form-row.field-invoice_link.field-warehouse_link.field-service_link.field-installation_link.field-web_order_link,
    #order_form .form-row.field-offer_link.field-window_design_link,
    #offer_form .form-row.field-window_design_link.field-cart_link {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px 16px !important;
    }

    #order_form .form-row.field-invoice_link.field-warehouse_link.field-service_link.field-installation_link.field-web_order_link > .fieldBox,
    #order_form .form-row.field-offer_link.field-window_design_link > .fieldBox,
    #offer_form .form-row.field-window_design_link.field-cart_link > .fieldBox {
        flex: 1 1 240px !important;
        width: auto !important;
        max-width: none !important;
    }

    #order_form .form-row.field-order_value_net.field-order_value_gross.field-order_vat,
    #order_form .form-row.field-order_cost_net.field-order_cost_gross.field-order_cost_vat,
    #order_form .form-row.field-order_margin_percent.field-order_margin.field-currency,
    #order_form .form-row.field-delivery_type.field-transportation_cost_gross,
    #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf,
    #offer_form .form-row.field-offer_value_net.field-offer_value_gross.field-offer_vat,
    #offer_form .form-row.field-offer_value_after_rebate_net.field-offer_value_after_rebate_gross,
    #offer_form .form-row.field-offer_cost_net.field-offer_cost_gross.field-offer_cost_vat,
    #offer_form .form-row.field-offer_margin.field-currency,
    #offer_form .form-row.field-delivery_type.field-transportation_cost_gross,
    #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px 20px !important;
    }

    #order_form .form-row.field-order_value_net.field-order_value_gross.field-order_vat > .fieldBox,
    #order_form .form-row.field-order_cost_net.field-order_cost_gross.field-order_cost_vat > .fieldBox,
    #order_form .form-row.field-order_margin_percent.field-order_margin.field-currency > .fieldBox,
    #order_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox,
    #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf > .fieldBox,
    #offer_form .form-row.field-offer_value_net.field-offer_value_gross.field-offer_vat > .fieldBox,
    #offer_form .form-row.field-offer_value_after_rebate_net.field-offer_value_after_rebate_gross > .fieldBox,
    #offer_form .form-row.field-offer_cost_net.field-offer_cost_gross.field-offer_cost_vat > .fieldBox,
    #offer_form .form-row.field-offer_margin.field-currency > .fieldBox,
    #offer_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox,
    #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox {
        flex: 0 1 300px !important;
        width: 300px !important;
        max-width: 300px !important;
    }

    #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-order_total_amount,
    #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-offer_total_value {
        flex-basis: 360px !important;
        width: 360px !important;
        max-width: 360px !important;
    }
}

/* Django 6.1 compatibility: restore the old inline label/field layout. */
.submit-row {
    justify-content: flex-end !important;
}

.submit-row p.deletelink-box,
.submit-row a.deletelink {
    order: -1;
    margin-left: 0 !important;
    margin-right: auto !important;
    float: none !important;
}

.form-row.form-multiline > .fieldBox {
    flex: 1 1 0 !important;
    min-width: 260px;
}

.form-row .fieldBox {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 8px !important;
}

.form-row .fieldBox > label {
    flex: 0 0 auto !important;
    width: 110px !important;
    min-width: 110px !important;
    max-width: 110px !important;
    margin: 0 !important;
    padding-top: 6px;
    text-align: left;
    box-sizing: border-box;
}

.form-row .fieldBox > input,
.form-row .fieldBox > select,
.form-row .fieldBox > textarea,
.form-row .fieldBox > .related-widget-wrapper {
    min-width: 200px;
    max-width: 100%;
}

.aligned .form-row .fieldBox > .readonly,
.form-row .fieldBox > label + .readonly {
    margin-left: 0 !important;
    padding-top: 6px;
    min-width: 0;
}

.form-row .fieldBox > .help {
    width: 100%;
    margin-left: 118px !important;
}

.form-row .fieldBox.checkbox-row {
    align-items: center;
}

.form-row .fieldBox.checkbox-row > .checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Single-field rows in Django 6.1 use .flex-container without .fieldBox. */
.form-row > .flex-container:not(.form-multiline) {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 8px !important;
}

.form-row > .flex-container:not(.form-multiline) > label {
    flex: 0 0 auto !important;
    width: 110px !important;
    min-width: 110px !important;
    max-width: 110px !important;
    margin: 0 !important;
    padding-top: 6px;
    text-align: left;
    box-sizing: border-box;
}

.form-row > .flex-container:not(.form-multiline) > input,
.form-row > .flex-container:not(.form-multiline) > select,
.form-row > .flex-container:not(.form-multiline) > textarea,
.form-row > .flex-container:not(.form-multiline) > .related-widget-wrapper {
    min-width: 200px;
    max-width: 100%;
}

.aligned .form-row > .flex-container:not(.form-multiline) > .readonly,
.form-row > .flex-container:not(.form-multiline) > label + .readonly {
    margin-left: 0 !important;
    padding-top: 6px;
    min-width: 0;
}

.form-row > .flex-container:not(.form-multiline) > .help {
    width: 100%;
    margin-left: 118px !important;
}

/* Offer form: compact rows, left aligned, narrower inputs. */
#content #offer_form .form-row.field-status.field-offer_id_suffix.field-advection,
#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display,
#content #offer_form .form-row.field-assigned_to.field-probability.field-created_by_display {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 20px !important;
    align-items: flex-start !important;
}

#content #offer_form .form-row.field-status.field-offer_id_suffix.field-advection > .fieldBox,
#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox,
#content #offer_form .form-row.field-assigned_to.field-probability.field-created_by_display > .fieldBox {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
}

#content #offer_form .form-row.field-customer_city.field-customer_phone.field-customer_email {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 24px !important;
    align-items: flex-start !important;
}

#content #offer_form .form-row.field-customer_city.field-customer_phone.field-customer_email > .fieldBox {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
}

#content #offer_form .form-row.field-offer_value_net.field-offer_value_gross.field-offer_vat,
#content #offer_form .form-row.field-offer_value_after_rebate_net.field-offer_value_after_rebate_gross,
#content #offer_form .form-row.field-offer_cost_net.field-offer_cost_gross.field-offer_cost_vat,
#content #offer_form .form-row.field-offer_margin.field-currency,
#content #offer_form .form-row.field-delivery_type.field-transportation_cost_gross,
#content #offer_form .form-row.field-installation_cost_gross,
#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 24px !important;
    align-items: flex-start !important;
}

#content #offer_form .form-row.field-offer_value_net.field-offer_value_gross.field-offer_vat > .fieldBox,
#content #offer_form .form-row.field-offer_value_after_rebate_net.field-offer_value_after_rebate_gross > .fieldBox,
#content #offer_form .form-row.field-offer_cost_net.field-offer_cost_gross.field-offer_cost_vat > .fieldBox,
#content #offer_form .form-row.field-offer_margin.field-currency > .fieldBox,
#content #offer_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox,
#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox {
    display: flex !important;
    flex: 0 0 auto !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
}

#content #offer_form .form-row.field-offer_value_net.field-offer_value_gross.field-offer_vat > .fieldBox > label,
#content #offer_form .form-row.field-offer_value_after_rebate_net.field-offer_value_after_rebate_gross > .fieldBox > label,
#content #offer_form .form-row.field-offer_cost_net.field-offer_cost_gross.field-offer_cost_vat > .fieldBox > label,
#content #offer_form .form-row.field-offer_margin.field-currency > .fieldBox > label,
#content #offer_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox > label,
#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox > label {
    flex: 0 0 auto !important;
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
    padding-top: 0 !important;
    margin: 0 !important;
}

#content #offer_form .form-row.field-offer_value_net.field-offer_value_gross.field-offer_vat > .fieldBox > label,
#content #offer_form .form-row.field-offer_value_after_rebate_net.field-offer_value_after_rebate_gross > .fieldBox > label,
#content #offer_form .form-row.field-offer_cost_net.field-offer_cost_gross.field-offer_cost_vat > .fieldBox > label,
#content #offer_form .form-row.field-offer_margin.field-currency > .fieldBox > label,
#content #offer_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox > label,
#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox > label {
    order: 1;
}

#content #offer_form .form-row.field-offer_value_net.field-offer_value_gross.field-offer_vat > .fieldBox > input,
#content #offer_form .form-row.field-offer_value_net.field-offer_value_gross.field-offer_vat > .fieldBox > select,
#content #offer_form .form-row.field-offer_value_after_rebate_net.field-offer_value_after_rebate_gross > .fieldBox > input,
#content #offer_form .form-row.field-offer_cost_net.field-offer_cost_gross.field-offer_cost_vat > .fieldBox > input,
#content #offer_form .form-row.field-offer_cost_net.field-offer_cost_gross.field-offer_cost_vat > .fieldBox > select,
#content #offer_form .form-row.field-offer_margin.field-currency > .fieldBox > input,
#content #offer_form .form-row.field-offer_margin.field-currency > .fieldBox > select,
#content #offer_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox > select,
#content #offer_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox > input,
#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox > input {
    order: 2;
}

#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox > .restore-amount-button {
    order: 3;
}

#content #offer_form .form-row.field-offer_value_net.field-offer_value_gross.field-offer_vat > .fieldBox > .help,
#content #offer_form .form-row.field-offer_value_after_rebate_net.field-offer_value_after_rebate_gross > .fieldBox > .help,
#content #offer_form .form-row.field-offer_cost_net.field-offer_cost_gross.field-offer_cost_vat > .fieldBox > .help,
#content #offer_form .form-row.field-offer_margin.field-currency > .fieldBox > .help,
#content #offer_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox > .help,
#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox > .help {
    order: 4;
    flex: 0 0 100% !important;
    width: 100% !important;
    margin-left: 168px !important;
}

#content #offer_form .form-row.field-installation_cost_gross > .flex-container {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
}

#content #offer_form .form-row.field-installation_cost_gross > .flex-container > label {
    flex: 0 0 auto !important;
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
    padding-top: 0 !important;
    margin: 0 !important;
}

#content #offer_form .fieldBox.field-offer_value_net > input,
#content #offer_form .fieldBox.field-offer_value_gross > input,
#content #offer_form .fieldBox.field-offer_value_after_rebate_net > input,
#content #offer_form .fieldBox.field-offer_value_after_rebate_gross > input,
#content #offer_form .fieldBox.field-offer_cost_net > input,
#content #offer_form .fieldBox.field-offer_cost_gross > input,
#content #offer_form .fieldBox.field-offer_margin > input,
#content #offer_form .fieldBox.field-currency > select,
#content #offer_form .fieldBox.field-delivery_type > select,
#content #offer_form .fieldBox.field-transportation_cost_gross > input,
#content #offer_form .fieldBox.field-offer_total_value > input,
#content #offer_form #id_installation_cost_gross {
    flex: 0 0 120px !important;
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    box-sizing: border-box;
}

#content #offer_form .fieldBox.field-offer_vat > select,
#content #offer_form .fieldBox.field-offer_cost_vat > select {
    flex: 0 0 60px !important;
    width: 60px !important;
    min-width: 60px !important;
    max-width: 60px !important;
    box-sizing: border-box;
}

#content #offer_form .fieldBox.field-rebate > input {
    flex: 0 0 100px !important;
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
    box-sizing: border-box;
}

#content #offer_form .form-row.field-offer_value_net.field-offer_value_gross.field-offer_vat .fieldBox > .help,
#content #offer_form .form-row.field-offer_value_after_rebate_net.field-offer_value_after_rebate_gross .fieldBox > .help,
#content #offer_form .form-row.field-offer_cost_net.field-offer_cost_gross.field-offer_cost_vat .fieldBox > .help,
#content #offer_form .form-row.field-offer_margin.field-currency .fieldBox > .help,
#content #offer_form .form-row.field-delivery_type.field-transportation_cost_gross .fieldBox > .help,
#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf .fieldBox > .help {
    margin-left: 168px !important;
}

#content #offer_form .form-row.field-details_items_count.field-details_window_count,
#content #offer_form .form-row.field-details_door_count.field-details_glass_count {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 32px !important;
    align-items: flex-start !important;
}

#content #offer_form .form-row.field-details_items_count.field-details_window_count > .fieldBox,
#content #offer_form .form-row.field-details_door_count.field-details_glass_count > .fieldBox {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    align-items: center !important;
}

#content #offer_form .form-row.field-details_items_count.field-details_window_count > .fieldBox > label,
#content #offer_form .form-row.field-details_door_count.field-details_glass_count > .fieldBox > label {
    flex: 0 0 auto !important;
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    padding-top: 0 !important;
    margin: 0 !important;
}

#content #offer_form .form-row.field-details_items_count.field-details_window_count > .fieldBox > input,
#content #offer_form .form-row.field-details_door_count.field-details_glass_count > .fieldBox > input {
    flex: 0 0 70px !important;
    width: 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
    box-sizing: border-box;
}

#content #offer_form .form-row.field-replace_pdf_action > .flex-container {
    display: flex !important;
    align-items: center !important;
    gap: 0 !important;
}

#content #offer_form .form-row.field-replace_pdf_action > .flex-container > label {
    flex: 0 0 auto !important;
    width: 240px !important;
    min-width: 240px !important;
    max-width: 240px !important;
    padding-top: 0 !important;
    margin: 0 !important;
}

#content #offer_form .form-row.field-offer_request_file > fieldset {
    display: grid !important;
    grid-template-columns: 244px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 0 !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

#content #offer_form .form-row.field-offer_request_file > fieldset > legend {
    width: 244px !important;
    min-width: 244px !important;
    max-width: 244px !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #333 !important;
    font-size: 13px !important;
    font-weight: 700 !important;
}

#content #offer_form .form-row.field-offer_request_file > fieldset > .flex-container {
    display: flex !important;
    align-items: center !important;
    min-width: 0 !important;
}

.offer-file-input {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.offer-file-button {
    padding: 6px 12px;
    color: #ffffff;
    background: #4f46e5;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8125rem;
}

.offer-file-name {
    color: #333;
    font-size: 0.8125rem;
}

/* Offer form refinements (round 2). */
#content #offer_form .form-row.field-status.field-offer_id_suffix.field-advection,
#content #offer_form .form-row.field-assigned_to.field-probability.field-created_by_display,
#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display {
    gap: 16px !important;
}

#content #offer_form .form-row.field-status.field-offer_id_suffix.field-advection > .fieldBox,
#content #offer_form .form-row.field-assigned_to.field-probability.field-created_by_display > .fieldBox,
#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox {
    gap: 6px !important;
}

#content #offer_form .form-row.field-status.field-offer_id_suffix.field-advection > .fieldBox > label,
#content #offer_form .form-row.field-assigned_to.field-probability.field-created_by_display > .fieldBox > label,
#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > label {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
}

#content #offer_form #id_status {
    flex: 0 0 160px !important;
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
}

#content #offer_form #id_offer_id_suffix,
#content #offer_form #id_probability {
    flex: 0 0 100px !important;
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
}

#content #offer_form #id_advection {
    flex: 0 0 140px !important;
    width: 140px !important;
    min-width: 140px !important;
    max-width: 140px !important;
}

#content #offer_form .form-row.field-customer_city.field-customer_phone.field-customer_email {
    gap: 16px !important;
}

#content #offer_form .form-row.field-customer_city.field-customer_phone.field-customer_email > .fieldBox {
    gap: 6px !important;
}

#content #offer_form .form-row.field-customer_city.field-customer_phone.field-customer_email > .fieldBox > label {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
}

#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf {
    margin-bottom: 26px !important;
}

#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-offer_total_value,
#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate {
    position: relative !important;
    flex-wrap: nowrap !important;
    width: auto !important;
    max-width: none !important;
}

#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-offer_total_value > .help,
#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate > .help {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    width: 300px !important;
    margin: 2px 0 0 0 !important;
}

#content #offer_form .fieldBox.field-rebate_visible_on_pdf {
    flex: 0 0 auto !important;
    align-items: center !important;
    gap: 12px !important;
}

#content #offer_form .fieldBox.field-rebate_visible_on_pdf > .help {
    width: auto !important;
    margin-left: 0 !important;
}

#content #offer_form .form-row.field-offer_request_file > fieldset {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

#content #offer_form .form-row.field-offer_request_file > fieldset > legend {
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 0 4px !important;
    padding: 0 !important;
}

#content #offer_form .form-row.field-offer_request_file > fieldset > .flex-container {
    display: block !important;
    margin-left: 240px !important;
    padding: 0 !important;
}

/* Offer status alignment (round 3). */
#content #offer_form .form-row.field-status.field-offer_id_suffix.field-advection,
#content #offer_form .form-row.field-assigned_to.field-probability.field-created_by_display {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 16px !important;
    align-items: flex-start !important;
}

#content #offer_form .form-row.field-status.field-offer_id_suffix.field-advection > .fieldBox:nth-child(1),
#content #offer_form .form-row.field-assigned_to.field-probability.field-created_by_display > .fieldBox:nth-child(1) {
    flex: 0 0 290px !important;
    width: 290px !important;
}

#content #offer_form .form-row.field-status.field-offer_id_suffix.field-advection > .fieldBox:nth-child(2),
#content #offer_form .form-row.field-assigned_to.field-probability.field-created_by_display > .fieldBox:nth-child(2) {
    flex: 0 0 310px !important;
    width: 310px !important;
}

#content #offer_form .form-row.field-status.field-offer_id_suffix.field-advection > .fieldBox:nth-child(3),
#content #offer_form .form-row.field-assigned_to.field-probability.field-created_by_display > .fieldBox:nth-child(3) {
    flex: 0 0 310px !important;
    width: 310px !important;
}

#content #offer_form .form-row.field-status.field-offer_id_suffix.field-advection > .fieldBox:nth-child(1) > label,
#content #offer_form .form-row.field-assigned_to.field-probability.field-created_by_display > .fieldBox:nth-child(1) > label {
    flex: 0 0 auto !important;
    width: 110px !important;
    min-width: 110px !important;
    max-width: 110px !important;
}

#content #offer_form .form-row.field-status.field-offer_id_suffix.field-advection > .fieldBox:nth-child(2) > label,
#content #offer_form .form-row.field-assigned_to.field-probability.field-created_by_display > .fieldBox:nth-child(2) > label {
    flex: 0 0 auto !important;
    width: 130px !important;
    min-width: 130px !important;
    max-width: 130px !important;
}

#content #offer_form .form-row.field-status.field-offer_id_suffix.field-advection > .fieldBox:nth-child(3) > label,
#content #offer_form .form-row.field-assigned_to.field-probability.field-created_by_display > .fieldBox:nth-child(3) > label {
    flex: 0 0 auto !important;
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
}

#content #offer_form #id_status {
    flex: 0 0 112px !important;
    width: 112px !important;
    min-width: 112px !important;
    max-width: 112px !important;
}

#content #offer_form #id_offer_id_suffix,
#content #offer_form #id_probability {
    flex: 0 0 100px !important;
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
}

#content #offer_form #id_advection {
    flex: 0 0 140px !important;
    width: 140px !important;
    min-width: 140px !important;
    max-width: 140px !important;
}

#content #offer_form .fieldBox.field-advection > .help {
    order: 4 !important;
    flex: 0 0 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
}

#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 40px !important;
    align-items: flex-start !important;
}

#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
}

/* Offer status alignment (round 4). */
#content #offer_form .form-row.field-status.field-offer_id_suffix.field-advection > .fieldBox,
#content #offer_form .form-row.field-assigned_to.field-probability.field-created_by_display > .fieldBox,
#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox {
    flex-wrap: nowrap !important;
    align-items: center !important;
}

#content #offer_form .form-row.field-status.field-offer_id_suffix.field-advection > .fieldBox:nth-child(2) > label,
#content #offer_form .form-row.field-assigned_to.field-probability.field-created_by_display > .fieldBox:nth-child(2) > label {
    width: 105px !important;
    min-width: 105px !important;
    max-width: 105px !important;
}

#content #offer_form .form-row.field-assigned_to.field-probability.field-created_by_display .related-widget-wrapper {
    display: flex !important;
    align-items: center !important;
    flex: 0 0 auto !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
}

#content #offer_form #id_assigned_to {
    flex: 0 0 160px !important;
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
}

/* Offer transport row: force label before field with the same width as currency. */
#content #offer_form .fieldBox.field-transportation_cost_gross {
    display: grid !important;
    grid-template-columns: 160px auto !important;
    column-gap: 8px !important;
    align-items: center !important;
    width: auto !important;
    max-width: none !important;
}

#content #offer_form .fieldBox.field-transportation_cost_gross > label {
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding-top: 0 !important;
    margin: 0 !important;
}

#content #offer_form .fieldBox.field-transportation_cost_gross > .transportation-cost-inline {
    grid-column: 2 !important;
    grid-row: 1 !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    min-width: 0 !important;
    width: auto !important;
}

#content #offer_form .fieldBox.field-transportation_cost_gross .transportation-cost-inline > input {
    flex: 0 0 120px !important;
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
}

/* Offer transport row: beat the flex rule with an explicit grid. */
#content #offer_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox.field-transportation_cost_gross {
    display: grid !important;
    grid-template-columns: 160px auto !important;
    column-gap: 8px !important;
    align-items: center !important;
    width: auto !important;
    max-width: none !important;
}

#content #offer_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox.field-transportation_cost_gross > label {
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding-top: 0 !important;
    margin: 0 !important;
}

#content #offer_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox.field-transportation_cost_gross > .transportation-cost-inline {
    grid-column: 2 !important;
    grid-row: 1 !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    min-width: 0 !important;
    width: auto !important;
}

#content #offer_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox.field-transportation_cost_gross .transportation-cost-inline > input {
    flex: 0 0 120px !important;
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
}

/* Advection lock message should wrap under the Avdeling label. */
#content #offer_form .fieldBox.field-advection {
    flex-wrap: wrap !important;
}

#content #offer_form .fieldBox.field-advection > .help {
    order: 4 !important;
    flex: 0 0 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
}

#content #offer_form .form-row.field-status.field-offer_id_suffix.field-advection > .fieldBox.field-advection {
    flex-wrap: wrap !important;
}

/* Offer status: equal widths and third row aligned to the columns above. */
#content #offer_form #id_status {
    flex: 0 0 160px !important;
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
}

#content #offer_form #id_offer_id_suffix,
#content #offer_form #id_probability {
    flex: 0 0 100px !important;
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
}

#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 16px !important;
    align-items: flex-start !important;
}

#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox:nth-child(1) {
    flex: 0 0 290px !important;
    width: 290px !important;
}

#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox:nth-child(2) {
    flex: 0 0 310px !important;
    width: 310px !important;
}

#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox:nth-child(3) {
    flex: 0 0 310px !important;
    width: 310px !important;
}

#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox:nth-child(1) > label {
    width: 110px !important;
    min-width: 110px !important;
    max-width: 110px !important;
}

#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox:nth-child(2) > label {
    width: 105px !important;
    min-width: 105px !important;
    max-width: 105px !important;
}

#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox:nth-child(3) > label {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
}

#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > .readonly {
    margin-left: 0 !important;
    padding-top: 0 !important;
}

#content #offer_form #id_offer_id_suffix,
#content #offer_form #id_probability {
    box-sizing: border-box !important;
}

/* Move the Tilbudsnummer/Sannsynlighet/Oppdatert column to the right. */
#content #offer_form .form-row.field-status.field-offer_id_suffix.field-advection > .fieldBox:nth-child(1),
#content #offer_form .form-row.field-assigned_to.field-probability.field-created_by_display > .fieldBox:nth-child(1),
#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox:nth-child(1) {
    flex: 0 0 360px !important;
    width: 360px !important;
}

/* Customer row: align Telefon with Oppdatert, Kunde E-post with Sist endret. */
#content #offer_form .form-row.field-customer_city.field-customer_phone.field-customer_email {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 16px !important;
    align-items: flex-start !important;
}

#content #offer_form .form-row.field-customer_city.field-customer_phone.field-customer_email > .fieldBox:nth-child(1) {
    flex: 0 0 360px !important;
    width: 360px !important;
}

#content #offer_form .form-row.field-customer_city.field-customer_phone.field-customer_email > .fieldBox:nth-child(2) {
    flex: 0 0 310px !important;
    width: 310px !important;
}

#content #offer_form .form-row.field-customer_city.field-customer_phone.field-customer_email > .fieldBox:nth-child(3) {
    flex: 0 0 310px !important;
    width: 310px !important;
}

#content #offer_form .form-row.field-customer_city.field-customer_phone.field-customer_email > .fieldBox:nth-child(1) > label {
    width: 110px !important;
    min-width: 110px !important;
    max-width: 110px !important;
}

#content #offer_form .form-row.field-customer_city.field-customer_phone.field-customer_email > .fieldBox:nth-child(2) > label {
    width: 105px !important;
    min-width: 105px !important;
    max-width: 105px !important;
}

#content #offer_form .form-row.field-customer_city.field-customer_phone.field-customer_email > .fieldBox:nth-child(3) > label {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
}

/* Finance: transport width and rebate alignment. */
#content #offer_form .fieldBox.field-transportation_cost_gross .transportation-cost-inline > input {
    box-sizing: border-box !important;
}

#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate {
    margin-left: -42px !important;
}

#content #offer_form .fieldBox.field-rebate_visible_on_pdf {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
    flex: 0 0 auto !important;
}

#content #offer_form .fieldBox.field-rebate_visible_on_pdf > .checkbox {
    flex: 0 0 auto !important;
}

#content #offer_form .fieldBox.field-rebate_visible_on_pdf > .help {
    flex: 0 0 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
}

/* Finance round 2: rebate label visible and checkbox help aligned under flag. */
#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate {
    margin-left: 0 !important;
}

#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate > label {
    flex: 0 0 auto !important;
    width: 114px !important;
    min-width: 114px !important;
    max-width: 114px !important;
    padding-top: 0 !important;
    margin: 0 !important;
}

#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate_visible_on_pdf > .help {
    display: block !important;
    flex: 0 0 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    text-align: left !important;
}

#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf {
    margin-bottom: 50px !important;
}

#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate > .help {
    z-index: 2 !important;
}

#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf {
    overflow: visible !important;
}

/* Finance: rebate field same width as transport. */
#content #offer_form #id_rebate {
    flex: 0 0 120px !important;
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    box-sizing: border-box !important;
}

/* Status row 3: labels and readonly values on the same line height. */
#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > label,
#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > .readonly {
    padding: 0 !important;
    line-height: 1.4 !important;
}

#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox {
    align-items: center !important;
}

/* Align the whole Transportkostnad group with Rabatt, keeping the input column. */
#content #offer_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox.field-transportation_cost_gross {
    margin-left: 48px !important;
    grid-template-columns: 112px auto !important;
}

#content #offer_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox.field-transportation_cost_gross > label {
    width: 112px !important;
    min-width: 112px !important;
    max-width: 112px !important;
}

/* Finance MVA columns: align with Kunde E-post column. */
#content #offer_form .fieldBox.field-offer_vat,
#content #offer_form .fieldBox.field-offer_cost_vat {
    margin-left: 84px !important;
}

#content #offer_form .fieldBox.field-offer_vat > label,
#content #offer_form .fieldBox.field-offer_cost_vat > label {
    flex: 0 0 auto !important;
    width: 82px !important;
    min-width: 82px !important;
    max-width: 82px !important;
    padding-top: 0 !important;
    margin: 0 !important;
}

#content #content #offer_form .fieldBox.field-offer_vat > label,
#content #content #offer_form .fieldBox.field-offer_cost_vat > label {
    flex: 0 0 auto !important;
    width: 82px !important;
    min-width: 82px !important;
    max-width: 82px !important;
    padding-top: 0 !important;
    margin: 0 !important;
}

#content #offer_form .form-row.field-offer_value_net.field-offer_value_gross.field-offer_vat > .fieldBox.field-offer_vat > label,
#content #offer_form .form-row.field-offer_cost_net.field-offer_cost_gross.field-offer_cost_vat > .fieldBox.field-offer_cost_vat > label {
    flex: 0 0 auto !important;
    width: 82px !important;
    min-width: 82px !important;
    max-width: 82px !important;
    padding-top: 0 !important;
    margin: 0 !important;
}

/* Orders and invoices: compact, left-aligned rows with inline labels. */
#content #order_form .form-row,
#content #invoice_form .form-row {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 16px !important;
    align-items: flex-start !important;
}

#content #order_form .form-row > .fieldBox,
#content #invoice_form .form-row > .fieldBox,
#content #order_form .form-row > .flex-container:not(.form-multiline),
#content #invoice_form .form-row > .flex-container:not(.form-multiline) {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
}

#content #order_form .fieldBox > label,
#content #invoice_form .fieldBox > label {
    flex: 0 0 auto !important;
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
    padding-top: 0 !important;
    margin: 0 !important;
}

#content #order_form .fieldBox > input:not([type="checkbox"]):not([type="radio"]),
#content #order_form .fieldBox > select,
#content #invoice_form .fieldBox > input:not([type="checkbox"]):not([type="radio"]),
#content #invoice_form .fieldBox > select {
    flex: 0 0 150px !important;
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
    box-sizing: border-box !important;
}

#content #order_form .fieldBox > textarea,
#content #invoice_form .fieldBox > textarea {
    flex: 0 0 360px !important;
    width: 360px !important;
    min-width: 360px !important;
    max-width: 360px !important;
    box-sizing: border-box !important;
}

#content #order_form .fieldBox > .readonly,
#content #invoice_form .fieldBox > .readonly {
    flex: 0 0 auto !important;
    margin-left: 0 !important;
    padding-top: 0 !important;
}

#content #order_form .fieldBox > .help,
#content #invoice_form .fieldBox > .help {
    flex: 0 0 100% !important;
    width: 100% !important;
    margin-left: 158px !important;
}

/* Orders/invoices finance: narrower amount fields, small MVA and details. */
#content #order_form .fieldBox.field-order_value_net > input,
#content #order_form .fieldBox.field-order_value_gross > input,
#content #order_form .fieldBox.field-order_cost_net > input,
#content #order_form .fieldBox.field-order_cost_gross > input,
#content #order_form .fieldBox.field-order_margin_percent > input,
#content #order_form .fieldBox.field-order_margin > input,
#content #order_form .fieldBox.field-order_total_amount > input,
#content #order_form .fieldBox.field-currency > select,
#content #order_form .fieldBox.field-transportation_cost_gross > input,
#content #order_form #id_installation_cost_gross,
#content #invoice_form .fieldBox.field-order_value_net > input,
#content #invoice_form .fieldBox.field-order_value_gross > input,
#content #invoice_form .fieldBox.field-order_cost_net > input,
#content #invoice_form .fieldBox.field-order_cost_gross > input,
#content #invoice_form .fieldBox.field-order_transportation_cost_gross > input,
#content #invoice_form .fieldBox.field-order_installation_cost_gross > input,
#content #invoice_form .fieldBox.field-order_total_cost_net > input,
#content #invoice_form .fieldBox.field-order_total_cost > input,
#content #invoice_form .fieldBox.field-currency > select {
    flex: 0 0 120px !important;
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    box-sizing: border-box !important;
}

#content #order_form .fieldBox.field-order_vat > select,
#content #order_form .fieldBox.field-order_cost_vat > select {
    flex: 0 0 60px !important;
    width: 60px !important;
    min-width: 60px !important;
    max-width: 60px !important;
    box-sizing: border-box !important;
}

#content #order_form .fieldBox.field-rebate > input,
#content #invoice_form .fieldBox.field-rebate > input {
    flex: 0 0 100px !important;
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
    box-sizing: border-box !important;
}

#content #order_form .form-row.field-details_items_count.field-details_window_count > .fieldBox > input,
#content #order_form .form-row.field-details_door_count.field-details_glass_count > .fieldBox > input {
    flex: 0 0 70px !important;
    width: 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
    box-sizing: border-box !important;
}

/* Order status row: keep four fields on one compact line. */
#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 16px !important;
    align-items: center !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    gap: 6px !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox > label {
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
}

#content #order_form #id_status {
    flex: 0 0 110px !important;
    width: 110px !important;
    min-width: 110px !important;
    max-width: 110px !important;
}

#content #order_form #id_order_id_suffix {
    flex: 0 0 90px !important;
    width: 90px !important;
    min-width: 90px !important;
    max-width: 90px !important;
}

#content #order_form #id_webshop_order_id {
    flex: 0 0 100px !important;
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
}

#content #order_form #id_webshop_reference {
    flex: 0 0 110px !important;
    width: 110px !important;
    min-width: 110px !important;
    max-width: 110px !important;
}

/* Orders/invoices: keep readonly values the same width as inputs. */
#content #order_form .form-row .fieldBox > .readonly,
#content #invoice_form .form-row .fieldBox > .readonly {
    flex: 0 0 150px !important;
    width: 150px !important;
    min-width: 0 !important;
    max-width: none !important;
    margin-left: 0 !important;
    padding-top: 0 !important;
    overflow-wrap: anywhere;
}

/* Order status: three equal label/field columns. */
#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display,
#content #order_form .form-row.field-assigned_to.field-advection,
#content #order_form .form-row.field-payment_type.field-paid_in_advance,
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay {
    display: grid !important;
    grid-template-columns: repeat(3, 300px) !important;
    column-gap: 32px !important;
    row-gap: 12px !important;
    align-items: start !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox,
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox > label,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > label,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > label,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > label,
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox > label {
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    padding-top: 0 !important;
    margin: 0 !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox > input,
#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox > select,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > input,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > select,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > input,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > select,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > input,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > select,
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox > input,
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox > select {
    flex: 0 0 160px !important;
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
    box-sizing: border-box !important;
}

#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > .readonly,
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox > .readonly {
    flex: 0 0 160px !important;
    width: 160px !important;
    margin-left: 0 !important;
    padding-top: 0 !important;
}

/* Invoice status: three equal label/field columns. */
#content #invoice_form .form-row.field-status.field-invoice_number,
#content #invoice_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display,
#content #invoice_form .form-row.field-assigned_to,
#content #invoice_form .form-row.field-order__paid_in_advance.field-order__paid_in_advance_amount.field-invoice_paid,
#content #invoice_form .form-row.field-invoice_submit_date,
#content #invoice_form .form-row.field-order__payment_type.field-order__customer_project,
#content #invoice_form .form-row.field-order_link.field-exported_to_xlsx {
    display: grid !important;
    grid-template-columns: repeat(3, 300px) !important;
    column-gap: 32px !important;
    row-gap: 12px !important;
    align-items: start !important;
}

#content #invoice_form .form-row.field-status.field-invoice_number > .fieldBox,
#content #invoice_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox,
#content #invoice_form .form-row.field-assigned_to > .fieldBox,
#content #invoice_form .form-row.field-order__paid_in_advance.field-order__paid_in_advance_amount.field-invoice_paid > .fieldBox,
#content #invoice_form .form-row.field-invoice_submit_date > .fieldBox,
#content #invoice_form .form-row.field-order__payment_type.field-order__customer_project > .fieldBox,
#content #invoice_form .form-row.field-order_link.field-exported_to_xlsx > .fieldBox {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
}

#content #invoice_form .form-row.field-status.field-invoice_number > .fieldBox > label,
#content #invoice_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > label,
#content #invoice_form .form-row.field-assigned_to > .fieldBox > label,
#content #invoice_form .form-row.field-order__paid_in_advance.field-order__paid_in_advance_amount.field-invoice_paid > .fieldBox > label,
#content #invoice_form .form-row.field-invoice_submit_date > .fieldBox > label,
#content #invoice_form .form-row.field-order__payment_type.field-order__customer_project > .fieldBox > label,
#content #invoice_form .form-row.field-order_link.field-exported_to_xlsx > .fieldBox > label {
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    padding-top: 0 !important;
    margin: 0 !important;
}

#content #invoice_form .form-row.field-status.field-invoice_number > .fieldBox > input,
#content #invoice_form .form-row.field-status.field-invoice_number > .fieldBox > select,
#content #invoice_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > input,
#content #invoice_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > select,
#content #invoice_form .form-row.field-assigned_to > .fieldBox > input,
#content #invoice_form .form-row.field-assigned_to > .fieldBox > select,
#content #invoice_form .form-row.field-order__paid_in_advance.field-order__paid_in_advance_amount.field-invoice_paid > .fieldBox > input,
#content #invoice_form .form-row.field-order__paid_in_advance.field-order__paid_in_advance_amount.field-invoice_paid > .fieldBox > select,
#content #invoice_form .form-row.field-invoice_submit_date > .fieldBox > input,
#content #invoice_form .form-row.field-order__payment_type.field-order__customer_project > .fieldBox > input,
#content #invoice_form .form-row.field-order__payment_type.field-order__customer_project > .fieldBox > select,
#content #invoice_form .form-row.field-order_link.field-exported_to_xlsx > .fieldBox > input,
#content #invoice_form .form-row.field-order_link.field-exported_to_xlsx > .fieldBox > select {
    flex: 0 0 160px !important;
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
    box-sizing: border-box !important;
}

#content #invoice_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > .readonly,
#content #invoice_form .form-row.field-order_link.field-exported_to_xlsx > .fieldBox > .readonly {
    flex: 0 0 160px !important;
    width: 160px !important;
    margin-left: 0 !important;
    padding-top: 0 !important;
}

/* Order: single-field rows align with normal field boxes. */
#content #order_form .form-row > .flex-container:not(.form-multiline) > label,
#content #invoice_form .form-row > .flex-container:not(.form-multiline) > label {
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
    padding-top: 0 !important;
    margin: 0 !important;
}

#content #order_form .form-row > .flex-container:not(.form-multiline) > input:not([type="checkbox"]):not([type="radio"]),
#content #order_form .form-row > .flex-container:not(.form-multiline) > select,
#content #invoice_form .form-row > .flex-container:not(.form-multiline) > input:not([type="checkbox"]):not([type="radio"]),
#content #invoice_form .form-row > .flex-container:not(.form-multiline) > select {
    flex: 0 0 150px !important;
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
    box-sizing: border-box !important;
}

/* Order: customer invoice counter smaller. */
#content #order_form .fieldBox.field-customer_invoices_counter > .readonly {
    flex: 0 0 75px !important;
    width: 75px !important;
    min-width: 0 !important;
    max-width: 75px !important;
}

/* Order: transport cost label before a compact field. */
#content #order_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox.field-transportation_cost_gross {
    display: grid !important;
    grid-template-columns: 150px auto !important;
    column-gap: 8px !important;
    align-items: center !important;
    width: auto !important;
    max-width: none !important;
}

#content #order_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox.field-transportation_cost_gross > label {
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
    padding-top: 0 !important;
    margin: 0 !important;
}

#content #order_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox.field-transportation_cost_gross > .transportation-cost-inline {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    min-width: 0 !important;
    width: auto !important;
}

#content #order_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox.field-transportation_cost_gross .transportation-cost-inline > input {
    flex: 0 0 120px !important;
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    box-sizing: border-box !important;
}

/* Order: total/rebate row compact and left aligned. */
#content #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 16px !important;
    align-items: center !important;
    overflow: visible !important;
    margin-bottom: 32px !important;
}

#content #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf > .fieldBox {
    display: flex !important;
    flex: 0 0 auto !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    position: relative !important;
}

#content #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-order_total_amount > label {
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
    padding-top: 0 !important;
    margin: 0 !important;
}

#content #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate > label {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
    padding-top: 0 !important;
    margin: 0 !important;
}

#content #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-order_total_amount > input {
    flex: 0 0 120px !important;
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    box-sizing: border-box !important;
}

#content #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate > input {
    flex: 0 0 100px !important;
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
    box-sizing: border-box !important;
}

#content #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf > .fieldBox > .help {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    width: 300px !important;
    margin: 2px 0 0 !important;
    z-index: 2 !important;
}

#content #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate_visible_on_pdf {
    flex-wrap: wrap !important;
}

#content #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate_visible_on_pdf > .help {
    flex: 0 0 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
}

/* Order: Webshop Reference label and field on one line. */
#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox.field-webshop_reference > label {
    width: 145px !important;
    min-width: 145px !important;
    max-width: 145px !important;
    white-space: nowrap !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox.field-webshop_reference > input {
    flex: 0 0 135px !important;
    width: 135px !important;
    min-width: 135px !important;
    max-width: 135px !important;
    box-sizing: border-box !important;
}

/* Order: Forskudd row aligns and Restbelop gets room. */
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay {
    grid-template-columns: 300px 380px 260px !important;
    align-items: center !important;
}

#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox {
    align-items: center !important;
}

/* Order: transport cost width like the other amount fields. */
#content #order_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox.field-transportation_cost_gross .transportation-cost-inline > input {
    flex: 0 0 150px !important;
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
}

/* Order: rebate help must not run into the PDF flag. */
#content #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate > .help {
    width: 200px !important;
}

/* Order: strict finance grid with equal field widths. */
#content #order_form .form-row.field-order_value_net.field-order_value_gross.field-order_vat,
#content #order_form .form-row.field-order_cost_net.field-order_cost_gross.field-order_cost_vat,
#content #order_form .form-row.field-order_margin_percent.field-order_margin.field-currency,
#content #order_form .form-row.field-delivery_type.field-transportation_cost_gross,
#content #order_form .form-row.field-installation_cost_gross,
#content #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf {
    display: grid !important;
    grid-template-columns: 260px 260px 260px !important;
    column-gap: 24px !important;
    row-gap: 12px !important;
    align-items: center !important;
    overflow: visible !important;
}

#content #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf {
    margin-bottom: 50px !important;
}

#content #order_form .form-row.field-order_value_net.field-order_value_gross.field-order_vat > .fieldBox,
#content #order_form .form-row.field-order_cost_net.field-order_cost_gross.field-order_cost_vat > .fieldBox,
#content #order_form .form-row.field-order_margin_percent.field-order_margin.field-currency > .fieldBox,
#content #order_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox,
#content #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf > .fieldBox {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    position: relative !important;
}

#content #order_form .form-row.field-order_value_net.field-order_value_gross.field-order_vat > .fieldBox > label,
#content #order_form .form-row.field-order_cost_net.field-order_cost_gross.field-order_cost_vat > .fieldBox > label,
#content #order_form .form-row.field-order_margin_percent.field-order_margin.field-currency > .fieldBox > label,
#content #order_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox > label,
#content #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf > .fieldBox > label {
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    padding-top: 0 !important;
    margin: 0 !important;
}

#content #order_form .form-row.field-order_value_net.field-order_value_gross.field-order_vat > .fieldBox > input,
#content #order_form .form-row.field-order_value_net.field-order_value_gross.field-order_vat > .fieldBox > select,
#content #order_form .form-row.field-order_cost_net.field-order_cost_gross.field-order_cost_vat > .fieldBox > input,
#content #order_form .form-row.field-order_cost_net.field-order_cost_gross.field-order_cost_vat > .fieldBox > select,
#content #order_form .form-row.field-order_margin_percent.field-order_margin.field-currency > .fieldBox > input,
#content #order_form .form-row.field-order_margin_percent.field-order_margin.field-currency > .fieldBox > select,
#content #order_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox > select,
#content #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf > .fieldBox > input {
    flex: 0 0 120px !important;
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    box-sizing: border-box !important;
}

#content #order_form .form-row.field-installation_cost_gross > .flex-container {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
}

#content #order_form .form-row.field-installation_cost_gross > .flex-container > label {
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    padding-top: 0 !important;
    margin: 0 !important;
}

#content #order_form .form-row.field-installation_cost_gross > .flex-container > input {
    flex: 0 0 120px !important;
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    box-sizing: border-box !important;
}

#content #order_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox.field-transportation_cost_gross {
    display: grid !important;
    grid-template-columns: 120px auto !important;
    margin-left: 0 !important;
}

#content #order_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox.field-transportation_cost_gross > label {
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
}

#content #order_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox.field-transportation_cost_gross .transportation-cost-inline > input {
    flex: 0 0 120px !important;
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
}

#content #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf > .fieldBox > .help {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    width: 200px !important;
    margin: 2px 0 0 !important;
    z-index: 2 !important;
}

#content #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate_visible_on_pdf {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
}

#content #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate_visible_on_pdf > .help {
    flex: 0 0 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
}

/* Order details: match offer compact details fields. */
#content #order_form .form-row.field-details_items_count.field-details_window_count,
#content #order_form .form-row.field-details_door_count.field-details_glass_count {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 32px !important;
    align-items: flex-start !important;
}

#content #order_form .form-row.field-details_items_count.field-details_window_count > .fieldBox,
#content #order_form .form-row.field-details_door_count.field-details_glass_count > .fieldBox {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    gap: 8px !important;
}

#content #order_form .form-row.field-details_items_count.field-details_window_count > .fieldBox > label,
#content #order_form .form-row.field-details_door_count.field-details_glass_count > .fieldBox > label {
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    padding-top: 0 !important;
    margin: 0 !important;
}

#content #order_form .form-row.field-details_items_count.field-details_window_count > .fieldBox > input,
#content #order_form .form-row.field-details_door_count.field-details_glass_count > .fieldBox > input {
    flex: 0 0 70px !important;
    width: 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
    box-sizing: border-box !important;
}

/* Order: Webshop Reference forced to one line. */
#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox.field-webshop_reference {
    display: grid !important;
    grid-template-columns: 145px 135px !important;
    align-items: center !important;
    gap: 8px !important;
}

/* Order: date shortcut close to its label. */
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox.field-paid_in_advance_date > p.date {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

/* Order finance: wider cells keep total+refresh inside and align columns. */
#content #order_form .form-row.field-order_value_net.field-order_value_gross.field-order_vat,
#content #order_form .form-row.field-order_cost_net.field-order_cost_gross.field-order_cost_vat,
#content #order_form .form-row.field-order_margin_percent.field-order_margin.field-currency,
#content #order_form .form-row.field-delivery_type.field-transportation_cost_gross,
#content #order_form .form-row.field-installation_cost_gross,
#content #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf {
    grid-template-columns: 300px 300px 300px !important;
}

/* Order: Webshop Reference text vertically centred with its input. */
#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox.field-webshop_reference > label {
    line-height: 27px !important;
    padding: 0 !important;
}

/* Order: Forskudd date label closer to its field. */
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox.field-paid_in_advance_date > label {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
}

/* Order status: four equal columns so Webshop Reference stays in row 1. */
#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display,
#content #order_form .form-row.field-assigned_to.field-advection,
#content #order_form .form-row.field-payment_type.field-paid_in_advance,
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay {
    grid-template-columns: repeat(4, 250px) !important;
    column-gap: 12px !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox > label,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > label,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > label,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > label,
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox > label {
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox > input,
#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox > select,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > input,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > select,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > input,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > select,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > input,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > select,
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox > input,
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox > select {
    flex: 0 0 120px !important;
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    box-sizing: border-box !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox > .readonly,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > .readonly,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > .readonly,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > .readonly,
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox > .readonly {
    flex: 0 0 120px !important;
    width: 120px !important;
    min-width: 0 !important;
    max-width: none !important;
}

#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > .related-widget-wrapper {
    flex: 0 0 120px !important;
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
}

#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > .related-widget-wrapper .select2-container,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > .related-widget-wrapper .select2-selection--single {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
}

/* Order finance total/rebate label widths to align fields. */
#content #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-order_total_amount > label,
#content #order_form .form-row.field-order_total_amount.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate > label {
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
}

/* Order status: keep first row in four columns, other rows in three wider columns. */
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display,
#content #order_form .form-row.field-assigned_to.field-advection,
#content #order_form .form-row.field-payment_type.field-paid_in_advance {
    grid-template-columns: repeat(3, 300px) !important;
    column-gap: 32px !important;
}

#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > input,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > select,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > input,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > select,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > input,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > select {
    flex: 0 0 160px !important;
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
}

#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > .readonly,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > .readonly,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > .readonly {
    flex: 0 0 160px !important;
    width: 160px !important;
}

#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > .related-widget-wrapper {
    flex: 0 0 160px !important;
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
}

#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay {
    grid-template-columns: 300px 380px 260px !important;
    column-gap: 24px !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference {
    column-gap: 8px !important;
}

/* Order status: one shared four-column grid, responsive and symmetric. */
#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display,
#content #order_form .form-row.field-assigned_to.field-advection,
#content #order_form .form-row.field-payment_type.field-paid_in_advance,
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    column-gap: 32px !important;
    row-gap: 12px !important;
    align-items: start !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox,
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox > label,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > label,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > label,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > label,
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox > label {
    flex: 0 0 auto !important;
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    padding-top: 0 !important;
    margin: 0 !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox > input,
#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox > select,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > input,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > select,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > input,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > select,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > input,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > select,
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox > input,
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox > select {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox > .readonly,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > .readonly,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > .readonly,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > .readonly,
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox > .readonly {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    margin-left: 0 !important;
    padding-top: 0 !important;
}

#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > .related-widget-wrapper {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
}

#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > .related-widget-wrapper .select2-container,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > .related-widget-wrapper .select2-selection--single {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
}

/* Order status: Tildelt select should fill the same field width as Status. */
#content #order_form .fieldBox.field-assigned_to .related-widget-wrapper-link.view-related {
    display: none !important;
}

#content #order_form .fieldBox.field-assigned_to .related-widget-wrapper select {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
}

/* Order status: force identical control widths. */
#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox > input,
#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox > select,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > input,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > select,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > input,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > select,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > input,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > select,
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox > input,
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox > select {
    flex: 0 0 110px !important;
    width: 110px !important;
    min-width: 110px !important;
    max-width: 110px !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox > .readonly,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > .readonly,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > .readonly,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > .readonly,
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox > .readonly {
    flex: 0 0 110px !important;
    width: 110px !important;
}

#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > .related-widget-wrapper {
    flex: 0 0 110px !important;
    width: 110px !important;
    min-width: 110px !important;
    max-width: 110px !important;
}

/* Order status: pull columns horizontally closer, keep field widths. */
#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display,
#content #order_form .form-row.field-assigned_to.field-advection,
#content #order_form .form-row.field-payment_type.field-paid_in_advance,
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay {
    grid-template-columns: repeat(4, 238px) !important;
    column-gap: 12px !important;
    row-gap: 12px !important;
}

/* Order status: Forskudd row needs wider columns to fit date and Restbelop. */
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay {
    grid-template-columns: 300px 380px 260px !important;
    column-gap: 24px !important;
}

/* Order status: first four rows a bit wider so text does not wrap. */
#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display,
#content #order_form .form-row.field-assigned_to.field-advection,
#content #order_form .form-row.field-payment_type.field-paid_in_advance {
    grid-template-columns: repeat(4, minmax(248px, 1fr)) !important;
    column-gap: 8px !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox > label,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > label,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > label,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > label {
    width: 125px !important;
    min-width: 125px !important;
    max-width: 125px !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox > input,
#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox > select,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > input,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > select,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > input,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > select,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > input,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > select {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox > .readonly,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > .readonly,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > .readonly,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > .readonly {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    white-space: nowrap !important;
    font-size: 12px !important;
}

#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > .related-widget-wrapper {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
}

#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > label {
    width: 110px !important;
    min-width: 110px !important;
    max-width: 110px !important;
}

/* Order status: wider column spacing, fields keep their widths. */
#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display,
#content #order_form .form-row.field-assigned_to.field-advection,
#content #order_form .form-row.field-payment_type.field-paid_in_advance {
    grid-template-columns: repeat(4, minmax(248px, 1fr)) !important;
    column-gap: 8px !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox > label,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > label,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > label,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > label {
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox.field-webshop_reference > label {
    width: 125px !important;
    min-width: 125px !important;
    max-width: 125px !important;
    white-space: nowrap !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox > input,
#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox > select,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > input,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > select,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > input,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > select,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > input,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > select {
    flex: 0 0 110px !important;
    width: 110px !important;
    min-width: 110px !important;
    max-width: 110px !important;
    box-sizing: border-box !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference > .fieldBox > .readonly,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > .readonly,
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > .readonly,
#content #order_form .form-row.field-payment_type.field-paid_in_advance > .fieldBox > .readonly {
    flex: 0 0 110px !important;
    width: 110px !important;
    white-space: normal !important;
    font-size: inherit !important;
}

#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox > .related-widget-wrapper {
    flex: 0 0 110px !important;
    width: 110px !important;
    min-width: 110px !important;
    max-width: 110px !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display,
#content #order_form .form-row.field-assigned_to.field-advection,
#content #order_form .form-row.field-payment_type.field-paid_in_advance {
    grid-template-columns: repeat(4, 243px) !important;
    column-gap: 8px !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display,
#content #order_form .form-row.field-assigned_to.field-advection,
#content #order_form .form-row.field-payment_type.field-paid_in_advance {
    grid-template-columns: repeat(4, 245px) !important;
    column-gap: 8px !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display,
#content #order_form .form-row.field-assigned_to.field-advection,
#content #order_form .form-row.field-payment_type.field-paid_in_advance {
    grid-template-columns: repeat(4, 247px) !important;
    column-gap: 8px !important;
}

/* Order status: spread the first four rows vertically by ~15%. */
#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display,
#content #order_form .form-row.field-assigned_to.field-advection,
#content #order_form .form-row.field-payment_type.field-paid_in_advance {
    padding-top: 5px !important;
    padding-bottom: 5px !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display,
#content #order_form .form-row.field-assigned_to.field-advection,
#content #order_form .form-row.field-payment_type.field-paid_in_advance {
    padding-top: 6px !important;
    padding-bottom: 6px !important;
}

/* Align Forskudd date column with Ordrenummer / Oppdatert / Avdeling. */
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay {
    grid-template-columns: 247px 380px 260px !important;
    column-gap: 8px !important;
}

/* Align Ordrenummer/Oppdatert/Avdeling to the Forskudd dato column. */
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay {
    grid-template-columns: 300px 380px 260px !important;
    column-gap: 24px !important;
}

#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display,
#content #order_form .form-row.field-assigned_to.field-advection,
#content #order_form .form-row.field-payment_type.field-paid_in_advance {
    grid-template-columns: 300px 238px 238px 238px !important;
    column-gap: 24px !important;
}

/* Status: equal horizontal rhythm for all four columns. */
#content #order_form .form-row.field-status.field-order_id_suffix.field-webshop_order_id.field-webshop_reference,
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display,
#content #order_form .form-row.field-assigned_to.field-advection,
#content #order_form .form-row.field-payment_type.field-paid_in_advance {
    grid-template-columns: repeat(4, 300px) !important;
    column-gap: 24px !important;
}

/* Order status row 2: dates on one line. */
#content #order_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox > .readonly {
    flex: 0 0 160px !important;
    width: 160px !important;
    white-space: nowrap !important;
    font-size: inherit !important;
    line-height: 27px !important;
}

/* Order Forskudd row: everything vertically aligned. */
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay {
    align-items: center !important;
}

#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox {
    align-items: center !important;
}

#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox > label,
#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox > .readonly {
    line-height: 27px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

#content #order_form .form-row.field-paid_in_advance_amount.field-paid_in_advance_date.field-amount_left_to_pay > .fieldBox.field-paid_in_advance_date > p.date {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Offer status: 180px controls, aligned columns and 110px gap to Tilbudsnummer. */
#content #offer_form .form-row.field-status.field-offer_id_suffix.field-advection,
#content #offer_form .form-row.field-assigned_to.field-probability.field-created_by_display,
#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display {
    gap: 110px !important;
}

#content #offer_form .form-row.field-status.field-offer_id_suffix.field-advection > .fieldBox:nth-child(1),
#content #offer_form .form-row.field-assigned_to.field-probability.field-created_by_display > .fieldBox:nth-child(1),
#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox:nth-child(1) {
    flex: 0 0 296px !important;
    width: 296px !important;
}

#content #offer_form .form-row.field-status.field-offer_id_suffix.field-advection > .fieldBox:nth-child(2),
#content #offer_form .form-row.field-assigned_to.field-probability.field-created_by_display > .fieldBox:nth-child(2),
#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox:nth-child(2) {
    flex: 0 0 293px !important;
    width: 293px !important;
}

#content #offer_form .form-row.field-status.field-offer_id_suffix.field-advection > .fieldBox:nth-child(3),
#content #offer_form .form-row.field-assigned_to.field-probability.field-created_by_display > .fieldBox:nth-child(3),
#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display > .fieldBox:nth-child(3) {
    flex: 0 0 288px !important;
    width: 288px !important;
}

#content #offer_form #id_status,
#content #offer_form #id_assigned_to,
#content #offer_form #id_probability,
#content #offer_form #id_offer_id_suffix,
#content #offer_form #id_advection {
    width: 180px !important;
    min-width: 180px !important;
    max-width: 180px !important;
    flex: 0 0 180px !important;
}

#content #offer_form .form-row.field-status.field-offer_id_suffix.field-advection .readonly,
#content #offer_form .form-row.field-assigned_to.field-probability.field-created_by_display .readonly,
#content #offer_form .form-row.field-created_on.field-updated_on.field-last_modified_by_display .readonly {
    width: 180px !important;
}

/* Offer finance: 160px amount fields and 50px gaps between columns. */
#content #offer_form .form-row.field-offer_value_net.field-offer_value_gross.field-offer_vat,
#content #offer_form .form-row.field-offer_value_after_rebate_net.field-offer_value_after_rebate_gross,
#content #offer_form .form-row.field-offer_cost_net.field-offer_cost_gross.field-offer_cost_vat,
#content #offer_form .form-row.field-offer_margin.field-currency,
#content #offer_form .form-row.field-delivery_type.field-transportation_cost_gross,
#content #offer_form .form-row.field-installation_cost_gross,
#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf {
    gap: 100px !important;
}

#content #offer_form .form-row.field-offer_value_net.field-offer_value_gross.field-offer_vat > .fieldBox:nth-child(1),
#content #offer_form .form-row.field-offer_value_net.field-offer_value_gross.field-offer_vat > .fieldBox:nth-child(2),
#content #offer_form .form-row.field-offer_value_after_rebate_net.field-offer_value_after_rebate_gross > .fieldBox:nth-child(1),
#content #offer_form .form-row.field-offer_value_after_rebate_net.field-offer_value_after_rebate_gross > .fieldBox:nth-child(2),
#content #offer_form .form-row.field-offer_cost_net.field-offer_cost_gross.field-offer_cost_vat > .fieldBox:nth-child(1),
#content #offer_form .form-row.field-offer_cost_net.field-offer_cost_gross.field-offer_cost_vat > .fieldBox:nth-child(2),
#content #offer_form .form-row.field-offer_margin.field-currency > .fieldBox:nth-child(1),
#content #offer_form .form-row.field-offer_margin.field-currency > .fieldBox:nth-child(2),
#content #offer_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox:nth-child(1),
#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox:nth-child(1) {
    flex: 0 0 328px !important;
    width: 328px !important;
    margin-left: 0 !important;
}

#content #offer_form .form-row.field-offer_value_net.field-offer_value_gross.field-offer_vat > .fieldBox.field-offer_vat,
#content #offer_form .form-row.field-offer_cost_net.field-offer_cost_gross.field-offer_cost_vat > .fieldBox.field-offer_cost_vat {
    flex: 0 0 190px !important;
    width: 190px !important;
    margin-left: 0 !important;
}

#content #offer_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox:nth-child(2) {
    flex: 0 0 280px !important;
    width: 280px !important;
    margin-left: 0 !important;
}

#content #offer_form .form-row.field-installation_cost_gross > .flex-container {
    flex: 0 0 328px !important;
    width: 328px !important;
}

#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox:nth-child(2) {
    flex: 0 0 328px !important;
    width: 328px !important;
    margin-left: 0 !important;
}

#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox:nth-child(3) {
    flex: 0 0 300px !important;
    width: 300px !important;
    margin-left: 0 !important;
}

#content #offer_form .form-row.field-offer_total_value.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate > label {
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
}

#content #offer_form #id_rebate_helptext {
    margin-left: 168px !important;
    width: 160px !important;
}

#content #offer_form #id_offer_value_net,
#content #offer_form #id_offer_value_gross,
#content #offer_form #id_offer_value_after_rebate_net,
#content #offer_form #id_offer_value_after_rebate_gross,
#content #offer_form #id_offer_cost_net,
#content #offer_form #id_offer_cost_gross,
#content #offer_form #id_offer_margin,
#content #offer_form #id_transportation_cost_gross,
#content #offer_form #id_installation_cost_gross,
#content #offer_form #id_offer_total_value,
#content #offer_form #id_rebate {
    flex: 0 0 160px !important;
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
}

#content #offer_form #id_offer_vat,
#content #offer_form #id_offer_cost_vat {
    flex: 0 0 100px !important;
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
}

#content #offer_form #id_currency,
#content #offer_form #id_delivery_type {
    flex: 0 0 160px !important;
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
}

/* Align Transportkostnad under Valuta (NOK). */
#content #offer_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox.field-transportation_cost_gross {
    flex: 0 0 328px !important;
    width: 328px !important;
    margin-left: 0 !important;
    grid-template-columns: 160px auto !important;
}

#content #offer_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox.field-transportation_cost_gross > label {
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
}

/* Rabatt directly under Transportkostnad. */
#content #offer_form .form-row.field-installation_cost_gross.field-rebate {
    gap: 100px !important;
}

#content #offer_form .form-row.field-installation_cost_gross.field-rebate > .fieldBox.field-rebate {
    flex-wrap: wrap !important;
}

#content #offer_form .form-row.field-installation_cost_gross.field-rebate > .fieldBox.field-rebate > label {
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
    order: 1 !important;
}

#content #offer_form .form-row.field-installation_cost_gross.field-rebate > .fieldBox.field-rebate > input {
    order: 2 !important;
}

#content #offer_form .form-row.field-installation_cost_gross.field-rebate > .fieldBox.field-rebate > .help {
    order: 4 !important;
    flex: 0 0 160px !important;
    width: 160px !important;
    min-width: 160px !important;
    margin-left: 168px !important;
}

#content #offer_form .form-row.field-offer_total_value.field-rebate_visible_on_pdf {
    gap: 58px !important;
}

#content #offer_form .form-row.field-offer_total_value.field-rebate_visible_on_pdf > .fieldBox:nth-child(1) {
    flex: 0 0 370px !important;
    width: 370px !important;
}

#content #offer_form .form-row.field-offer_total_value.field-rebate_visible_on_pdf > .fieldBox:nth-child(2) {
    flex: 0 0 300px !important;
    width: 300px !important;
}

#content #offer_form .form-row.field-offer_total_value.field-rebate_visible_on_pdf > .fieldBox.field-offer_total_value > label {
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
}

#content #offer_form .form-row.field-offer_total_value > .flex-container {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
    flex: 0 0 370px !important;
    width: 370px !important;
}

#content #offer_form .form-row.field-offer_total_value > .flex-container > label {
    order: 1 !important;
    flex: 0 0 auto !important;
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
    padding-top: 0 !important;
    margin: 0 !important;
}

#content #offer_form .form-row.field-offer_total_value > .flex-container > input {
    order: 2 !important;
}

#content #offer_form .form-row.field-offer_total_value > .flex-container > .restore-amount-button {
    order: 3 !important;
}

#content #offer_form .form-row.field-offer_total_value > .flex-container > .help {
    order: 4 !important;
    flex: 0 0 160px !important;
    width: 160px !important;
    min-width: 160px !important;
    margin-left: 168px !important;
}

#content #offer_form #id_offer_total_value {
    box-sizing: border-box !important;
}

#content #offer_form .form-row.field-installation_cost_gross > .fieldBox.field-rebate_visible_on_pdf {
    flex-wrap: wrap !important;
    align-items: flex-start !important;
}

#content #offer_form .form-row.field-installation_cost_gross > .fieldBox.field-rebate_visible_on_pdf > .help {
    flex: 0 0 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
}

/* Documents: 100px gap between the PDF column and the customer-link flag. */
#content #offer_form .form-row.field-offer_pdf_file.field-client_link_visible_on_pdf.flex-container.form-multiline {
    column-gap: 100px !important;
}

/* Match the transport recalculation button to the total restore button. */
#content #offer_form #recalculate-transportation-cost-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: #2563eb !important;
    color: #ffffff !important;
    border: 0 !important;
    border-radius: 4px !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    padding: 0 !important;
    margin-left: 0 !important;
    cursor: pointer !important;
    line-height: 1 !important;
    vertical-align: middle !important;
}

#content #offer_form #recalculate-transportation-cost-btn:hover {
    background-color: #1d4ed8 !important;
}

#content #offer_form #recalculate-transportation-cost-btn svg {
    width: 16px !important;
    height: 16px !important;
}

/* Orders: match offer finance field widths and 100px gaps. */
#content #order_form .form-row.field-order_value_net.field-order_value_gross.field-order_vat,
#content #order_form .form-row.field-order_cost_net.field-order_cost_gross.field-order_cost_vat,
#content #order_form .form-row.field-order_margin_percent.field-order_margin.field-currency,
#content #order_form .form-row.field-delivery_type.field-transportation_cost_gross,
#content #order_form .form-row.field-installation_cost_gross.field-rebate.field-rebate_visible_on_pdf {
    gap: 100px !important;
}

#content #order_form .fieldBox.field-order_value_net,
#content #order_form .fieldBox.field-order_value_gross,
#content #order_form .fieldBox.field-order_cost_net,
#content #order_form .fieldBox.field-order_cost_gross,
#content #order_form .fieldBox.field-order_margin_percent,
#content #order_form .fieldBox.field-order_margin,
#content #order_form .fieldBox.field-currency,
#content #order_form .fieldBox.field-delivery_type,
#content #order_form .fieldBox.field-installation_cost_gross,
#content #order_form .fieldBox.field-rebate {
    flex: 0 0 328px !important;
    width: 328px !important;
    margin-left: 0 !important;
}

#content #order_form .fieldBox.field-order_vat,
#content #order_form .fieldBox.field-order_cost_vat {
    flex: 0 0 190px !important;
    width: 190px !important;
    margin-left: 0 !important;
}

#content #order_form .fieldBox.field-rebate_visible_on_pdf {
    flex: 0 0 328px !important;
    width: 328px !important;
    margin-left: 0 !important;
}

#content #order_form .fieldBox.field-order_value_net > label,
#content #order_form .fieldBox.field-order_value_gross > label,
#content #order_form .fieldBox.field-order_cost_net > label,
#content #order_form .fieldBox.field-order_cost_gross > label,
#content #order_form .fieldBox.field-order_margin_percent > label,
#content #order_form .fieldBox.field-order_margin > label,
#content #order_form .fieldBox.field-currency > label,
#content #order_form .fieldBox.field-delivery_type > label,
#content #order_form .fieldBox.field-installation_cost_gross > label,
#content #order_form .fieldBox.field-rebate > label {
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
}

#content #order_form #id_order_value_net,
#content #order_form #id_order_value_gross,
#content #order_form #id_order_cost_net,
#content #order_form #id_order_cost_gross,
#content #order_form #id_order_margin_percent,
#content #order_form #id_order_margin,
#content #order_form #id_transportation_cost_gross,
#content #order_form #id_installation_cost_gross,
#content #order_form #id_order_total_amount,
#content #order_form #id_rebate {
    flex: 0 0 160px !important;
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
    box-sizing: border-box !important;
}

#content #order_form #id_order_vat,
#content #order_form #id_order_cost_vat {
    flex: 0 0 100px !important;
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
    box-sizing: border-box !important;
}

#content #order_form #id_currency,
#content #order_form #id_delivery_type {
    flex: 0 0 160px !important;
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
    box-sizing: border-box !important;
}

#content #order_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox.field-transportation_cost_gross {
    flex: 0 0 328px !important;
    width: 328px !important;
    margin-left: 0 !important;
    grid-template-columns: 160px auto !important;
}

#content #order_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox.field-transportation_cost_gross > label {
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
}

#content #order_form .form-row.field-installation_cost_gross.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate {
    flex-wrap: wrap !important;
}

#content #order_form .form-row.field-installation_cost_gross.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate > label {
    order: 1 !important;
}

#content #order_form .form-row.field-installation_cost_gross.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate > input {
    order: 2 !important;
}

#content #order_form .form-row.field-installation_cost_gross.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate > .help {
    order: 4 !important;
    flex: 0 0 160px !important;
    width: 160px !important;
    min-width: 160px !important;
    margin-left: 168px !important;
}

#content #order_form .form-row.field-installation_cost_gross.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate_visible_on_pdf {
    flex-wrap: wrap !important;
    align-items: flex-start !important;
}

#content #order_form .form-row.field-installation_cost_gross.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate_visible_on_pdf > .help {
    flex: 0 0 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
}

#content #order_form .form-row.field-order_total_amount > .flex-container {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
    flex: 0 0 370px !important;
    width: 370px !important;
}

#content #order_form .form-row.field-order_total_amount > .flex-container > label {
    order: 1 !important;
    flex: 0 0 auto !important;
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
    padding-top: 0 !important;
    margin: 0 !important;
}

#content #order_form .form-row.field-order_total_amount > .flex-container > input {
    order: 2 !important;
}

#content #order_form .form-row.field-order_total_amount > .flex-container > .restore-amount-button {
    order: 3 !important;
}

#content #order_form .form-row.field-order_total_amount > .flex-container > .help {
    order: 4 !important;
    flex: 0 0 160px !important;
    width: 160px !important;
    min-width: 160px !important;
    margin-left: 168px !important;
}

#content #order_form .form-row.field-order_pdf_file.field-client_link_visible_on_pdf.flex-container.form-multiline {
    column-gap: 100px !important;
}

#content #order_form #recalculate-transportation-cost-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: #2563eb !important;
    color: #ffffff !important;
    border: 0 !important;
    border-radius: 4px !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    padding: 0 !important;
    margin-left: 0 !important;
    cursor: pointer !important;
    line-height: 1 !important;
    vertical-align: middle !important;
}

#content #order_form #recalculate-transportation-cost-btn:hover {
    background-color: #1d4ed8 !important;
}

#content #order_form #recalculate-transportation-cost-btn svg {
    width: 16px !important;
    height: 16px !important;
}

#content #order_form .form-row.field-order_value_net.field-order_value_gross.field-order_vat,
#content #order_form .form-row.field-order_cost_net.field-order_cost_gross.field-order_cost_vat {
    grid-template-columns: 328px 328px 190px !important;
}

#content #order_form .form-row.field-order_margin_percent.field-order_margin.field-currency,
#content #order_form .form-row.field-installation_cost_gross.field-rebate.field-rebate_visible_on_pdf {
    grid-template-columns: 328px 328px 328px !important;
}

#content #order_form .form-row.field-delivery_type.field-transportation_cost_gross {
    grid-template-columns: 328px 328px !important;
}

#content #order_form .form-row.field-order_value_net.field-order_value_gross.field-order_vat > .fieldBox.field-order_value_net > label,
#content #order_form .form-row.field-order_value_net.field-order_value_gross.field-order_vat > .fieldBox.field-order_value_gross > label,
#content #order_form .form-row.field-order_cost_net.field-order_cost_gross.field-order_cost_vat > .fieldBox.field-order_cost_net > label,
#content #order_form .form-row.field-order_cost_net.field-order_cost_gross.field-order_cost_vat > .fieldBox.field-order_cost_gross > label,
#content #order_form .form-row.field-order_margin_percent.field-order_margin.field-currency > .fieldBox > label,
#content #order_form .form-row.field-delivery_type.field-transportation_cost_gross > .fieldBox > label {
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
}

#content #order_form .form-row.field-order_value_net.field-order_value_gross.field-order_vat > .fieldBox.field-order_vat > label,
#content #order_form .form-row.field-order_cost_net.field-order_cost_gross.field-order_cost_vat > .fieldBox.field-order_cost_vat > label {
    width: 82px !important;
    min-width: 82px !important;
    max-width: 82px !important;
}

#content #order_form .form-row.field-installation_cost_gross.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-installation_cost_gross > label,
#content #order_form .form-row.field-installation_cost_gross.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate > label {
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
}

/* Invoices: match finance field widths and 100px gaps. */
#content #invoice_form .form-row.field-order_value_net.field-order_value_gross.field-currency,
#content #invoice_form .form-row.field-order_cost_net.field-order_cost_gross,
#content #invoice_form .form-row.field-order_transportation_cost_gross.field-order_installation_cost_gross,
#content #invoice_form .form-row.field-order_total_cost_net.field-order_total_cost,
#content #invoice_form .form-row.field-rebate.field-rebate_visible_on_pdf {
    gap: 100px !important;
}

#content #invoice_form .form-row.field-order_value_net.field-order_value_gross.field-currency > .fieldBox,
#content #invoice_form .form-row.field-order_cost_net.field-order_cost_gross > .fieldBox,
#content #invoice_form .form-row.field-order_transportation_cost_gross.field-order_installation_cost_gross > .fieldBox,
#content #invoice_form .form-row.field-order_total_cost_net.field-order_total_cost > .fieldBox,
#content #invoice_form .form-row.field-rebate.field-rebate_visible_on_pdf > .fieldBox {
    flex: 0 0 328px !important;
    width: 328px !important;
    margin-left: 0 !important;
}

#content #invoice_form .form-row.field-order_value_net.field-order_value_gross.field-currency > .fieldBox > label,
#content #invoice_form .form-row.field-order_cost_net.field-order_cost_gross > .fieldBox > label,
#content #invoice_form .form-row.field-order_transportation_cost_gross.field-order_installation_cost_gross > .fieldBox > label,
#content #invoice_form .form-row.field-order_total_cost_net.field-order_total_cost > .fieldBox > label,
#content #invoice_form .form-row.field-rebate.field-rebate_visible_on_pdf > .fieldBox > label {
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
}

#content #invoice_form .form-row.field-order_value_net.field-order_value_gross.field-currency > .fieldBox > .readonly,
#content #invoice_form .form-row.field-order_cost_net.field-order_cost_gross > .fieldBox > .readonly,
#content #invoice_form .form-row.field-order_transportation_cost_gross.field-order_installation_cost_gross > .fieldBox > .readonly,
#content #invoice_form .form-row.field-order_total_cost_net.field-order_total_cost > .fieldBox > .readonly {
    width: 160px !important;
}

#content #invoice_form #id_rebate {
    flex: 0 0 160px !important;
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
    box-sizing: border-box !important;
}

#content #invoice_form .form-row.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate {
    flex-wrap: wrap !important;
}

#content #invoice_form .form-row.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate > label {
    order: 1 !important;
}

#content #invoice_form .form-row.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate > input {
    order: 2 !important;
}

#content #invoice_form .form-row.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate > .help {
    order: 4 !important;
    flex: 0 0 160px !important;
    width: 160px !important;
    min-width: 160px !important;
    margin-left: 168px !important;
}

#content #invoice_form .form-row.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate_visible_on_pdf {
    flex-wrap: wrap !important;
    align-items: flex-start !important;
}

#content #invoice_form .form-row.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate_visible_on_pdf > .help {
    flex: 0 0 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
}

/* Global order/invoice layout: 160px fields and 100px gaps, wrapping as needed. */
#content #order_form .form-row:not(#kystvinduet-global-override),
#content #invoice_form .form-row:not(#kystvinduet-global-override) {
    display: flex !important;
    flex-wrap: wrap !important;
    column-gap: 100px !important;
    row-gap: 6px !important;
    align-items: flex-start !important;
}

#content #order_form .form-row:not(#kystvinduet-global-override) > .fieldBox,
#content #order_form .form-row:not(#kystvinduet-global-override) > .flex-container,
#content #invoice_form .form-row:not(#kystvinduet-global-override) > .fieldBox,
#content #invoice_form .form-row:not(#kystvinduet-global-override) > .flex-container {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
}

#content #order_form .form-row:not(#kystvinduet-global-override) .fieldBox > label,
#content #order_form .form-row:not(#kystvinduet-global-override) > .flex-container > label,
#content #invoice_form .form-row:not(#kystvinduet-global-override) .fieldBox > label,
#content #invoice_form .form-row:not(#kystvinduet-global-override) > .flex-container > label {
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
}

#content #order_form .form-row:not(#kystvinduet-global-override) input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
#content #order_form .form-row:not(#kystvinduet-global-override) select,
#content #invoice_form .form-row:not(#kystvinduet-global-override) input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
#content #invoice_form .form-row:not(#kystvinduet-global-override) select {
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
    flex: 0 0 160px !important;
    box-sizing: border-box !important;
}

#content #order_form .form-row.field-installation_cost_gross.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate:not(#kystvinduet-global-override),
#content #invoice_form .form-row.field-rebate.field-rebate_visible_on_pdf > .fieldBox.field-rebate:not(#kystvinduet-global-override) {
    flex: 0 0 328px !important;
    width: 328px !important;
    min-width: 328px !important;
    max-width: 328px !important;
}

/* Order status: Avdeling aligned with Ordrenummer/Oppdatert på. */
#content #order_form .form-row.field-assigned_to.field-advection > .fieldBox.field-assigned_to:not(#kystvinduet-global-override) {
    flex: 0 0 328px !important;
    width: 328px !important;
    min-width: 328px !important;
    max-width: 328px !important;
}

/* Order total help stays under the total amount field. */
#content #order_form .form-row.field-order_total_amount > .flex-container:not(#kystvinduet-global-override) {
    flex: 0 0 370px !important;
    width: 370px !important;
    min-width: 370px !important;
    max-width: 370px !important;
}

/* Order details: match the offer page count-field widths. */
#content #order_form .form-row.field-details_items_count.field-details_window_count:not(#kystvinduet-global-override) > .fieldBox > label,
#content #order_form .form-row.field-details_door_count.field-details_glass_count:not(#kystvinduet-global-override) > .fieldBox > label {
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
}

#content #order_form .form-row.field-details_items_count.field-details_window_count:not(#kystvinduet-global-override) > .fieldBox > input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
#content #order_form .form-row.field-details_door_count.field-details_glass_count:not(#kystvinduet-global-override) > .fieldBox > input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]) {
    width: 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
    flex: 0 0 70px !important;
}

/* Invoice documents: align file, flag, date and payment columns. */
#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) {
    display: grid !important;
    grid-template-columns: 400px 160px 328px !important;
    grid-template-areas:
        "file send date"
        "file paid payment" !important;
    column-gap: 100px !important;
    row-gap: 6px !important;
    align-items: start !important;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(1) {
    grid-area: file;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(2) {
    grid-area: send;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(3) {
    grid-area: paid;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(4) {
    grid-area: date;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(5) {
    grid-area: payment;
}

/* Invoice documents: single-line layout with 110px gaps. */
#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) {
    display: grid !important;
    grid-template-columns: 150px 110px 110px 200px 200px !important;
    grid-template-areas: "file send paid date payment" !important;
    column-gap: 110px !important;
    row-gap: 0 !important;
    align-items: start !important;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(1) {
    grid-area: file;
    width: 150px !important;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(2) {
    grid-area: send;
    width: 110px !important;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(3) {
    grid-area: paid;
    width: 110px !important;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(4) {
    grid-area: date;
    width: 200px !important;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(5) {
    grid-area: payment;
    width: 200px !important;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(4) > label,
#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(5) > label {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
    white-space: normal !important;
    overflow: visible !important;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(2) > label,
#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(3) > label {
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    white-space: normal !important;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(4) p.date > input,
#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(5) > select {
    width: 92px !important;
    min-width: 92px !important;
    max-width: 92px !important;
    flex: 0 0 92px !important;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(4) .datetimeshortcuts {
    display: none !important;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(1) .file-drop-zone {
    width: 100% !important;
    min-width: 0 !important;
    padding: 4px !important;
    font-size: 10px !important;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(1) .file-drop-hint {
    display: none !important;
}

/* Invoice documents: 50px between the two flags, 110px elsewhere. */
#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) {
    grid-template-columns: 150px 110px 110px 50px 110px 110px 200px 110px 200px !important;
    grid-template-areas: "file . send . paid . date . payment" !important;
    column-gap: 0 !important;
}

/* Invoice documents: final date column width for full date label/value. */
#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) {
    grid-template-columns: 150px 110px 110px 50px 110px 110px 220px 110px 200px !important;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(4) {
    width: 220px !important;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(4) > label {
    width: 115px !important;
    min-width: 115px !important;
    max-width: 115px !important;
}

/* Invoice documents: all column gaps 50px. */
#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) {
    grid-template-columns: 150px 50px 110px 50px 110px 50px 220px 50px 200px !important;
}

/* Invoice documents: split file label and file field, align row tops. */
#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) {
    grid-template-columns: 150px 50px 150px 50px 110px 50px 110px 50px 220px 50px 200px !important;
    grid-template-areas: "file file file . send . paid . date . payment" !important;
    column-gap: 0 !important;
    align-items: start !important;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(1) {
    grid-area: file !important;
    display: grid !important;
    grid-template-columns: 150px 150px !important;
    column-gap: 50px !important;
    align-items: start !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(1) > legend {
    grid-column: 1 !important;
    width: 150px !important;
    margin: 0 !important;
    padding: 0 !important;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(1) > .fieldBox {
    grid-column: 2 !important;
    width: 150px !important;
    margin: 0 !important;
}

/* Invoice documents: wide file field under the label, all fields on one height. */
#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) {
    grid-template-columns: 300px 50px 110px 50px 110px 50px 220px 50px 200px !important;
    grid-template-areas: "file . send . paid . date . payment" !important;
    column-gap: 0 !important;
    align-items: start !important;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(1) {
    grid-area: file !important;
    display: grid !important;
    grid-template-columns: 300px !important;
    row-gap: 6px !important;
    width: 300px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    align-items: start !important;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(1) > legend {
    grid-column: 1 !important;
    width: 300px !important;
    margin: 0 !important;
    padding: 0 !important;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(1) > .fieldBox {
    grid-column: 1 !important;
    width: 300px !important;
    margin: 0 !important;
}

#content #invoice_form :is(
    .form-row.field-invoice_advance_file.field-send_as_attachment_invoice_advance.field-advance_paid.field-invoice_advance_payment_date.field-invoice_advance_payment_type,
    .form-row.field-invoice_file.field-send_as_attachment_invoice.field-paid.field-invoice_payment_date.field-invoice_payment_type,
    .form-row.field-invoice_correction_file.field-send_as_attachment_invoice_correction.field-correction_paid.field-invoice_correction_payment_date.field-invoice_correction_payment_type
):not(#kystvinduet-global-override) > :nth-child(n+2) {
    margin-top: 21px !important;
}

/* Invoice Regnskap: hide rebate fields and emphasize totals. */
#content #invoice_form .form-row.field-rebate.field-rebate_visible_on_pdf:not(#kystvinduet-global-override) {
    display: none !important;
}

#content #invoice_form .form-row.field-order_total_cost_net.field-order_total_cost .readonly {
    font-weight: 700 !important;
}

/* Keep CRM links clickable without the underlined "crossed out" look. */
#content a,
#content a:link,
#content a:visited,
#content a:hover,
#content a:focus,
#changelist-filter li.selected a {
    text-decoration: none !important;
}

.calendar-send-action {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.calendar-sent-badge {
    color: #166534;
    font-weight: 700;
}

.service-calendar-dialog {
    width: 92vw;
    max-width: 560px;
    padding: 0;
    border: none;
    border-radius: 10px;
}

.service-calendar-dialog::backdrop {
    background: rgba(15, 23, 42, 0.55);
}

.service-calendar-dialog__content {
    padding: 20px;
}

.service-calendar-dialog__content p {
    margin: 0 0 10px;
}

.service-calendar-dialog__content label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.service-calendar-dialog__content input[type="text"],
.service-calendar-dialog__content input[type="date"],
.service-calendar-dialog__content input[type="time"],
.service-calendar-dialog__content textarea {
    width: 100%;
    box-sizing: border-box;
}

.service-calendar-dialog__content textarea {
    resize: vertical;
}

.service-calendar-assignees {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    padding: 6px;
}

.service-calendar-assignees label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 3px 2px;
    font-weight: 400;
}

.service-calendar-assignees input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.service-calendar-error {
    min-height: 18px;
    color: #b91c1c;
}

.service-calendar-dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.form-row.field-expected_completion_date.field-calendar_time.field-calendar_send_action > .flex-container.form-multiline,
.form-row.field-shipment_date.field-transport_start_time.field-order_calendar_send_action > .flex-container.form-multiline {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-end !important;
    gap: 16px !important;
}

.form-row.field-expected_completion_date.field-calendar_time.field-calendar_send_action > .flex-container.form-multiline > .fieldBox,
.form-row.field-shipment_date.field-transport_start_time.field-order_calendar_send_action > .flex-container.form-multiline > .fieldBox {
    flex: 0 0 auto !important;
    width: auto !important;
    margin-right: 0 !important;
}

.form-row.field-expected_completion_date.field-calendar_time.field-calendar_send_action > .flex-container.form-multiline > .fieldBox input,
.form-row.field-shipment_date.field-transport_start_time.field-order_calendar_send_action > .flex-container.form-multiline > .fieldBox input {
    width: auto !important;
}

.form-row.field-transportation_company.field-transport_phone.field-shipment_pdf_file.field-send_shipment_pdf_file_in_email
    > .flex-container.form-multiline {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 20px !important;
}

.form-row.field-transportation_company.field-transport_phone.field-shipment_pdf_file.field-send_shipment_pdf_file_in_email
    .fieldBox.field-shipment_pdf_file {
    flex: 1 1 320px !important;
    min-width: 280px !important;
}

.form-row.field-transportation_company.field-transport_phone.field-shipment_pdf_file.field-send_shipment_pdf_file_in_email
    .fieldBox.field-send_shipment_pdf_file_in_email {
    flex: 0 0 auto !important;
    align-self: center !important;
}

#servicerequest_form .form-row.field-customer.field-order {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
    gap: 16px !important;
}

#servicerequest_form .form-row.field-customer.field-order .fieldBox.field-customer,
#servicerequest_form .form-row.field-customer.field-order .fieldBox.field-order {
    flex: 0 0 360px !important;
    width: 360px !important;
    min-width: 0 !important;
    max-width: 360px !important;
}

#servicerequest_form .form-row.field-customer.field-order .fieldBox.field-customer .related-widget-wrapper,
#servicerequest_form .form-row.field-customer.field-order .fieldBox.field-order .related-widget-wrapper,
#servicerequest_form .form-row.field-customer.field-order .select2-container,
#servicerequest_form .form-row.field-customer.field-order .select2-selection--single {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
}

#servicerequest_form .form-row.field-optional_address.field-contact_phone {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
    gap: 16px !important;
}

#servicerequest_form .form-row.field-optional_address.field-contact_phone .fieldBox.field-optional_address {
    flex: 0 0 360px !important;
    width: 360px !important;
    min-width: 0 !important;
    max-width: 360px !important;
}

#servicerequest_form
    .form-row.field-optional_address.field-contact_phone
    .fieldBox.field-optional_address
    textarea {
    width: 100% !important;
    height: 72px !important;
    min-height: 72px !important;
}

#servicerequest_form .form-row.field-optional_address.field-contact_phone .fieldBox.field-contact_phone {
    flex: 0 1 220px !important;
    width: 220px !important;
    min-width: 0 !important;
    max-width: 220px !important;
}

#servicerequest_form .form-row.field-optional_address.field-contact_phone .fieldBox.field-contact_phone input {
    width: 100% !important;
}

#servicerequest_form .form-row.field-production_order_pdf_link.field-technical_export_pdf_link {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
    gap: 24px !important;
}

#servicerequest_form
    .form-row.field-production_order_pdf_link.field-technical_export_pdf_link
    .fieldBox.field-production_order_pdf_link,
#servicerequest_form
    .form-row.field-production_order_pdf_link.field-technical_export_pdf_link
    .fieldBox.field-technical_export_pdf_link {
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: none !important;
}

/* Service request: use the same label-gap-field rhythm as the Status section. */
#servicerequest_form .form-row .fieldBox {
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
}

#servicerequest_form .form-row .fieldBox > label {
    flex: 0 0 110px !important;
    width: 110px !important;
}

#servicerequest_form .form-row .fieldBox > .help {
    order: 3;
    flex-basis: 100%;
}

#servicerequest_form .form-row .fieldBox textarea {
    width: 600px !important;
    max-width: 100% !important;
}

#servicerequest_form .form-row .fieldBox input.vTextField,
#servicerequest_form .form-row .fieldBox select {
    max-width: 360px !important;
}

#servicerequest_form .form-row.field-customer.field-order .fieldBox.field-customer,
#servicerequest_form .form-row.field-customer.field-order .fieldBox.field-order,
#servicerequest_form .form-row.field-optional_address.field-contact_phone .fieldBox.field-optional_address,
#servicerequest_form .form-row.field-optional_address.field-contact_phone .fieldBox.field-contact_phone {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
}

#servicerequest_form .form-row.field-customer.field-order .related-widget-wrapper {
    width: auto !important;
}

#servicerequest_form .form-row.field-customer.field-order .select2-container,
#servicerequest_form .form-row.field-customer.field-order .select2-selection--single {
    width: 360px !important;
    min-width: 0 !important;
    max-width: 360px !important;
}

#servicerequest_form .form-row.field-optional_address.field-contact_phone .fieldBox.field-optional_address textarea {
    width: 360px !important;
    height: 72px !important;
    min-height: 72px !important;
}

#servicerequest_form .form-row.field-optional_address.field-contact_phone .fieldBox.field-contact_phone input {
    width: 220px !important;
}

#servicerequest_form .form-row > .flex-container {
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
    gap: 12px !important;
}

#servicerequest_form .form-row > .flex-container > label {
    flex: 0 0 110px !important;
    width: 110px !important;
}

#servicerequest_form .form-row > .flex-container > .help {
    order: 3;
    flex-basis: 100%;
}

#servicerequest_form .form-row > .flex-container > textarea {
    width: 600px !important;
    max-width: 100% !important;
}

#servicerequest_form .form-row .file-drop-zone {
    width: 600px !important;
    max-width: 100% !important;
}

/* Service request: place help text under the field and align file drops. */
#servicerequest_form .form-row .fieldBox,
#servicerequest_form .form-row > .flex-container {
    flex-wrap: wrap !important;
}

#servicerequest_form .form-row.field-customer.field-order .fieldBox.field-customer {
    flex-wrap: wrap !important;
}

#servicerequest_form .form-row.field-customer.field-order .fieldBox.field-customer > .help {
    order: 3;
    flex: 0 0 100% !important;
    width: 100% !important;
    margin-top: 4px;
}

#servicerequest_form .form-row.field-manufacturer_pdf_upload > fieldset {
    display: flex !important;
    align-items: flex-start !important;
    gap: 12px !important;
    border: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
}

#servicerequest_form .form-row.field-manufacturer_pdf_upload > fieldset > legend {
    flex: 0 0 110px !important;
    width: 110px !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    font-weight: 600;
}

#servicerequest_form .form-row.field-manufacturer_pdf_upload > fieldset > .flex-container {
    flex: 0 0 600px !important;
    width: 600px !important;
}

#servicerequest_form .form-row.field-manufacturer_pdf_upload .file-drop-zone {
    width: 100% !important;
}

#servicerequest_form .form-row.field-customer_photos .file-drop-zone {
    width: 520px !important;
    max-width: 100% !important;
    margin-left: 118px !important;
}

#servicerequest_form .form-row.field-customer_photos > .flex-container > .help {
    order: 3;
    flex: 0 0 100% !important;
    width: 100% !important;
    margin-left: 118px !important;
    margin-top: 4px;
}

#servicerequest_form .form-row.field-service_cost_transportation.field-service_cost_net_total,
#servicerequest_form .form-row.field-service_cost_materials.field-service_cost_vat_total,
#servicerequest_form .form-row.field-service_cost_labor.field-service_cost_gross_total {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
    gap: 110px !important;
}

#servicerequest_form
    .form-row.field-service_cost_transportation.field-service_cost_net_total
    .fieldBox.field-service_cost_transportation,
#servicerequest_form
    .form-row.field-service_cost_materials.field-service_cost_vat_total
    .fieldBox.field-service_cost_materials,
#servicerequest_form
    .form-row.field-service_cost_labor.field-service_cost_gross_total
    .fieldBox.field-service_cost_labor {
    flex: 0 0 450px !important;
    width: 450px !important;
    min-width: 0 !important;
    max-width: 450px !important;
}

#servicerequest_form .form-row.field-customer.field-order .fieldBox.field-customer {
    flex: 0 0 500px !important;
    width: 500px !important;
    min-width: 0 !important;
    max-width: 500px !important;
}

#servicerequest_form .form-row.field-manufacturer_pdf_upload > fieldset {
    position: relative !important;
    display: block !important;
    padding: 0 0 0 122px !important;
    border: 0 !important;
    margin: 0 !important;
}

#servicerequest_form .form-row.field-manufacturer_pdf_upload > fieldset > legend {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 110px !important;
    margin: 0 !important;
    padding: 0 !important;
    font-weight: 600;
}

#servicerequest_form .form-row.field-manufacturer_pdf_upload > fieldset > .flex-container {
    width: 600px !important;
    max-width: 100% !important;
}

#servicerequest_form
    .form-row.field-service_order_link.field-create_order_button
    .fieldBox.field-service_order_link,
#servicerequest_form
    .form-row.field-email_template.field-email_send_with_attachment
    .fieldBox.field-email_template {
    flex: 0 0 550px !important;
    width: 550px !important;
    min-width: 0 !important;
    max-width: 550px !important;
}

#servicerequest_form .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
    gap: 10px !important;
}

#servicerequest_form
    .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number
    > .fieldBox.field-reported_on {
    flex: 0 0 360px !important;
    width: 360px !important;
    min-width: 0 !important;
    max-width: 360px !important;
}

#servicerequest_form
    .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number
    > .fieldBox.field-manufacturer {
    flex: 0 0 450px !important;
    width: 450px !important;
    min-width: 0 !important;
    max-width: 450px !important;
}

#servicerequest_form
    .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number
    > .fieldBox.field-manufacturer_case_number {
    flex: 0 0 360px !important;
    width: 360px !important;
    min-width: 0 !important;
    max-width: 360px !important;
}

/* Meldt dato row: explicit 160/50/160/50 spacing and one-line height. */
#servicerequest_form .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 0 !important;
}

#servicerequest_form
    .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number
    > .fieldBox {
    align-items: center !important;
}

#servicerequest_form
    .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number
    > .fieldBox.field-reported_on {
    flex: 0 0 340px !important;
    width: 340px !important;
    min-width: 0 !important;
    max-width: 340px !important;
    margin-right: 160px !important;
}

#servicerequest_form
    .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number
    > .fieldBox.field-manufacturer {
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: none !important;
    margin-right: 160px !important;
}

#servicerequest_form
    .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number
    > .fieldBox.field-manufacturer
    > label,
#servicerequest_form
    .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number
    > .fieldBox.field-manufacturer_case_number
    > label {
    flex: 0 0 auto !important;
    width: auto !important;
    margin-right: 50px !important;
    white-space: nowrap;
}

#servicerequest_form
    .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number
    .fieldBox.field-manufacturer
    select {
    width: 160px !important;
}

#servicerequest_form
    .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number
    > .fieldBox.field-manufacturer_case_number {
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: none !important;
}

#servicerequest_form
    .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number
    .fieldBox.field-manufacturer_case_number
    input {
    width: 120px !important;
}

/* Match the upper Vedlegg drop zone to the lower customer-photos one. */
#servicerequest_form .form-row.field-manufacturer_pdf_upload > fieldset > .flex-container {
    width: 520px !important;
}

#servicerequest_form .form-row.field-manufacturer_pdf_upload .file-drop-zone {
    width: 520px !important;
}

/* Meldt dato row: 160px between the actual fields, achieved by label + 50px gap. */
#servicerequest_form .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number {
    align-items: flex-start !important;
}

#servicerequest_form
    .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number
    > .fieldBox {
    align-items: flex-start !important;
    gap: 0 !important;
}

#servicerequest_form
    .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number
    > .fieldBox.field-reported_on,
#servicerequest_form
    .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number
    > .fieldBox.field-manufacturer {
    margin-right: 0 !important;
}

#servicerequest_form
    .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number
    > .fieldBox.field-reported_on {
    gap: 10px !important;
}

/* Keep Kunde and Relatert ordre fields on the label line. */
#servicerequest_form .form-row.field-customer.field-order .related-widget-wrapper {
    flex: 0 0 350px !important;
    width: 350px !important;
    max-width: 350px !important;
}

#servicerequest_form .form-row.field-customer.field-order .select2-container,
#servicerequest_form .form-row.field-customer.field-order .select2-selection--single {
    width: 300px !important;
    min-width: 0 !important;
    max-width: 300px !important;
}

/* Meldt dato row: vertically centre labels and fields on one line. */
#servicerequest_form .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number {
    align-items: center !important;
}

#servicerequest_form
    .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number
    > .fieldBox {
    align-items: center !important;
}

/* Align the Produsent select with the date and saksnr inputs, and pull labels toward their fields. */
#servicerequest_form
    .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number
    .fieldBox.field-manufacturer
    .related-widget-wrapper {
    height: 27px !important;
    min-height: 27px !important;
    align-items: center !important;
}

#servicerequest_form
    .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number
    .fieldBox.field-manufacturer
    select {
    height: 27px !important;
    min-height: 27px !important;
    padding-top: 2px !important;
    padding-bottom: 2px !important;
    box-sizing: border-box !important;
}

#servicerequest_form
    .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number
    > .fieldBox.field-manufacturer
    > label,
#servicerequest_form
    .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number
    > .fieldBox.field-manufacturer_case_number
    > label {
    text-align: right;
}

#servicerequest_form
    .form-row.field-reported_on.field-manufacturer.field-manufacturer_case_number
    .fieldBox.field-manufacturer
    .related-widget-wrapper {
    position: relative !important;
    top: 3px !important;
}

.service-calendar-status-options {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 16px !important;
    margin: 0 0 10px !important;
}

.service-calendar-status-options .service-calendar-checkbox {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-weight: 400 !important;
}

.service-calendar-status-options .service-calendar-checkbox input {
    width: auto !important;
}

#servicerequest_form .form-row.field-service_confirmation_pdf_file .file-drop-zone {
    width: 520px !important;
    max-width: 100% !important;
}

#servicerequest_form .form-row.field-service_confirmation_pdf_file > fieldset {
    position: relative !important;
    display: block !important;
    padding: 0 0 0 122px !important;
    border: 0 !important;
    margin: 0 !important;
}

#servicerequest_form .form-row.field-service_confirmation_pdf_file > fieldset > legend {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 110px !important;
    margin: 0 !important;
    padding: 0 !important;
    font-weight: 600;
}

#servicerequest_form .form-row.field-service_confirmation_pdf_file > fieldset > .flex-container {
    width: 520px !important;
    max-width: 100% !important;
}

/* Order change: make Merkes (customer_project) twice as wide. */
#order_form .form-row.field-customer_project #id_customer_project {
    width: 320px !important;
    min-width: 320px !important;
    max-width: 320px !important;
}

/* Override the global order input width specifically for Merkes. */
#content #order_form .form-row.field-customer_project:not(#kystvinduet-global-override) input#id_customer_project:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]) {
    width: 320px !important;
    min-width: 320px !important;
    max-width: 320px !important;
}
