/* PATCH 015 - WORKSPACE RUNTIME AUTHORITY */
:root {
    --system-header-measured-height: var(--system-workspace-header-height, 72px);
    --system-side-gutter-top: var(--system-header-measured-height);
    --system-side-gutter-bottom: var(--system-workspace-footer-height, 34px);
}

.app-header[data-workspace-authority="system"] {
    touch-action: none;
    user-select: none;
    cursor: grab;
    width: max-content;
    min-width: min(720px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    height: auto;
}
.app-header[data-dragging="true"] { cursor: grabbing; }
.app-header[data-workspace-authority="system"] input,
.app-header[data-workspace-authority="system"] button,
.app-header[data-workspace-authority="system"] select,
.app-header[data-workspace-authority="system"] a {
    user-select: auto;
    cursor: initial;
}

html[data-system-header-position="top"] .app-header {
    position: fixed !important;
    top: 0 !important;
    bottom: auto !important;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    max-width: none !important;
}
html[data-system-header-position="bottom"] .app-header {
    position: fixed !important;
    top: auto !important;
    bottom: var(--system-workspace-footer-height, 34px) !important;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    max-width: none !important;
}
html[data-system-header-position="floating"] .app-header {
    position: fixed !important;
    top: var(--header-float-y, 24px) !important;
    left: var(--header-float-x, 24px) !important;
    right: auto !important;
    bottom: auto !important;
    width: max-content !important;
}

html[data-system-header-position="top"] {
    --system-side-gutter-top: var(--system-header-measured-height);
    --system-side-gutter-bottom: var(--system-workspace-footer-height, 34px);
}
html[data-system-header-position="bottom"] {
    --system-side-gutter-top: 0px;
    --system-side-gutter-bottom: calc(var(--system-header-measured-height) + var(--system-workspace-footer-height, 34px));
}
html[data-system-header-position="floating"] {
    --system-side-gutter-top: 0px;
    --system-side-gutter-bottom: var(--system-workspace-footer-height, 34px);
}

#left-dock,
#right-dock {
    top: var(--system-side-gutter-top) !important;
    bottom: var(--system-side-gutter-bottom) !important;
    max-height: calc(100vh - var(--system-side-gutter-top) - var(--system-side-gutter-bottom)) !important;
}

html[data-system-header-position="top"] #map-viewport {
    top: var(--system-header-measured-height) !important;
    bottom: var(--system-workspace-footer-height, 34px) !important;
}
html[data-system-header-position="bottom"] #map-viewport {
    top: 0 !important;
    bottom: calc(var(--system-header-measured-height) + var(--system-workspace-footer-height, 34px)) !important;
}
html[data-system-header-position="floating"] #map-viewport {
    top: 0 !important;
    bottom: var(--system-workspace-footer-height, 34px) !important;
}

/* Capabilities remain attached to the surface when containers change. */
[data-surface-authority="object-surface"] [data-entity-id][data-entity-type] {
    pointer-events: auto;
}
[data-surface-authority="object-surface"][data-floating="true"],
[data-surface-authority="object-surface"].floating,
[data-surface-authority="object-surface"].is-floating {
    z-index: calc(var(--workspace-layer-system, 400) + 2) !important;
}
