/* Only the organization-chart route uses a fixed, scroll-free workspace. */
html:has(body.chart-canvas-active), body.chart-canvas-active {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    overscroll-behavior: none;
}
body.chart-canvas-active .app-shell {
    margin: 0 auto;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    max-height: 100dvh;
}
body.chart-canvas-active .main-content {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
#chart-view:not([hidden]) {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}
#chart-view > .page-head { flex: 0 0 auto; margin-bottom: 12px; }
#chart-panel:not([hidden]) {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
#chart-panel .chart-toolbar { flex: 0 0 auto; }
#diagram-viewport {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    max-height: none;
    overflow: clip;
    isolation: isolate;
    cursor: grab;
    touch-action: none;
    overscroll-behavior: none;
    user-select: none;
    direction: ltr;
}
#diagram-viewport.is-panning, #diagram-viewport.is-panning * { cursor: grabbing !important; }
#diagram-content {
    position: absolute;
    top: 0;
    left: 0;
    width: max-content;
    min-width: 0;
    max-width: none;
    padding: 26px;
    direction: rtl;
    transform-origin: 0 0;
}
#diagram-content .member-list { max-height: none; overflow: visible; }
.canvas-controls {
    position: absolute;
    z-index: 5;
    inset-inline-end: 14px;
    bottom: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px;
    border: 1px solid #cbd8e9;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 3px 15px #243b6022;
    cursor: default;
}
.canvas-controls button {
    display: grid;
    place-items: center;
    min-width: 34px;
    min-height: 34px;
    padding: 3px 8px;
    border: 0;
    border-radius: 6px;
    color: #29466a;
    font-weight: 700;
    background: transparent;
    cursor: pointer;
}
.canvas-controls button:hover { background: #eaf2ff; color: #0967ef; }
.canvas-controls button:disabled { opacity: .4; cursor: default; }
#canvas-zoom-in, #canvas-zoom-out { font-size: 21px; }
#canvas-zoom-level { min-width: 48px; text-align: center; font: 12px/1.5 system-ui, sans-serif; }
.canvas-divider { height: 23px; width: 1px; background: #d6dfec; }
.canvas-hint {
    position: absolute;
    bottom: 18px;
    left: 12px;
    direction: rtl;
    color: #536b87;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 6px;
    background: #ffffffd9;
    pointer-events: none;
}
@media (max-width: 700px) {
    body.chart-canvas-active .app-shell { grid-template-rows: auto auto minmax(0, 1fr); }
    body.chart-canvas-active .main-content { padding: 8px; }
    #chart-view > .page-head { margin-bottom: 6px; padding-bottom: 6px; }
    #chart-view h1 { font-size: 18px; }
    #chart-panel .chart-toolbar { padding: 6px 8px; gap: 5px; }
    .canvas-hint { display: none; }
    .canvas-controls { bottom: 8px; inset-inline-end: 8px; }
}
@media (max-height: 500px) {
    body.chart-canvas-active .main-content { padding-block: 5px; }
    #chart-view > .page-head { margin-bottom: 5px; padding-bottom: 5px; }
    #chart-panel .chart-toolbar { padding-block: 4px; }
}
