/* Scale the backend once, including its iframe content. Viewport-sized
   surfaces must still reach the edges of the browser after zooming. */
html.tt-scale-root {
    zoom: 0.9;
    --tt-scale-height: calc(100vh / 0.9);
    --tt-scale-width: calc(100vw / 0.9);
}

@supports (height: 100dvh) {
    html.tt-scale-root { --tt-scale-height: calc(100dvh / 0.9); }
}

html.tt-scale-root body#tabs .wrapper,
html.tt-scale-root .tt-sidebar {
    height: var(--tt-scale-height);
}

html.tt-scale-root body#tabs .content-wrapper {
    height: calc(var(--tt-scale-height) - var(--tt-content-top));
}

html.tt-scale-root body.tenant-login .login-layout,
html.tt-scale-root body.tenant-login .brand-panel {
    min-height: var(--tt-scale-height);
}

html.tt-scale-root body.inside-aside:not(.is-dialog) .content,
html.tt-scale-root body.inside-header:not(.is-dialog) .content {
    min-height: calc(var(--tt-scale-height) - 1px);
}

html.tt-scale-root .layui-layer.tt-form-drawer {
    height: var(--tt-scale-height) !important;
    max-width: var(--tt-scale-width);
}

html.tt-scale-root .layui-layer.tt-material-dialog {
    width: min(1040px, calc(var(--tt-scale-width) - 32px)) !important;
    height: min(720px, calc(var(--tt-scale-height) - 40px)) !important;
}

html.tt-scale-root .layui-layer.tt-link-dialog {
    max-width: calc(var(--tt-scale-width) - 48px);
    max-height: calc(var(--tt-scale-height) - 48px);
}

@media (max-width: 760px) {
    html.tt-scale-root body.tenant-login .brand-panel { min-height: 0; }
    html.tt-scale-root body.tenant-login .form-panel {
        min-height: calc(var(--tt-scale-height) - 80px);
    }
}
