html, body {
    height: 100%;
}

app {
    display: block;
    height: 100%;
}

.header-logo {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    width: auto;
    min-width: 88px;
    height: 36px;
    color: #1f2f3b;
}

.header-logo::before {
    content: "";
    display: block;
    width: 40px;
    height: 32px;
    background: url('../images/branding/paulis-logo.png') center / contain no-repeat;
}

.header-logo::after {
    content: "PKS";
    margin-left: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
}

.pks-shell-brand-host {
    display: inline-flex !important;
    align-items: center !important;
}

.pks-shell-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #1f2f3b;
    font-weight: 700;
    line-height: 1;
}

.pks-shell-brand-logo {
    display: block;
    width: 58px;
    height: 30px;
    object-fit: contain;
}

.pks-shell-brand-text {
    font-size: 1rem;
    letter-spacing: 0;
}

.pks-splash-brand [style*="background"],
.pks-splash-brand [class*="splash"],
.pks-splash-brand [class*="Splash"],
.pks-splash-brand [class*="loading"],
.pks-splash-brand [class*="Loading"] {
    background: transparent !important;
    background-color: transparent !important;
}

.pks-splash-brand img {
    display: block;
    object-fit: contain;
}

.pks-logon-card {
    width: min(500px, calc(100vw - 32px)) !important;
    border: 1px solid #dbe3ed !important;
    border-radius: 10px !important;
    box-shadow: 0 18px 46px rgba(26, 43, 61, 0.12) !important;
    background: #fff !important;
    padding: 32px 42px 34px !important;
}

.pks-logon-card > div {
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
}

.pks-logon-card input {
    background-color: #fff !important;
}

.pks-logon-template .logon-template-header {
    min-height: 48px;
}

.pks-logon-template .card-body {
    padding: 0 !important;
}

.pks-logon-branding {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    width: 100%;
    margin: -4px 0 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e4ebf3;
}

.pks-logon-branding img {
    display: block;
    object-fit: contain;
}

.pks-logon-branding-paulis {
    width: 206px;
    max-width: 60%;
    height: auto;
    max-height: 92px;
}

.pks-logon-branding-optisoft {
    width: 150px;
    max-width: 34%;
    height: auto;
    max-height: 42px;
}

.pks-logon-title {
    margin-top: 0 !important;
    margin-bottom: 18px !important;
    font-size: 1.28rem !important;
    font-weight: 700 !important;
    color: #162130 !important;
}

.pks-logon-intro {
    margin: 0 0 14px;
}

.pks-native-logon-form {
    position: relative;
}

.pks-logon-submit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    margin-top: 18px;
    padding: 9px 18px;
    border: 1px solid #1976d2;
    border-radius: 4px;
    background: #1976d2;
    color: #fff;
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.pks-logon-submit-button:hover {
    background: #1669bb;
    border-color: #1669bb;
}

.pks-logon-submit-button:focus {
    outline: 0;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

.pks-logon-submit-button:active {
    background: #125ba4;
    border-color: #125ba4;
}

.pks-native-logon-page {
    min-height: 100%;
    margin: 0;
    background: #fff;
    color: #162130;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.pks-native-logon-page-main {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

.pks-native-logon-card {
    box-sizing: border-box;
}

.pks-logon-field {
    margin-top: 12px;
}

.pks-logon-field label {
    display: block;
    margin-bottom: 4px;
}

.pks-logon-field input {
    box-sizing: border-box;
    width: 100%;
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid #b8c4d1;
    border-radius: 4px;
    color: #162130;
    font: inherit;
}

.pks-logon-field input:focus {
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.16);
    outline: 0;
}

.pks-logon-error {
    margin: 0 0 12px;
    padding: 8px 10px;
    border: 1px solid #f1b5b5;
    border-radius: 4px;
    background: #fff2f2;
    color: #9f1d1d;
}

.pks-change-password-dialog {
    width: min(720px, calc(100vw - 32px)) !important;
    max-width: calc(100vw - 32px) !important;
}

.pks-change-password-dialog .dxbl-popup-content,
.pks-change-password-dialog .dxbl-popup-body,
.pks-change-password-dialog .modal-body {
    overflow-x: hidden !important;
}

.pks-change-password-dialog .dxbl-fl,
.pks-change-password-dialog .dxbl-fl-cpt,
.pks-change-password-dialog .dxbl-text-edit {
    max-width: 100% !important;
}

.pks-change-password-visibility-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 12px;
    font-size: 0.92rem;
    color: #1f2f3b;
    user-select: none;
}

.pks-change-password-visibility-toggle input {
    margin: 0;
}

@media (max-width: 640px) {
    .pks-logon-branding {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        margin-bottom: 22px;
        padding-bottom: 18px;
    }

    .pks-logon-branding-paulis {
        width: 178px;
    }

    .pks-logon-branding-optisoft {
        width: 124px;
    }
}

#blazor-error-ui {
    background: inherit;
    bottom: 0;
    display: none;
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: 100001;
}

.pks-grid-standard .dxbl-grid-table {
    min-width: 1400px;
}

.pks-rezepte-list-grid {
    min-height: 0;
}

/* QuickAccess renders the PKS Arbeitskontext and license status as XAF Actions. */
.combobox-xaf-action,
.combobox-xaf-action .dxbl-btn,
[data-xaf-action="PKS_Arbeitskontext"],
[data-xaf-action="PKS_Arbeitskontext"] .dxbl-btn,
[data-xaf-action="PKS_Lizenzstatus"],
button[data-xaf-action="PKS_Lizenzstatus"] {
    min-height: 44px !important;
    font-size: 1.08rem !important;
}

.combobox-xaf-action,
[data-xaf-action="PKS_Arbeitskontext"] {
    width: clamp(360px, 36vw, 520px) !important;
    max-width: calc(100vw - 360px);
    min-width: 320px;
}

.combobox-xaf-action .dxbl-btn-group,
.combobox-xaf-action .btn-group,
.combobox-xaf-action .dxbl-btn,
[data-xaf-action="PKS_Arbeitskontext"] .dxbl-btn {
    width: 100%;
    min-width: 0;
    justify-content: space-between;
}

.combobox-xaf-action .dxbl-btn:not(:last-child),
[data-xaf-action="PKS_Arbeitskontext"] .dxbl-btn:not(:last-child) {
    flex: 1 1 auto;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

[data-xaf-action="PKS_Lizenzstatus"],
button[data-xaf-action="PKS_Lizenzstatus"] {
    font-weight: 600;
    padding-right: 16px !important;
    padding-left: 16px !important;
}

@media (max-width: 900px) {
    .combobox-xaf-action,
    [data-xaf-action="PKS_Arbeitskontext"] {
        width: 320px !important;
        max-width: calc(100vw - 260px);
    }
}

/* DevExpress renders popups outside the component scope. Keep Mandant/Betrieb edit popups fixed;
   only the embedded parameter section may scroll. */
.pks-edit-popup,
.pks-edit-popup .dxbl-popup {
    display: flex !important;
    width: min(900px, calc(100vw - 32px)) !important;
    height: min(760px, calc(100vh - 32px)) !important;
    max-width: calc(100vw - 32px) !important;
    max-height: calc(100vh - 32px) !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

.pks-edit-popup .dxbl-popup-header {
    flex: 0 0 auto !important;
}

.pks-edit-popup .dxbl-popup-content,
.pks-edit-popup .dxbl-popup-body {
    display: flex !important;
    min-height: 0 !important;
    flex: 1 1 auto !important;
    flex-direction: column !important;
    overflow: hidden !important;
    overflow-y: hidden !important;
    max-height: none !important;
}

.pks-edit-popup .dxbl-popup-body > div,
.pks-edit-popup-content {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    flex: 1 1 auto !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

.pks-edit-popup .pks-popup-section {
    flex: 0 0 auto !important;
}

.pks-edit-popup .pks-popup-form-actions {
    flex: 0 0 auto !important;
}

.pks-edit-popup .pks-popup-parameter-section {
    min-height: 0 !important;
    flex: 1 1 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

.pks-edit-popup .pks-popup-parameter-section .pks-parameter-editor {
    min-height: 0 !important;
    flex: 0 0 auto !important;
    overflow: visible !important;
}

.pks-copy-field {
    display: flex;
    width: 100%;
    align-items: stretch;
    gap: 6px;
}

.pks-copy-field-input {
    display: flex;
    min-width: 0;
    flex: 1 1 0;
}

.pks-copy-field-input .dxbl-text-edit {
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
}

.pks-copy-field .pks-copy-button {
    width: 32px !important;
    height: auto !important;
    min-height: 0;
    flex: 0 0 32px;
    align-self: stretch;
}

/* DxSpinEdit renders the actual input inside DevExpress-owned markup. This global rule
   intentionally targets only PKS parameter numeric editors. */
.pks-parameter-number-editor input,
.pks-parameter-number-editor .dxbl-text-edit-input,
.pks-parameter-number-input {
    text-align: right !important;
}

/* Shared PKS form conventions: stable dialog navigation and numeric alignment. */
.pks-dialog-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    width: 100%;
    min-width: 0;
    flex: 0 0 auto;
    margin-top: auto;
    border-top: 1px solid #e5e7eb;
    padding-top: 8px;
}

.pks-dialog-footer-left,
.pks-dialog-footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
}

.pks-dialog-footer-right {
    justify-content: flex-end;
    margin-left: auto;
}

.pks-numeric-cell {
    display: block;
    width: 100%;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.pks-numeric-editor input,
.pks-numeric-editor .dxbl-text-edit-input {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}

/* DxPopup renders its custom header outside the Razor CSS-isolation scope. */
.pks-eaternity-menu-plan-title,
.pks-eaternity-menu-plan-test-notice {
    display: flex;
    align-items: center;
    min-width: 0;
}

.pks-eaternity-menu-plan-title {
    gap: 14px;
    width: 100%;
    font-weight: 700;
}

.pks-eaternity-menu-plan-test-notice {
    gap: 8px;
    border-left: 3px solid var(--bs-warning, #b7791f);
    padding: 4px 8px;
    background: var(--bs-warning-bg-subtle, #fff4d6);
    color: var(--bs-body-color, #20262d);
    font-size: 12px;
    font-weight: 400;
}

.pks-eaternity-menu-plan-grid {
    flex: 1 1 0;
    width: 100%;
    min-width: 0;
    height: 100%;
    min-height: 0;
}

.pks-eaternity-menu-plan-grid .dxbl-scroll-viewer-content {
    overflow-x: scroll !important;
    scrollbar-gutter: stable;
}

@media (max-width: 520px) {
    .pks-dialog-footer {
        align-items: flex-end;
    }
}
