
/* Shared document header contract. Its base geometry must not depend on the
   document-details modal; selectors and child editors reuse the same header. */
html body [data-vario-component="VarioDocumentDialogHeader"],
html[data-vario-theme] body [data-vario-component="VarioDocumentDialogHeader"] {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 56px;
    min-width: 0;
    min-height: 56px;
    padding: 8px 13px;
    border: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--vario-window-header-bg) 72%, var(--vario-color-text-on-primary) 28%);
    background: var(--vario-window-header-bg);
    color: var(--vario-color-text-on-primary);
}

html body [data-vario-component="VarioDocumentDialogHeader"] .vario-erp-document-card-title,
html[data-vario-theme] body [data-vario-component="VarioDocumentDialogHeader"] .vario-erp-document-card-title {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 10px;
}

html body [data-vario-component="VarioDocumentDialogHeader"] .vario-erp-document-card-title > div,
html[data-vario-theme] body [data-vario-component="VarioDocumentDialogHeader"] .vario-erp-document-card-title > div {
    min-width: 0;
}

html body [data-vario-component="VarioDocumentDialogHeader"] .vario-erp-document-card-icon,
html[data-vario-theme] body [data-vario-component="VarioDocumentDialogHeader"] .vario-erp-document-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border: 1px solid color-mix(in srgb, var(--vario-color-text-on-primary) 32%, transparent);
    border-radius: 6px;
    background: color-mix(in srgb, var(--vario-color-text-on-primary) 10%, transparent);
    color: var(--vario-color-text-on-primary);
    font: 800 10px/1 var(--vario-font-family-ui);
}

html body [data-vario-component="VarioDocumentDialogHeader"] .vario-erp-document-card-icon .nav-icon,
html[data-vario-theme] body [data-vario-component="VarioDocumentDialogHeader"] .vario-erp-document-card-icon .nav-icon {
    width: 17px;
    height: 17px;
    color: currentColor;
}

html body [data-vario-component="VarioDocumentDialogHeader"] .modal-title,
html[data-vario-theme] body [data-vario-component="VarioDocumentDialogHeader"] .modal-title {
    overflow: hidden;
    margin: 0;
    color: var(--vario-color-text-on-primary);
    font: 700 15px/18px var(--vario-font-family-ui);
    letter-spacing: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

html body [data-vario-component="VarioDocumentDialogHeader"] .vario-erp-document-card-title small,
html[data-vario-theme] body [data-vario-component="VarioDocumentDialogHeader"] .vario-erp-document-card-title small {
    display: block;
    overflow: hidden;
    margin-top: 1px;
    color: color-mix(in srgb, var(--vario-color-text-on-primary) 82%, transparent);
    font: 500 10px/13px var(--vario-font-family-ui);
    text-overflow: ellipsis;
    white-space: nowrap;
}

html body [data-vario-component="VarioDocumentDialogHeader"] .vario-erp-document-card-badges,
html[data-vario-theme] body [data-vario-component="VarioDocumentDialogHeader"] .vario-erp-document-card-badges {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
    gap: 8px;
    min-width: 0;
}

/* Statuses and contextual actions belong to the shared document header.
   Consumers provide meaning only; they must not recreate badge geometry. */
html body [data-vario-component="VarioDocumentDialogHeader"] .vario-erp-document-card-badges > span,
html body [data-vario-component="VarioDocumentDialogHeader"] .vario-erp-document-card-badges > button:not(.vario-document-dialog-header-close),
html[data-vario-theme] body [data-vario-component="VarioDocumentDialogHeader"] .vario-erp-document-card-badges > span,
html[data-vario-theme] body [data-vario-component="VarioDocumentDialogHeader"] .vario-erp-document-card-badges > button:not(.vario-document-dialog-header-close) {
    display: inline-flex !important;
    align-items: center !important;
    box-sizing: border-box !important;
    height: 23px !important;
    min-height: 23px !important;
    padding: 0 9px !important;
    border: 1px solid color-mix(in srgb, var(--vario-color-text-on-primary) 35%, transparent) !important;
    border-radius: 8px !important;
    background: color-mix(in srgb, var(--vario-color-text-on-primary) 15%, transparent) !important;
    color: var(--vario-color-text-on-primary) !important;
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--vario-color-text-on-primary) 18%, transparent) !important;
    font: 900 10.5px/21px var(--vario-font-family-ui) !important;
    white-space: nowrap !important;
}

html body [data-vario-component="VarioDocumentDialogHeader"] .vario-document-dialog-header-close,
html[data-vario-theme] body [data-vario-component="VarioDocumentDialogHeader"] .vario-document-dialog-header-close {
    display: grid;
    width: 26px;
    min-width: 26px;
    height: 26px;
    min-height: 26px;
    padding: 0;
    place-items: center;
    border-color: transparent;
    background: transparent;
    color: var(--vario-color-text-on-primary);
}

html body [data-vario-component="VarioDocumentDialogHeader"] .vario-document-dialog-header-close:hover,
html body [data-vario-component="VarioDocumentDialogHeader"] .vario-document-dialog-header-close:focus-visible,
html[data-vario-theme] body [data-vario-component="VarioDocumentDialogHeader"] .vario-document-dialog-header-close:hover,
html[data-vario-theme] body [data-vario-component="VarioDocumentDialogHeader"] .vario-document-dialog-header-close:focus-visible {
    border-color: color-mix(in srgb, var(--vario-color-text-on-primary) 24%, transparent);
    background: color-mix(in srgb, var(--vario-color-text-on-primary) 12%, transparent);
    color: var(--vario-color-text-on-primary);
}

/* Shared document header geometry: identity stays compact while dates retain their standard width. */
html body .vario-erp-document-details-modal .vario-document-identity-grid,
html[data-vario-theme] body .vario-erp-document-details-modal .vario-document-identity-grid {
    grid-template-columns: minmax(210px, 332px) 128px !important;
    justify-content: start !important;
    column-gap: 10px !important;
    align-items: end !important;
}

html body .vario-erp-document-details-modal .vario-document-identity-grid .vario-document-identity-field input,
html[data-vario-theme] body .vario-erp-document-details-modal .vario-document-identity-grid .vario-document-identity-field input {
    width: 100% !important;
    min-width: 210px !important;
    max-width: 332px !important;
}

html body .vario-erp-document-details-modal .vario-document-notes-grid textarea,
html[data-vario-theme] body .vario-erp-document-details-modal .vario-document-notes-grid textarea {
    min-height: 48px !important;
    height: 48px !important;
    max-height: 48px !important;
    line-height: 17px !important;
}

@media (max-width: 900px) {

    html body .vario-erp-document-details-modal .vario-document-identity-grid,
    html[data-vario-theme] body .vario-erp-document-details-modal .vario-document-identity-grid {
        grid-template-columns: 1fr !important;
    }

    html body .vario-erp-document-details-modal .vario-document-identity-grid .vario-document-identity-field input,
    html[data-vario-theme] body .vario-erp-document-details-modal .vario-document-identity-grid .vario-document-identity-field input {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }
}

@media (max-width: 600px) {

    html body .vario-erp-document-details-modal .vario-erp-document-card-header,
    html[data-vario-theme] body .vario-erp-document-details-modal .vario-erp-document-card-header {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        align-content: center !important;
        align-items: center !important;
        flex: 0 0 auto !important;
        min-height: 88px !important;
        gap: 5px !important;
        padding: 8px 10px !important;
    }

    html body .vario-erp-document-details-modal .vario-erp-document-card-title,
    html[data-vario-theme] body .vario-erp-document-details-modal .vario-erp-document-card-title,
    html body .vario-erp-document-details-modal .vario-erp-document-card-title>div,
    html[data-vario-theme] body .vario-erp-document-details-modal .vario-erp-document-card-title>div {
        width: 100% !important;
        min-width: 0 !important;
    }

    html body .vario-erp-document-details-modal .vario-erp-document-card-title h5,
    html body .vario-erp-document-details-modal .vario-erp-document-card-title small,
    html[data-vario-theme] body .vario-erp-document-details-modal .vario-erp-document-card-title h5,
    html[data-vario-theme] body .vario-erp-document-details-modal .vario-erp-document-card-title small {
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    html body .vario-erp-document-details-modal .vario-erp-document-card-badges,
    html[data-vario-theme] body .vario-erp-document-details-modal .vario-erp-document-card-badges {
        width: 100% !important;
        min-width: 0 !important;
        padding-left: 48px !important;
        flex-wrap: wrap !important;
        justify-content: flex-start !important;
    }
}
